Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #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?


    BJ Weschke


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


    Files are attached as requested.


    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


    In order to predict a document height for particular conversion conditions, you may perform a fake conversion run and collect the conversion statistics:
    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:

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

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