Forum How do I...?

How to catch errors for multiple files

atopher
We are converting multiple HTML files into a single PDF.

When one of the HTML files fails to convert, Prince continues with the rest of the documents and we end up with a PDF document but with a missing page.

Is there a way of catching these errors? At the moment the conversion is called via win command:

"C:\Program Files (x86)\Prince\Engine\bin\prince.exe"  "c:\temp\princexml\broken-file.html" "c:\temp\princexml\working-file.html"  -o "c:\temp\princexml\merge6.pdf


Shows the following error:
prince: error: dropping unpackable block


I don't really want to check the log output for errors, as the errors messages will change overtime and be inconsistent.

We could change this to the c# wrapper if that would assist.

We are running PrinceXML 12.5 in dev and v7 in production

(I actually can't force v12 to fail creating a PDF file but still need to catch these errors when we upgrade production to v12).

Thanks

Chris

BTW have used the sample from https://www.princexml.com/forum/topic/4166/column-span-2-and-height-100-in-a-3-column-layout-leads-to to generate the error in v12. Any tips on how to break a conversion are welcome so I can test for errors :-)

Edited by atopher

mikeday
One cause of the "unpackable block" error has already been fixed in latest builds.

I think we will need to introduce a new error severity level in order to solve this issue, or a set of options for failing on certain classes of error or warning.
atopher
I think we will need to introduce a new error severity level in order to solve this issue, or a set of options for failing on certain classes of error or warning.

Yes that would be really useful Mike, this way we could check for outright failed conversions in a consistent manner.
mikeday
In the latest build we have added several new command-line options:
--fail-dropped-content
--fail-missing-resources
--fail-missing-glyphs

These comprise a fail-safe mechanism where Prince will signal a failure status and not generate a PDF if the specified conditions are triggered. You can also trigger the fail-safe from JavaScript by setting Prince.failStatus to true.

Since this is a new mechanism we may refine the options and fail-safe conditions over time if necessary to make them more useful; please let us know if you have any feedback.