Closed rtovars closed 5 years ago
Hi AsciiDocFX Team:
Today I had some spare time to do incremental trial-and-error troubleshooting to find out what was the cause of this problem, and it was a silly mistake on my part, but I'll answer my own question just in case someone else has the same problem.
Basically the problem was that an image overflowed the PDF page height because I had used the scaledwidth paramenter and set it to 100%.
My fo-pdf.xsl configuration file (C:\Program Files\AsciidocFX\conf\docbook-config\fo-pdf.xsl) has the following settings:
Page size:
<xsl:param name="page.height.portrait">27.94cm</xsl:param>
<xsl:param name="page.width.portrait">21.59cm</xsl:param>
Margin size:
<xsl:param name="page.margin.top">1.25cm</xsl:param>
<xsl:param name="body.margin.top">1cm</xsl:param>
<xsl:param name="page.margin.bottom">1.25cm</xsl:param>
<xsl:param name="body.margin.bottom">1cm</xsl:param>
<xsl:param name="region.before.extent">0.5cm</xsl:param>
<xsl:param name="region.after.extent">0.5cm</xsl:param>
<xsl:param name="page.margin.inner">2.35cm</xsl:param>
<xsl:param name="page.margin.outer">1.65cm</xsl:param>
<xsl:param name="body.margin.inner">0cm</xsl:param>
<xsl:param name="body.margin.outer">0cm</xsl:param>
I had two images in contiguous rows, and their image sizes were as follows: ImageA.png - 1080 x 1326 ImageB.png - 676 x 1403
When I was trying to generate PDF output, the resulting file was truncated to 113KB, while normally it was a 5MB file, and I saw this:
image::images/ImageA.png[scaledwidth="100%"] //Throws the IndexOutOfBoundsException error message!!!
// Processing stops here!
// Rest of document is not processed, and actually the resulting PDF file is corrupted.
After troubleshooting and tweaking both the image and the parameters, I changed the first image so it wouldn't use the scaledwidth="100%" parameter:
image::images/ImageA.png[] //Renders OK
image::images/ImageB.png[scaledwidth="100%"] //Renders OK and continues until the end of the document.
So, the conclusion is this: Be careful when using the scaledwidth parameter with images that when scaled to fit the page's width, will run the risk to overflow the page's height, as it causes the error when trying to generate PDF output.
In this case, the solution is either to reduce the image's height OR to remove the scaledwidth parameter so the renderer will automatically fit the image to the page's height.
Keep up the good work!
Hi, A couple of days ago while converting a document to PDF, I got the following error message in the log:
ERROR => org.xml.sax.SAXParseException; systemId: file:/C:/Program%20Files/AsciidocFX/conf/docbook/fo/docbook.xsl; lineNumber: 280; columnNumber: 54; java.lang.IndexOutOfBoundsException: Index 25 out of bounds for length 25
This is the offending line:
I deleted my current installation and downloaded release v1.7.1 (AsciidocFX_Windows.exe). After installing I generated again my PDF and this time it worked fine, but I corrected some errors after proofreading the PDF and generated it a couple more times, but on my last try I got again the same error message. I replaced the docbook.xsl file with a fresh copy but I got the same error again and after uninstalling and installing again the ZIP version it still fails.
I'm working on a Win10 machine, and I had been using v1.6.9 for a long time without any problem. I googled this error message on the Internet and in the issues section of this repository but I can't find anything that helps.
My source file seems to be rendered properly in both Asciidocfx and in the browser preview, and I was able to produce an HTML file as well, so I don't think the problem is that my source file is corrupted or unable to be parsed or that it contains invalid formatting.
Can you take a look and let me know how to fix this? Thank you a lot for your help.