Forum Replies Created

Viewing 15 posts - 3,016 through 3,030 (of 4,246 total)
  • Author
    Posts
  • in reply to: Troubleshooting
    #27048

    Hi,

    With a long html page filled with photos, we get OutOfMemory. Raising the memory limit is not an option, it already very high, 8-12 GB. This is a server and we’re using the Java API.

    We need a way to let PD4ML render pages an images in a streaming fashion, more memory efficient. It cannot keep the entire rendered PDF, with all hi-res images, in memory.

    How can achieve this?

    <br /> private static PD4ML createPD4ML(int htmlWidth, Insets insetsMM, boolean landscape) throws FileNotFoundException {<br /> PD4ML pd4ml = new PD4ML();<br /> pd4ml.setPageInsetsMM(insetsMM);<br /> pd4ml.setHtmlWidth(htmlWidth);<br /> pd4ml.setPageSize(landscape ? pd4ml.changePageOrientation(PD4Constants.A4) : PD4Constants.A4);<br /> pd4ml.enableSmartTableBreaks(true);<br /> if (log.isDebugEnabled()) {<br /> pd4ml.enableDebugInfo();<br /> }<br /> pd4ml.useTTF("java:net/pingpong/tm/fonts", true);<br /> return pd4ml;<br /> }<br /> <br /> private static void createPDF(Person person, User user, Course course, HtmlResource htmlResource, File tmpPdf)<br /> throws FileNotFoundException, IOException {<br /> OutputStream outputStream = new FileOutputStream(tmpPdf);<br /> String html = resolvePathsAndFixHtml(person, user, htmlResource, course, true);<br /> try {<br /> DocumentManagerHandler.writePDFWithHeader(html, outputStream);<br />

    and in DocumentManagerHandler

    <br /> public static void writePDFWithHeader(String html, OutputStream outputStream) throws InvalidParameterException,<br /> IOException {<br /> PD4ML pd4ml = createPD4ML(DEFAULT_HTML_WIDTH, DEFAULT_INSETS_MM, false);<br /> pd4ml.setHtmlWidth(640);<br /> <br /> PD4PageMark header = new PD4PageMark();<br /> header.setTitleAlignment(PD4PageMark.RIGHT_ALIGN);<br /> header.setFont(new Font("sansserif", Font.PLAIN, 11));<br /> header.setAreaHeight(25);<br /> header.setTitleTemplate("${title}");<br /> pd4ml.setPageHeader(header);<br /> <br /> pd4ml.render(new StringReader(html), outputStream);<br /> }<br /> <br /> <br />

    in reply to: Troubleshooting
    #27049

    We’re having an issue in a deployed environment that we cannot debug. The issue is that a page is being rendered blank and we’re trying to figure out why. The application were having trouble with is a WCF Windows service with a reference to a registered PD4ML, version 385 for .NET 2.0 (pd4ml.prof.dotnet20.385). We’ve turned on PD4ML.enableDebugInfo() and from what we understand, it writes to the console when it logs, so we’ve tried hooking into it using the code below, but no logs are showing. We’ve also checked the event viewer, but nothing is written there either. We have, however, been successful with debugging locally using a console application.

    Could someone please help us understand where we can find the debug information in a deployed environment for a Windows service?

    <br /> Console.SetError(New System.IO.StreamWriter("C:ConsoleErrorOutput.txt"))<br /> Console.SetOut(New System.IO.StreamWriter("C:ConsoleOutput.txt"))<br />

    in reply to: Issue with registered sign on bookmark
    #29834

    Please let us know the update on this issue, we have a licence and not getting any response for the issue

    in reply to: Floating Table Border Issue
    #29807

    For anyone experiencing this same issue, I wanted let you know that a fix was implemented in the most recent release – 385. Also, I’ve attached a sample PDF to show what was happening.

    in reply to: Issue with registered sign on bookmark
    #29835

    pd4ml.useTTF(“java:defaultfonts”, true) would take effect only in a case, if your application includes a JAR with TTF font files placed defaultfonts/ folder of the JAR.

    Try to do the following:
    1. Upgrade to v398fx1 and test. If it does not resolve the issue, proceed to #2

    2. Try to generate a font mapping file for the standard OS fonts: http://pd4ml.com/cookbook/pd4ml_pdf_true_type_fonts.htm
    i.e.
    java -jar pd4ml.jar -configure.fonts c:/windows/fonts c:/work/
    In the case useTTF() API call should look like that:
    pd4ml.useTTF( “c:/work/”, true );
    Test it.

    3. If the above helped, create a JAR file with chosen fonts, as described by the link above

    in reply to: Debugging PD4ML in a .NET Windows Service
    #29839

    I’ve forwarded the question to our .NET team. I’ll let you know as soon as we have new info.

    in reply to: Debugging PD4ML in a .NET Windows Service
    #29840

    @PD4ML wrote:

    I’ve forwarded the question to our .NET team. I’ll let you know as soon as we have new info.

    Much appreciated! However, we figured out it out. See below.

    1. In the OnStart function of Windows Service Host class, add the following code:
    <br /> Console.SetError(New System.IO.StreamWriter("[filename]")<br />

    2. Then in the OnStop function, add the following code:
    <br /> Console.Error.Close()<br />

    I’m sure there are other ways to do this such as creating your own custom System.Diagnostics listener, but this way works too. One thing to note is that you will need to stop the service in order to see the logs that were written.

    in reply to: pdf to png
    #27876

    PD4ML is PDF-producing library. In order to convert PDF to PNG, you would need a library, which can render PDF. Here is some discussion about:

    http://stackoverflow.com/questions/4437910/java-pdf-viewer

    in reply to: pd4ml:include not working as an alternative of $[page], $[to
    #29833

    The issue has been fixed in DEV build. The fix will be available with v398fx2 in about two weeks. Contact support pd4ml com if the issue is critical and you need an interrim fixed version sooner.

    in reply to: Debugging PD4ML in a .NET Windows Service
    #29841

    Thank you for sharing the info!

    WCF supports a number of service initialization methods: http://blogs.msdn.com/b/wenlong/archive/2006/01/11/511514.aspx

    A straightforward way would be to redirect the console by WCF service start in AppInitialize() (and instantly test it with Console.Error.WriteLine() if needed)

    Note: if AutoFlush is not disabled, you may see the first log output only after an output buffer is full.

    in reply to: ByteArray loading of PD4ML
    #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]

    in reply to: How to add inline footer to last page only?
    #29824

    PD4ML API/custom tags allow to define a scope for page header/footer. For example: scope=”1,2″, scope=”2+”, scope=”even”, scope=”skiplast”.

    scope=”last” support is problematic to implement. In an extreme case the last page may have no space to place a footer: it should force a page break and the trailing footer goes to new page with no content, which is undesired.

    In order to prevent it you may use a conditional page break to move some content (to make the last page not totally blank) and a footnote.

    Example:

    [language=html:1frmi1j1]….
    ….
    text text text …

    the last text section…
    ….
    ….
    totals section[/language:1frmi1j1]

    The page break will take effect only if the remaining vertical page space is less than 200px (and the last text section + footnote do not presumably fit it)

    ifSpaceBelowLessThan parameter value for your document structure/layout needs to be found an empiric way.

    in reply to: Creating a custom resource loader for https only?
    #29795

    In general PD4ML should work correctly with HTTPS resources by default without custom resource loaders.

    The only exceptions are Weblogic and WebSphere, which implement proprietary SSL layers, not derived from the standard Java classes (and cause ClassCastException)

    in reply to: Troubleshooting
    #26912

    We are having an issue where the URL we are using is not the same as we provided, which is causing issues during renditioning. The URL contains reserved special characters within a query string value that have been URL encoded and it appears that PD4ML is decoding the URL when it attempts to retrieve the HTML. Is there a way to prevent the URL from being decoded? This seems like odd behavior considering it is best practice to use an encoded values in a URL when using reserved special characters.

    Here is the encoded and decoded URL:
    http://localhost/Somepage?key1=1B%2BTI8O2dDe%2BW1buq%2F0%2BAQ%3D%3D&key2=Testing

    http://localhost/Somepage?key1=1B+TI8O2dDe+W1buq/0+AQ==&key2=Testing

    in reply to: URL Encoding Issue
    #29507

    @277opersuser wrote:

    We are having an issue where the URL we are using is not the same as we provided, which is causing issues during renditioning. The URL contains reserved special characters within a query string value that have been URL encoded and it appears that PD4ML is decoding the URL when it attempts to retrieve the HTML. Is there a way to prevent the URL from being decoded? This seems like odd behavior considering it is best practice to use an encoded values in a URL when using reserved special characters.

    Here is the encoded and decoded URL:
    http://localhost/Somepage?key1=1B%2BTI8O2dDe%2BW1buq%2F0%2BAQ%3D%3D&key2=Testing

    http://localhost/Somepage?key1=1B+TI8O2dDe+W1buq/0+AQ==&key2=Testing

    Also, we are using version 385 for .NET 2.0.

Viewing 15 posts - 3,016 through 3,030 (of 4,246 total)