Broken PDF export
Hi. We are using xwiki for almost two years (as internal knowledge base) and although we still have some problems - thank you very much for all you work, I hope we will be able to solve some paining issues ;-), I'm pretty determined to dig until success, I count on your help and promise to give sufficient feedback. Our main problems are: * broken PDF export (generated null-byte files) * broken search on non-latin1 characters (that I'll describe in separate thread) Hera are the details My platform is: tomcat 5.5.17 running in locale pl_PL.UTF-8 JDK 1.5.0 mysql 5.0 with default charset UTF-8 (and DB in UTF-8 too). xwiki.war 9.840, but the same bahaviour is on latest SVN trunk. I suppose that problem with PDF export has something to do with UTF-8. I'm pretty sure I have UTF-8 configured properly (xwiki.encoding in xwiki.cfg and filter in web.xml), non-latin1 characters are being properly written to and read from database, are also properly rendered in xwiki pages. When I click PDF export link (even viewing document containing only ASCII characters) I receive an empty file and some entries in catalina.out: ######## <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title> Wiki - Sandbox - TestTopic1 </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="revisit-after" content="7 days" /> <meta name="description" content="Intranet Wiki" /> <meta name="keywords" content="wiki" /> <meta name="distribution" content="GLOBAL" /> <meta name="rating" content="General" /> <meta name="copyright" content="you need to choose your copyright" /> <meta name="author" content="" /> <meta http-equiv="reply-to" content="" /> <meta name="language" content="pl" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> [...] line 5 column 1 - Warning: <html> has XML attribute "xml:lang" [Fatal Error] :78:27: Invalid byte 1 of 1-byte UTF-8 sequence. 19:53:36,729 WARN TP-Processor4 https://xwiki.biuro.contium.pl:5443/xwiki/bin/pdf/Sandbox/TestTopic1 XWikiAction:execute:185 - Uncaught exception: Error number 12003 in 12: XSL Transformation Failed Wrapped Exception: Invalid byte 1 of 1-byte UTF-8 sequence. com.xpn.xwiki.XWikiException: Error number 12003 in 12: XSL Transformation Failed Wrapped Exception: Invalid byte 1 of 1-byte UTF-8 sequence. at com.xpn.xwiki.pdf.impl.PdfExportImpl.applyXsl(PdfExportImpl.java:176) at com.xpn.xwiki.pdf.impl.PdfExportImpl.convertXHtmlToXMLFO(PdfExportImpl.java:154) at com.xpn.xwiki.pdf.impl.PdfExportImpl.exportXHtml(PdfExportImpl.java:86) at com.xpn.xwiki.pdf.impl.PdfExportImpl.exportHtml(PdfExportImpl.java:115) at com.xpn.xwiki.pdf.impl.PdfExportImpl.export(PdfExportImpl.java:129) at com.xpn.xwiki.pdf.impl.PdfExportImpl.exportToPDF(PdfExportImpl.java:119) at com.xpn.xwiki.web.PDFAction.render(PDFAction.java:45) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:146) [...] ######## Do you any have any idea what can be the cause of this exception? I suppose that ' <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">' has nothing to do, although I don't know why lang, content-type and charset are derived both from templates/httpheader.vm and xwiki->preferences. I hope I will be able to run it under eclipse soon, maybe I find the problem.... Best regards, Richard. -- "First they ignore you. Then they laugh at you. Then they fight you. Then you win." - Mohandas Gandhi.
Hi, For PDF export the first thing to check is if you can export an empty or near empty document If not then you probably have a setup problem (temp dir, etc..) If yes, then it has to do with the content Known problems are: - PDF export does not always support custom HTML. HTML easily breaks the export - PDF export refuses to have to subtitles with the same name. Currently it generates anchors with the same ID which is non valid HTML and breaks the PDF export Somebody is actually working to fix this issue in the anchor ID generation Concerning non latin issues, I'm not sure I'm a good help ! Ludovic Ryszard Lach a écrit :
Hi.
We are using xwiki for almost two years (as internal knowledge base) and although we still have some problems - thank you very much for all you work, I hope we will be able to solve some paining issues ;-), I'm pretty determined to dig until success, I count on your help and promise to give sufficient feedback.
Our main problems are:
* broken PDF export (generated null-byte files) * broken search on non-latin1 characters (that I'll describe in separate thread)
Hera are the details
My platform is:
tomcat 5.5.17 running in locale pl_PL.UTF-8 JDK 1.5.0 mysql 5.0 with default charset UTF-8 (and DB in UTF-8 too). xwiki.war 9.840, but the same bahaviour is on latest SVN trunk.
I suppose that problem with PDF export has something to do with UTF-8. I'm pretty sure I have UTF-8 configured properly (xwiki.encoding in xwiki.cfg and filter in web.xml), non-latin1 characters are being properly written to and read from database, are also properly rendered in xwiki pages. When I click PDF export link (even viewing document containing only ASCII characters) I receive an empty file and some entries in catalina.out:
######## <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title> Wiki - Sandbox - TestTopic1 </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="revisit-after" content="7 days" /> <meta name="description" content="Intranet Wiki" /> <meta name="keywords" content="wiki" /> <meta name="distribution" content="GLOBAL" /> <meta name="rating" content="General" /> <meta name="copyright" content="you need to choose your copyright" /> <meta name="author" content="" /> <meta http-equiv="reply-to" content="" /> <meta name="language" content="pl" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> [...] line 5 column 1 - Warning: <html> has XML attribute "xml:lang" [Fatal Error] :78:27: Invalid byte 1 of 1-byte UTF-8 sequence. 19:53:36,729 WARN TP-Processor4 https://xwiki.biuro.contium.pl:5443/xwiki/bin/pdf/Sandbox/TestTopic1 XWikiAction:execute:185 - Uncaught exception: Error number 12003 in 12: XSL Transformation Failed Wrapped Exception: Invalid byte 1 of 1-byte UTF-8 sequence. com.xpn.xwiki.XWikiException: Error number 12003 in 12: XSL Transformation Failed Wrapped Exception: Invalid byte 1 of 1-byte UTF-8 sequence. at com.xpn.xwiki.pdf.impl.PdfExportImpl.applyXsl(PdfExportImpl.java:176) at com.xpn.xwiki.pdf.impl.PdfExportImpl.convertXHtmlToXMLFO(PdfExportImpl.java:154) at com.xpn.xwiki.pdf.impl.PdfExportImpl.exportXHtml(PdfExportImpl.java:86) at com.xpn.xwiki.pdf.impl.PdfExportImpl.exportHtml(PdfExportImpl.java:115) at com.xpn.xwiki.pdf.impl.PdfExportImpl.export(PdfExportImpl.java:129) at com.xpn.xwiki.pdf.impl.PdfExportImpl.exportToPDF(PdfExportImpl.java:119) at com.xpn.xwiki.web.PDFAction.render(PDFAction.java:45) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:146) [...] ########
Do you any have any idea what can be the cause of this exception?
I suppose that ' <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">'
has nothing to do, although I don't know why lang, content-type and charset are derived both from templates/httpheader.vm and xwiki->preferences.
I hope I will be able to run it under eclipse soon, maybe I find the problem....
Best regards,
Richard.
------------------------------------------------------------------------
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
-- Ludovic Dubost XPertNet: http://www.xpertnet.fr/ Blog: http://www.ludovic.org/blog/ XWiki: http://www.xwiki.com Skype: ldubost AIM: nvludo Yahoo: ludovic
On Thu, Aug 31, 2006 at 09:28:24PM +0200, Ludovic Dubost wrote:
Hi,
For PDF export the first thing to check is if you can export an empty or near empty document If not then you probably have a setup problem (temp dir, etc..)
I've created a document containig single letter 'a'. Xwiki behaves in just the same way - the same error in catalina.out. I cannot find any setting regarding temporary dir. Besides, I guess it would influence also on file uploads and I can upload attachments without problems. Richard. -- "First they ignore you. Then they laugh at you. Then they fight you. Then you win." - Mohandas Gandhi.
Sorry I didn't look at the exception.. Clearly it seems to be a UTF-8 problem. Maybe Xavier or Stephane have an idea since they are running xwiki on UTF-8 Ludovic Ryszard Lach a écrit :
On Thu, Aug 31, 2006 at 09:28:24PM +0200, Ludovic Dubost wrote:
Hi,
For PDF export the first thing to check is if you can export an empty or near empty document If not then you probably have a setup problem (temp dir, etc..)
I've created a document containig single letter 'a'. Xwiki behaves in just the same way - the same error in catalina.out.
I cannot find any setting regarding temporary dir. Besides, I guess it would influence also on file uploads and I can upload attachments without problems.
Richard.
------------------------------------------------------------------------
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
-- Ludovic Dubost XPertNet: http://www.xpertnet.fr/ Blog: http://www.ludovic.org/blog/ XWiki: http://www.xwiki.com Skype: ldubost AIM: nvludo Yahoo: ludovic
On Thu, Aug 31, 2006 at 10:01:04PM +0200, Ludovic Dubost wrote:
Sorry I didn't look at the exception.. Clearly it seems to be a UTF-8 problem. Maybe Xavier or Stephane have an idea since they are running xwiki on UTF-8
Now I can confirm it. Problem is for sure in xsl transformation and occurs only when using non-latin1 characters. With brand new xwiki database I can export document containing 'a' or 'ó' (oacute), which have the same codes in LATIN1, LATIN2 and UTF-8. When I enter some other non-LATIN1 characters - export fails with exception [Fatal Error] :66:27: Invalid byte 2 of 2-byte UTF-8 sequence. 11:43:33,806 WARN http-8080-Processor24 http://localhost:8080/xwiki/bin/pdf/Sandbox/TestTopic1 XWikiAction:execute:185 - Uncaught exception: Error number 12003 in 12: XSL Transformation Failed Wrapped Exception: Invalid byte 2 of 2-byte UTF-8 sequence. com.xpn.xwiki.XWikiException: Error number 12003 in 12: XSL Transformation Failed Wrapped Exception: Invalid byte 2 of 2-byte UTF-8 sequence. at com.xpn.xwiki.pdf.impl.PdfExportImpl.applyXsl(PdfExportImpl.java:176) at com.xpn.xwiki.pdf.impl.PdfExportImpl.convertXHtmlToXMLFO(PdfExportImpl.java:154) [...] Problem with saving a document containing only single letter 'a' in my previous tests has probably something to do with my database, which I used - it has plenty documents with non-LATIN1 content and probably some charactes not belonging to editable part of xwiki page (maybe some preferences?) was transformed with xslt throwing an exception. I have xwiki run on eclipse, but I'm not a programmer, so I affraid I won't be able to find much more.... Does anybody have working pdf-export of UTF-8 documents? Richard. -- "First they ignore you. Then they laugh at you. Then they fight you. Then you win." - Mohandas Gandhi.
Dear all, For UTF-8 pdf generation, you have to patch the following class : com.xpn.xwiki.pdf.impl.PdfExportImpl (http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/xwiki/xwiki/trunk/src/mai...) by replacing the ligne : tidy.setCharEncoding(Configuration.LATIN1); with tidy.setCharEncoding(Configuration.UTF8); It works with French characters but not completly with Chinese or Vietnamese. Regards -- Xavier MOGHRABI - Consortium ObjectWeb Jabber: [email protected] - Phone: +33 4 76 61 52 35 Le vendredi 1 septembre 2006 15:00, Richard Lach a écrit :
On Thu, Aug 31, 2006 at 10:01:04PM +0200, Ludovic Dubost wrote:
Sorry I didn't look at the exception.. Clearly it seems to be a UTF-8 problem. Maybe Xavier or Stephane have an idea since they are running xwiki on UTF-8
Now I can confirm it. Problem is for sure in xsl transformation and occurs only when using non-latin1 characters.
With brand new xwiki database I can export document containing 'a' or 'ó' (oacute), which have the same codes in LATIN1, LATIN2 and UTF-8. When I enter some other non-LATIN1 characters - export fails with exception
[Fatal Error] :66:27: Invalid byte 2 of 2-byte UTF-8 sequence. 11:43:33,806 WARN http-8080-Processor24 http://localhost:8080/xwiki/bin/pdf/Sandbox/TestTopic1 XWikiAction:execute:185 - Uncaught exception: Error number 12003 in 12: XSL Transformation Failed Wrapped Exception: Invalid byte 2 of 2-byte UTF-8 sequence. com.xpn.xwiki.XWikiException: Error number 12003 in 12: XSL Transformation Failed Wrapped Exception: Invalid byte 2 of 2-byte UTF-8 sequence. at com.xpn.xwiki.pdf.impl.PdfExportImpl.applyXsl(PdfExportImpl.java:176) at com.xpn.xwiki.pdf.impl.PdfExportImpl.convertXHtmlToXMLFO(PdfExportImpl.java :154) [...]
Problem with saving a document containing only single letter 'a' in my previous tests has probably something to do with my database, which I used - it has plenty documents with non-LATIN1 content and probably some charactes not belonging to editable part of xwiki page (maybe some preferences?) was transformed with xslt throwing an exception.
I have xwiki run on eclipse, but I'm not a programmer, so I affraid I won't be able to find much more....
Does anybody have working pdf-export of UTF-8 documents?
Richard.
On Mon, Sep 04, 2006 at 12:46:56PM +0200, Xavier MOGHRABI wrote:
Dear all,
For UTF-8 pdf generation, you have to patch the following class : com.xpn.xwiki.pdf.impl.PdfExportImpl (http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/xwiki/xwiki/trunk/src/mai...)
by replacing the ligne : tidy.setCharEncoding(Configuration.LATIN1); with tidy.setCharEncoding(Configuration.UTF8);
It works with French characters but not completly with Chinese or Vietnamese.
Thank's a a lot, that's it! Documents are generated now, at least, and are returned with appplication/x-pdf content type. Polish characters are not working yet, but I've heard I should configure polish fonts for FOP. Best regards, R. -- "First they ignore you. Then they laugh at you. Then they fight you. Then you win." - Mohandas Gandhi.
participants (4)
-
Ludovic Dubost -
Richard Lach -
Ryszard Lach -
Xavier MOGHRABI