PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) General questions / FAQ pd4ml.useTTF() create (but not delete) temporary files

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26915

    My version: version: PD4ML 385fx4 Pro (eval)

    my code (based on examples):
    <br /> test(){<br /> String htmlDocument = "";<br /> PD4ML pd4ml = new PD4ML();<br /> pd4ml.enableDebugInfo();<br /> pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.A4));<br /> pd4ml.setPageInsets(new Insets(20, 20, 20, 20));<br /> pd4ml.setHtmlWidth(1200);<br /> pd4ml.disableHyperlinks();<br /> pd4ml.useTTF("java:fonts", true);<br /> pd4ml.setDefaultTTFs("Times New Roman", "Arial", "Courier New");<br /> ByteArrayOutputStream baos = new ByteArrayOutputStream();<br /> pd4ml.render(new StringReader(htmlDocument), baos);<br /> baos.close();<br /> }

    After this code done I have 1 new file in my …/temp directory. Function pd4ml.render(…) create it, but not delete. Also I can’t delete it while JVM running.

    But if I don’t use pd4ml.useTTF(…) temporary file didn’t appear.

    How can I clear this file from code?

    #29521

    I can confirm this problem as well.
    PD4ML generates a lot of temporary files (+~JF*.tmp) because of fonts and there isn’t a cleanup procedure. They just stay in the temp folder.

    #29522

    The temp files are implicitly created by JVM after each createFont(int, InputStream) call. After a font object is garbage collected, for some strange reason JVM does not delete its temp file. They are collectively deleted after JVM quits, but some of them are forgotten and remain in the temp directory until the host OS cleans up. We have found no way to force JVM to cleanup font temp files.

    The recent PD4ML versions try to workaround the issue by a copying of needed font files to TEMP dir and pointing to them with createFont(int, File) API call. In the case JVM does not create extra .TMP files by its own.

    Which PD4ML version do you use?

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

The forum ‘General questions / FAQ’ is closed to new topics and replies.