Forum Replies Created

Viewing 15 posts - 256 through 270 (of 4,246 total)
  • Author
    Posts
  • in reply to: Append to an existing pdf?
    #27347

    The feature is in our implementation plan, but it is not implemented yet.

    I would recommend you to use the great free iText lib to merge existing PDFs and PD4ML output.

    in reply to: Font size wierdness
    #27534

    PD4ML renders entire HTML layout based on screen pixels dimensions. If any sizes are specified in physical units, it converts pt, mm, in values to screen pixels (assuming 72dpi resolution).

    After the layout is ready, it maps it to the choosen paper format. The HTML-to-PDF scale can be calculated like that: scale = (paperFormat.width – insets.left – insets.right)/htmlWidth.

    You’ve got two ways to fix the sizing problem you faced with:

    • increase htmlWidth conversion parameter value until the resulting font sizes come 12pt.
    • trigger pd4ml.protectPhysicalUnitDimensions() PD4ML API method. The approach has disadvantages: scale disproportion among elements, whose sizes specified with physical units and whose sizes specified in screen pixels.
    in reply to: Euro symbol
    #27457

    I confirm: works always. With hex/decimal character codes it works too if the code corresponds the current HTML document encoding.

    “?” instead of may be an issue for very old PD4ML versions.

    in reply to: [CSS Issue] Border-style : dashed.
    #27439

    We’ll try to fix the issue till v351 final release (expected in 2-3 weeks).

    in reply to: it isn’t able to print swf content embedded in html to pdf
    #27429

    You are right. PD4ML does not support Flash (SWF) objects rendering. The only way to include SWF to resulting PDFs is to embed it as a document attachment with tag.

    Unfortunately we know no any robust 100% Java implementation of SWF rendering component or SWF-to-image converter. If such component/library exists, it could be easily integrated to PD4ML via the custom resource loader interface.

    in reply to: <CENTER/> tags are not honored in 3.5.1b1
    #27417

    It was a bug in the recent version(s). V351b7 should fix it.

    in reply to: Limitation to 50 Pages
    #27545

    No, there is no such limitation hardcoded. Please contact support by email and provide some more details.

    in reply to: java.lang.StackOverflowError ( pd4ml )
    #27540

    THANK YOU so much !!!

    repeating unclosed tag was the real problem !!!

    Many many thanks !!

    in reply to: Transform tag in JSP dose not trnasform National text
    #27454

    I would avoid any loading of the fonts by HTTP.

    How do you address TTF fonts directory from your Java code or JSP?

    in reply to: can not load inline image attachment
    #27458

    How the image URL looks in the source HTML like?

    in reply to: generatePdfForms() doesn’t work
    #27349

    Obviously you use non-Pro version of PD4ML, where PDF form generation feature is disabled.

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

    Additional info: it seems GNU JDK 1.4.2 implementation does not respect
    -Djava.awt.headless=true setting and it makes PD4ML to fail.

    Possible solutions:

    • upgrade the JDK
    • change to Sun’s JDK
    • use xvfb daemon
    in reply to: PDF generation took longer time in multi threaded environmen
    #27325

    PD4ML does not reinvent the wheel – it uses the standard Java’s method to load resources:
    [language=java:3hnk51i1]URL src = new URL(resource);

    URLConnection urlConnect = src.openConnection();

    cm.setCookies( urlConnect );
    try {
    urlConnect.connect();
    } catch (Throwable e) {
    return new byte[0]; // requested resource is missing
    }
    cm.storeCookies( urlConnect );

    is = urlConnect.getInputStream();

    …[/language:3hnk51i1]

    So if any delays occur – they are most probably caused by network misconfiguration/problems, like invalid IP routing, wrong DNS responses, firewall restrictions. If network configuration is flawless, in a case of a missing resource the code should break at line #9 in a few milliseconds.

    You may always optimize the above code (or for example, implement a correct HTTPS loader for your particular platform) with a custom resource loader. See:
    pd4ml-html-css-pdf-tips-tricks-f7/a-definition-of-custom-resource-loaders-t40.html

    in reply to: example emb_utf.jsp is not running
    #27491

    I found the issue. I need to add the file: before the path of fonts directory.

    in reply to: How to render multiple Notes Documents to single PDF output?
    #27332

    I would implement the multi-doc converter this way (replace the correspondingreference agent http://pd4ml.com/i/PdfAgentR7.java methods with the following):

    [language=java:9u9s00sk]public void NotesMain() {
    try {
    Session session = getSession();
    AgentContext agentContext = session.getAgentContext();

    System.out.println(“AGENT start.”);

    Database db = agentContext.getCurrentDatabase();

    String xsl = null;

    if (readXslFromJar) {
    xsl = getXsl();
    } else {
    DocumentCollection dcx =
    db.search(“@Contains(Form; “” + xslDocumentFormName + “”)”);
    Document xsldoc = dcx.getFirstDocument();
    if (xsldoc != null) {
    xsl = xsldoc.getItemValueString(xslDocumentFieldName);
    } else {
    throw new IOException( “Can not find ” + xslName);
    }
    }

    // System.out.println(“XSL: ” + xsl);

    // collect selected documents
    DocumentCollection dc = agentContext.getUnprocessedDocuments();

    URL[] urls = new URL[dc.getCount()];
    int ind = 0;

    Document doc = dc.getFirstDocument();
    while (doc != null) {

    Document tmp = db.createDocument();
    RichTextItem rti = tmp.createRichTextItem(“PD4MLBody”);
    doc.renderToRTItem(rti);

    DxlExporter dxl = session.createDxlExporter();
    dxl.setConvertNotesBitmapsToGIF(true);
    dxl.setOutputDOCTYPE(false);
    String xml = dxl.exportDxl(tmp);

    String xml = getTestDxl();

    System.out.println(“DXL FORM: ” + xml);

    System.out.println(“TRANS: ” + System.getProperty(“java.version”));
    System.out.println(“TRANS: ” + System.getProperty(“java.vm.version”));
    System.out.println(“TRANS: ” + System.getProperty(“java.vm.vendor”));
    System.out.println(“TRANS: ” + System.getProperty(“java.vm.name”));

    long start = System.currentTimeMillis();

    String html = transformXML(xml, xsl);

    long middle = System.currentTimeMillis();
    System.out.println(“XSL transformation: ” + (middle-start) + “ms”);

    System.out.println(“HTML: ” + html);

    File htmlFile = File.createTempFile(“pd4dxl”, “.html”);
    java.io.FileOutputStream fos = new java.io.FileOutputStream( htmlFile );
    fos.write( html.getBytes() );

    urls[ind++] = htmlFile.toURL();

    doc = dc.getNextDocument();
    }

    File pdf = File.createTempFile(“pd4ml”, “.pdf”);
    java.io.FileOutputStream fos = new java.io.FileOutputStream(pdf);
    generatePDF( urls,
    fos,
    PD4Constants.A4,
    “java:/fonts”,
    DXL to PDF convesion result.” +
    ” $[page] of $[total]
    “);

    System.out.println(“PDF file ” + pdf.toURL() + ” is generated” );

    System.out.println(“AGENT done.”);

    } catch (SAXException e) {
    e.printStackTrace();
    } catch (Exception e) {
    e.printStackTrace();
    }
    }

    public static final void generatePDF(URL[] urls, OutputStream fos,
    Dimension format, String fontsDir, String footerBody)
    throws Exception {

    PD4ML pd4ml = new PD4ML();
    pd4ml.setPageInsets(new Insets(20, 10, 10, 10));
    pd4ml.setHtmlWidth(1000);
    pd4ml.setPageSize(format);

    if (fontsDir != null && fontsDir.length() > 0) {
    pd4ml.useTTF(fontsDir, true);
    }

    if (footerBody != null && footerBody.length() > 0) {
    PD4PageMark footer = new PD4PageMark();
    footer.setAreaHeight(-1);
    footer.setHtmlTemplate(footerBody);
    pd4ml.setPageFooter(footer);
    }

    pd4ml.render( urls, fos);
    fos.flush();
    fos.close();
    }[/language:9u9s00sk]

    The code is schematic and needs to be optimized.

    After the resulting PDF is stored/sent/etc, the TEMP directory needs to be cleaned up. So it makes sence to register object references, created by the calls

    File htmlFile = File.createTempFile(“pd4dxl”, “.html”);
    File pdf = File.createTempFile(“pd4ml”, “.pdf”);

    and to remove them later, close to the agent code end.

Viewing 15 posts - 256 through 270 (of 4,246 total)