Forum Replies Created

Viewing 15 posts - 1,396 through 1,410 (of 1,410 total)
  • Author
    Posts
  • in reply to: Dynamic parameters
    #27385

    Yes, you are right. PD4ML does not substitute placeholders for headers/footers defined that way (however it works for inline headers and footers, i.e. <pd4ml:page.header>)

    It is quite a trivial task to replace the placeholders in someHTML before it passed to PD4ML. For example, with String.replaceAll() Java API call.

    If the workaround, for some reasons, is not acceptable by you, or if you want to keep the placeholder replacement mechanism of PDF generating module in your application consistent, we could add the feature to the forthcomming release.

    #27374

    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:

    java -jar pd4ml_demo.jar
    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)

    in reply to: Rendering images
    #27358

    I would suspect space characters in the image URLs.

    Try to replace them with “%20”

    in reply to: Rendering images
    #27356

    Image embedding is one of the major functions of PD4ML, which is available since the first version of the software. So normally for GIF, JPEG and PNG it should be no problems.

    A possible reason of the issue is image addressing: you need to make sure, that image URLs are either fully-specified (include protocol, server, port), or the URLs are relative to the actual document location (or to <base> setting of the doc). If the image URL is defined like

    “/WebAppName/path/to/image.gif”

    PD4ML requires, that you pass current servlet context to it with

    useServletContext(ServletContext ctx)

    otherwise PD4ML has no chance to resolve the virtual path. (PD4ML JSP Taglib triggers the method implicitly)

    If the above is not relevant for your particular case, please provide us with some more info:

    • PD4ML usage scenario: Java, JSP, PHP, etc…
    • A sample of image reference
    • PD4ML debug output for a case, when it cannot load an image ()you may switch the debug output on with pd4ml.enableDebugInfo() call
    in reply to: Images cannot be loaded
    #27352

    In that case PD4ML cannot resolve the web app context (request.getContextPath()) to anything “loadable” – to an absolute path or full URL.

    Try to pass servet context to PD4ML – it should help to load the dynamic resource:

    useServletContext(ServletContext ctx)

    in reply to: Disable the CSS and Images cache.
    #27348

    There is a couple of approaches to disable caching.

    1. Set an environment variable (add the following to JVM command line):
    -Dpd4ml.cache.enable=false

    ( the same from Java/JSP code if JVM security policy allows: System.setProperty("pd4ml.cache.enable","false") )

    or via PD4ML API call:

    HashMap map = new HashMap();
    map.put("pd4ml.cache.enable","false") ;
    pd4ml.setDynamicParams(map);

    2. Another method is to add a random suffix to CSS URL:

    (JSP sample)

    <%
    String suffix = "";
    if ( debug ) {
    suffix = "?dummy=" + generateRandom();
    }
    
    %>
    <link rel="stylesheet" type="text/css" href="xstyle.css" />

    in reply to: Images cannot be loaded
    #27350

    Obviously PD4ML has no info about URL base of the document and it cannot resolve the relative path to an absolute one.

    A possible reason – you render the HTML to PDF with

    render(java.io.StringReader isr, java.io.OutputStream os)
    and the document has no <base> tag.

    A solution is to use

    render(java.io.StringReader isr, java.io.OutputStream os, java.net.URL base)

    instead.

    If the explanation does not match your PD4ML usage scenario, please provide more info.

    in reply to: Gtk-WARNING: cannot open display:
    #27345

    Obviously you run PD4ML on Linux or UNIX platform.

    In the case make sure that -Djava.awt.headless=true JVM command-line parameter is set. The “headless” mode prevents Java from attempts to connect/use “display resources”. It is important for server environments: as a rule they do not assume any connected display hardware.

    in reply to: Browser error "File does not begin with ‘%PDF-‘"
    #27221

    JSP is text output oriented environment. PD4ML taglib outputs binary data, where file start markers and the document structure (PDF object offsets integrity) is very important.

    If there is some content before <pd4ml:transform> tag, the undesired content is sent directly to client’s browser, before <pd4ml:transform> outputs the binary PDF data starts with “%PDF-“.

    Another possible reason: PD4ML failed (let’s say ss_css2.jar library is missing) but “Content-type: application/pdf” HTTP header is already sent. Adobe Reader plugin launched and tries to interpret the received data, however actually the data is not PDF bytes, but Java exception stack trace text.

    In any case a good starting point of the problem analyze is to add enable=”false” attribute to <pd4ml:transform>, to make sure that HTML passed to PD4ML is correct.

    in reply to: NullPointerException in command line convert
    #27330

    It is a bug in v350 code and it seems the actual development build v351 fixes the problem. I’ve just sent it to you by email to test on your side.

    A temporal v350 workaroung for the problem is to absolutely position not the image, but its enclosing DIV:

    <div style="position:absolute;left:395pt;top:37pt">
    <img alt="Image from the forum topic: NullPointerException in command line convert" src="TSTB_images/img-gen6.png"/>
    </div>

    in reply to: Prevent images being scaled
    #27256

    Some more info about hi-res image printing:
    http://www.alistapart.com/articles/hiresprinting/

    Note: PD4ML ignores print CSS media type and respects only stylesheets defined for all, screen and proprietary pdf media types.

    in reply to: Right margin overflow
    #27252

    Could you please attach a minimalistic sample PDF to illustrate the problem.

    in reply to: Entities to PDF
    #27328

    PD4ML by default supports Latin-1 (ISO-8859-1) character set. Sigma symbol does not belong to it, so you need to use TTF embedding feature of PD4ML Pro.

    See pd4ml-html-css-pdf-tips-tricks-f7/ttf-embedding-t42.html

    #27324

    First I would suspect network delays by loading of referenced resources: images, CSS etc.

    Try to switch debug mode of PD4ML on

    pd4ml.enableDebugInfo()

    and analyze server’s console or log during the “16 minutes”. Does it make big pauses by resource load attempts?

    in reply to: Prevent images being scaled
    #27257

    As a rule images prepared for regular HTML documents have a resolution, which is not sufficient for print or for PDF. It is because print resolution typically ranges from 300dpi up to 1200dpi, while screen resolution is usually only 72dpi to 96dpi.

    PD4ML never resamples images, but embeds them “as is” (JPEGs and some species of PNG) or re-compress them non-lossy way to generic PDF image formar (GIFs and the rest of PNGs).

    A solution would be to use more detailed source images. For example:

    You’ll get better results if you add a hi-res image (let’s say 1000x1000px) to your doc with an image tag defines smaller dimensions Image from the forum topic: Prevent images being scaled100 width=100>. It will be embedded to PDF with the all detailization of the original 1000x1000px image (good zoomable / good printable), but shrinked to 100×100. That would allow you to keep the original HTML layout not broken by the huge 1000×1000 image.

    Also we would recommend you to use JPEG image format (probably with the highest image quality settings) for such big images. JPEGs are embedded “as is” and it keeps the resulting PDFs compact. For example, GIF needs to be recompressed, which makes the resulting PDF to grow.

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