Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #27046

    Hi, We have the following workflow for generating and storing the PDF

    1. create PDF
    2. Load ByteArray and store it as BLOB in database.
    3. User comes to website and tries to access PDF.
    4. PDF sent in response stream.

    We are facing a weird issue where the file created from PD4ML when opened with Adobe loads the PDF perfectly fine. But if we store the file as byte[] in database and try accessing it from database the PDF loads but none of the images gets displayed in PDF.

    Styling is present, only the images are missing.

    <br /> ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);<br /> PD4ML pd4ml = new PD4ML();<br /> pd4ml.interpolateImages(true);<br /> pd4ml.enableDebugInfo();<br /> pd4ml.setHtmlWidth(850);<br /> pd4ml.addStyle("BODY {margin: 0}", true);<br /> pd4ml.setPageInsets(new Insets(0, 0, 0, 0));<br /> pd4ml.fitPageVertically();<br /> pd4ml.overrideDocumentEncoding("UTF-8");<br /> <br /> pd4ml.setPermissions("empty", PD4Constants.AllowPrint, true);<br /> pd4ml.setPermissions("empty", PD4Constants.AllowModify, false);<br /> pd4ml.setPermissions("empty", PD4Constants.AllowCopy, true);<br /> <br /> pd4ml.render(new StringReader(htmlCode), baos);<br /> byte[] bytes = baos.toByteArray();<br /> ############<br /> # Store bytes in DB<br /> ############<br /> <br /> <br /> <br /> ############<br /> # Servlet<br /> ############<br /> response.getOutputStream().write(byte[]/* from database.*/);<br /> response.setContentType("application/octet-stream");<br /> response.setHeader("Content-Disposition","attachment;filename=file.pdf");<br />

    #29836

    Could you please send a corrupted PDF sample to support pd4ml com?

    Also:

    1. In the section only the last setPermissions() call takes effect:

    [language=java:2fhuhcrq]pd4ml.setPermissions(“empty”, PD4Constants.AllowPrint, true);
    pd4ml.setPermissions(“empty”, PD4Constants.AllowModify, false);
    pd4ml.setPermissions(“empty”, PD4Constants.AllowCopy, true);[/language:2fhuhcrq]

    Correct API call:
    [language=java:2fhuhcrq]pd4ml.setPermissions(“empty”, PD4Constants.AllowPrint |
    PD4Constants.AllowModify | PD4Constants.AllowCopy, true);[/language:2fhuhcrq]

    2. Right MIME type for PDF is

    [language=java:2fhuhcrq]response.setContentType(“application/pdf”);[/language:2fhuhcrq]

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

The forum ‘Deployment / Configuration issues’ is closed to new topics and replies.