Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #26842

    We’re evaluating using PD4ML to go from HTML to PDF for a thermal receipt printer application. Everything seems to be working fine except that we’d like the page height to be automatically set based on the content/body in the source HTML. If we force a longer page break (eg. java -Xmx512m -Djava.awt.headless=true -cp ./pd4ml_demo.jar Pd4Cmd ‘file:./testprintutf8.html’ 200 200×750 -ttf . -insets 0,0,0,0,pt -out testprintutf8.rtf) we get a whole bunch of wasted paper feed at the end of each “page”. How can we get the page height to be set automatically based on the source HTML content?

    Thanks.

    BJ Weschke

    #29334

    Would it be possible to publish testprintutf8.html and testprintutf8.pdf here?

    #29335

    Files are attached as requested.

    [attachment=0:atysg6uz]testprintutf8.zip[/attachment:atysg6uz]

    PDF was produced with:

    java -Xmx512m -Djava.awt.headless=true -cp ./pd4ml.jar Pd4Cmd ‘file:./testprintutf8.html’ 200 200×750 -ttf . -insets 0,0,0,0,pt -out testprintutf8.pdf

    #29336

    In order to predict a document height for particular conversion conditions, you may perform a fake conversion run and collect the conversion statistics:
    http://pd4ml.com/cookbook/pd4ml_conversion_status.htm
    You are interested in PD4Constants.PD4ML_DOCUMENT_HEIGHT_PX value. After the HTML doc height is known, you may adjust PDF page height proportionally.

    Also it is important to distinguish document dimensions in typographic points (“200×750” in your command line) and HTML document height and width, measured in screen pixels.

    The following tries to explain the px/pt mapping and scaling:
    http://pd4ml.com/cookbook/pdf_page_formatting.htm

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

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