Forum Replies Created

Viewing 15 posts - 376 through 390 (of 1,410 total)
  • Author
    Posts
  • in reply to: How to get Number of pages in a pdf file
    #29537

    If you know a number of pages of the existent PDF, you may add it as a correction to the final $[total] value with header.setInitialPageNumber():

    PD4PageMark header = new PD4PageMark();
    header.setInitialPageNumber(10);
    header.setAreaHeight( -1 ); // autocompute
    header.setHtmlTemplate( "$[total]<hr>" );
    pd4ml.setPageHeader( header );

    If a number of pages is not known for a particular case, you would need to count it with a third-party tool. Currently PD4ML Web implements the needed PDF page count functionality ( https://pd4ml.com/pd4ml_web.htm ), but the API is not exposed and documented yet.

    We plan to include the new PDF manipulation module (PDF analyze, merge etc) to the main branch of PD4ML with a forthcoming release.

    #29534

    In the current implementation of PD4ML’s HTML renderer tags are interpreted as text style modifiers. You may apply a style to them by classname or ID directly, but they do not appear in a document DOM-like structure. That makes complex CSS selectors (which rely on spans) to fail.

    The issue is going to addressed in the forthcoming versions. For the time being you may workaround the issue if you change tags to <div> (if possible)

    in reply to: Disable Attachments
    #29536

    There is a probability you use PD4ML version, which does not support the feature yet. Could you please check generated PDF file properties: it should list PD4ML version used. Or alternatively send a problem PDF sample to support pd4ml com

    in reply to: Is it possible to set header/footer scope via the API?
    #27840

    For HTML headers footer.setAreaHeight(-1) forces to allocate footer (or header) space, depending on an actual header height. The auto-computed height cannot change from page to page.

    By inline header/footer definition (like <pd4ml:page.header>) it can auto-compute header/footer height as well as change the allocated header space if header definition changes from page to page.

    If you do need an exact numeric height (in pixels) of a particular portion of HTML content, you may instantiate PD4ML, perform a dummy conversion of HTML portion to PDF and request the document height:

    https://pd4ml.com/cookbook/pd4ml_conversion_status.htm

    in reply to: Issue with TTF embedding.
    #29529

    Did you try the most recent (trial) version 390b2 of PD4ML Pro?

    Hopefully the issue of v350, you faced with, has been already solved in recent releases.

    in reply to: Render html entities like Spanish &ntilde;
    #29520

    by default PD4ML supports only basic fonts Arial, Times New Roman and Courier (and only Latin-1 charset). In order display national scripts or other fonts of your choice you would need to configure and utilize so-called TTF embedding. See:

    https://pd4ml.com/reference.htm#7.1
    pd4ml-html-css-pdf-tips-tricks-f7/ttf-embedding-t42.html
    https://pd4ml.com/cookbook/pd4ml_pdf_true_type_fonts.htm

    in reply to: Dynamic scope for footers
    #29524

    PD4ML allows to define page-specific headers/footers (scope attribute of ):
    – based on a page number,
    – depending if a page even or odd,
    – and allows to suppress header/footer for the last page.

    It is not possible to define a scope like “$[total]-3” etc.

    On the other hand it is possible to define content-flow specific headers/footers.

    For example:

    ...
    HTML content
    ...
    
    New page footer, impacts pages follow the next page break. $[page] of $[total]
    
    
    New page with the new page footer, defined above
    ...
    HTML content
    ...

    in reply to: Resizing content on web page results in extra white space
    #29525

    I am not sure, if I understand you correctly.

    PD4ML implements its own HTML/CSS rendering engine. The engine starts page layouting only after all resources (images, stylesheets etc) are completely loaded. So it is not possible, that page layout changes itself in 1-2 seconds.

    So I am afraid, if a PDF conversion result does not match its original HTML page layout, there are probably other reasons (failed CSS parsing, unsupported HTML tags etc). An HTML/CSS samples would help to analyze the problem reason.

    The above is relevant for the original PD4ML library. There is also PD4ML Web (based on WebKit native HTML renderer) – the version may suffer from network/rendering asynchrony or delays.

    in reply to: No such file: /cssparser-0.9.4.patched.2007.zip
    #29523

    The broken link is fixed now

    in reply to: Convert html source to pdf
    #29519

    Make sure you use PD4ML Pro. PD4ML Std does not support TTF embedding/national scripts.

    in reply to: Convert html source to pdf
    #29516

    First you would need to index the fonts in /Windows/Fonts (to generate pd4fonts.properties). See https://pd4ml.com/cookbook/pd4ml_pdf_true_type_fonts.htm

    A quick solution would be to place fonts.jar (i.e. from https://pd4ml.com/i/easyfonts/fonts.jar ) to WEB-INF/lib of your web app (or to a shared lib of your desktop application) and to refer to it with:

    pd4ml.useTTF("java:fonts", true);

    in reply to: Convert html source to pdf
    #29513

    Yes, the code
    pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.A4));
    forces landscape.

    For portrait use
    pd4ml.setPageSize(PD4Constants.A4);

    Also you may change the orientation for particular pages with a dedicated parameter of <pd4ml:page.break>

    in reply to: Convert html source to pdf
    #29510

    A trial library has no such limitations.

    probably there are closing </body> and </html> tags somewhere in the middle of document. The tags implicitly stop further document parsing.

    in reply to: Convert html source to pdf
    #29508

    There is an API method

    pd4ml.render(StringReader[] isrs, OutputStream os, URL base)

    which is more-less what you need.

    Alternatively I would recommend to merge the string array into a single string, delimited by <pd4ml:page.break> tags, and to pass it to render() method as a StringReader.

    in reply to: Possible memory leak in finalizers
    #29494

    PD4ML caches objects using soft references in a static hash table. As soon as there is a shortage of RAM, JVM must automatically release such objects and deallocate consumed RAM. If there is no allocation requests, it is up to JVM either to keep the objects cached or garbage-collect them.

    There is an API call pd4ml.clearCache() forces to clean cache (and consumed RAM). The JVM setting -Dpd4ml.cache.enable=false disables caching at all.

    After a particular image is loaded by PD4ML it is also instantiated as Imager object. If AWT also caches images of not – depends on a particular JVM implementation.

    As for me it is suspicious, that the data is accumulated somewhere in the internals sun.awt.image.ToolkitImage.

Viewing 15 posts - 376 through 390 (of 1,410 total)