PDF Processing Fails to Use the DITA OT and Apache FOP
There are cases when publishing DITA content fails when creating a PDF file. This topic lists some common problems and solutions.
-
The FO processor cannot save the PDF at the specified target. The console output contains messages like this:
[fop] [ERROR] Anttask - Error rendering fo file: C:\samples\dita\temp\pdf\oxygen_dita_temp\topic.fo <Failed to open C:\samples\dita\out\pdf\test.pdf> Failed to open samples\dita\out\pdf\test.pdf ............. [fop] Caused by: java.io.FileNotFoundException: C:\Users\radu_coravu\Desktop\bev\out\pdf\test.pdf (The process cannot access the file because it is being used by another process)
Such an error message usually means that the PDF file is already opened in a PDF reader application. The solution is to close the open PDF before running the transformation. -
One of the DITA tables contains more cells in a table row than the defined number of colspec elements. The console output contains messages like this:
[fop] [ERROR] Anttask - Error rendering fo file: D:\projects\eXml\samples\dita\flowers\temp\pdf\oxygen_dita_temp\topic.fo <net.sf.saxon.trans.XPathException: org.apache.fop.fo.ValidationException: The column-number or number of cells in the row overflows the number of fo:table-columns specified for the table. (See position 179:-1)>net.sf.saxon.trans.XPathException: org.apache.fop.fo.ValidationException: The column-number or number of cells in the row overflows the number of fo:table-columns specified for the table. (See position 179:-1) [fop] at org.apache.fop.tools.anttasks.FOPTaskStarter.renderInputHandler (Fop.java:657) [fop] at net.sf.saxon.event.ContentHandlerProxy.startContent (ContentHandlerProxy.java:375) ............ [fop] D:\projects\samples\dita\flowers\temp\pdf\oxygen_dita_temp\topic.fo -> D:\projects\samples\dita\flowers\out\pdf\flowers.pdf
To resolve this issue, correct the colspec attribute on the table that caused the issue. To locate the table that caused the issue:- Edit the transformation scenario and set the parameter clean.temp to no.
- Run the transformation, open the
topic.fo
file in Oxygen XML Developer plugin, and look in it at the line specified in the error message(See position 179:-1)
. - Look around that line in the
XSL-FO
file to find relevant text content that you can use (for example, with the Find/Replace in Files action in the DITA Maps Manager view) to find the original DITA topic for which the table was generated.
-
There is a broken link in the generated
XSL-FO
file. The PDF is generated but contains a link that is not working. The console output contains messages like this:[fop] 1248 WARN [ main ] org.apache.fop.apps.FOUserAgent - Page 6: Unresolved ID reference "unique_4_Connect_42_wrongID" found.
To resolve this issue:- Use the Validate and Check for Completeness action available in the DITA Maps Manager view to find such problems.
- If you publish to PDF using a
DITAVAL
filter, select the same DITAVAL file in the DITA Map Completeness Check dialog box. - If the Validate and Check for Completeness action does not discover any issues, edit the transformation scenario and set the clean.temp parameter to no.
- Run the transformation, open the
topic.fo
file in Oxygen XML Developer plugin, and search in it for theunique_4_Connect_42_wrongID
id
. -
Look around that line in the
XSL-FO
file to find relevant text content that you can use (for example, with the Find/Replace in Files action in the DITA Maps Manager view) to find the original DITA topic for which the table was generated.