HTML to PDF / DOCX / RTF Java converter library Forums PD4ML v3 Archived Forums (Read Only) General questions / FAQ will setHtmlTemplate() work in the trial version of PD4ML?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #26223

    I am attempting to perform a proof of concept using the trial version of PD4ML and java (no jsp). I want to be able to display multiple tables in the header and footer. When I create a string containing html table tags and use setHtmlTemplate(htmlstring) to place this string in the header the rendered HTML does not appear in the resulting PDF document. I am wondering what I am doing wrong.

    My test code looks like this:

    [language=java:3fb0dy6f]private void generatePDF(String inputHTMLFileName, File outputPDFFile,
    Dimension format, String fontsDir, String headerBody)
    throws Exception
    { fos = new;
    PD4ML pd4ml = new PD4ML();
    pd4ml.setPageInsets(new Insets(20, 10, 10, 10));
    if ( fontsDir != null && fontsDir.length() > 0 ) {
    pd4ml.useTTF( fontsDir, true );
    PD4PageMark header = new PD4PageMark();
    header.setAreaHeight( 20 );
    pd4ml.setPageHeader( header );
    pd4ml.render(“file:” + inputHTMLFileName, fos);

    private String populateHTMLHeaderFields()
    StringBuffer str = new StringBuffer();


    str.append(“Name: John Doe”);
    str.append(“DOCUMENT PRINT TEST”);


    return str.toString();
    Am I using setHtmlTemplate() incorrectly?

    thank you for your help.



    setHtmlTemplate() works in the trial versions. But it is a feature of PD4ML Pro, so first make sure you use Pro version of the software.

    The simpliest way to check that is to run PD4ML in GUI mode and to open About dialog:

    [language=java:3j8ekjgx]java -jar pd4ml_demo.jar[/language:3j8ekjgx]
    Also try to set header.setAreaHeight( -1 ); to autocompute the header height. You use 20pt height, which may be too low for the header table (only table margins fit the space; the content is clipped)


    Thank you for your help. I will try your suggestions!

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘General questions / FAQ’ is closed to new topics and replies.