Edit online

DITA PDF Processing Common Errors

There are cases when the PDF processing fails when trying to publish DITA content to a PDF file. This topic lists some of the common problems and possible solutions.

Problem: Cannot Save PDF

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\default\Desktop\bev\out\pdf\test.pdf 
(The process cannot access the file because it is being used by another process)

Solution: Cannot Save PDF

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.

Problem: Table Contains More Cells Than Defined in Colspec

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

Solution: Table Contains More Cells Than Defined in Colspec

To resolve this issue, correct the @colspec attribute on the table that caused the issue. To locate the table that caused the issue:
  1. Edit the transformation scenario and set the parameter clean.temp to no.
  2. Run the transformation, open the topic.fo file in Oxygen XML Editor, and look in it at the line specified in the error message (See position 179:-1).
  3. 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 where the table was generated.