<< back
PD4ML Conversion Status
After render() call is invoked and a PDF document produced, PD4ML allows
to report some conversion info.
// reports number of generated pages
System.out.println("pages: " + (Long)pd4ml.getLastRenderInfo(PD4Constants.PD4ML_TOTAL_PAGES));
// reports actual HTML document layout height in pixels
// (as a rule the value depends on htmlWidth conversion parameter)
System.out.println("height: " + (Long)pd4ml.getLastRenderInfo(PD4Constants.PD4ML_DOCUMENT_HEIGHT_PX));
// reports default width of the HTML document layout in pixels.
// If the document has root-level elements with width="100%",
// the returned value is almost always going to be equal htmlWidth parameter.
// If the returned value is smaller htmlWidth, probably it is optimal htmlWidth for the given document.
System.out.println("right edge: " + (Long)pd4ml.getLastRenderInfo(PD4Constants.PD4ML_RIGHT_EDGE_PX));
Also there is a possibility to request PDF/A conversion status (relevant for PD4ML Volume DMS and PD4ML Source Code licenses)
PD4ML.StatusMessage[] msgs =
(PD4ML.StatusMessage[])pd4ml.getLastRenderInfo(PD4Constants.PD4ML_PDFA_STATUS);
for ( int i = 0; i < msgs.length; i++ ) {
System.out.println( (msgs[i].isError() ? "ERROR: " : "WARNING: ") + msgs[i].getMessage());
}
|