You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2016/03/14 12:16:33 UTC

[jira] [Commented] (PDFBOX-3272) Loaded fonts file descriptors open after closing document

    [ https://issues.apache.org/jira/browse/PDFBOX-3272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15193113#comment-15193113 ] 

Andreas Lehmkühler commented on PDFBOX-3272:
--------------------------------------------

Do you close the created pdf after saving it?

> Loaded fonts file descriptors open after closing document
> ---------------------------------------------------------
>
>                 Key: PDFBOX-3272
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3272
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.0
>         Environment: Apache Tomcat, Linux
>            Reporter: Gregor Ambrozic
>
> I am experiencing problems with TTF fonts loaded for generating PDFs which eventually result in too many open files on Linux. The PDFBox version I tested last was 2.0.0-RC3.
> Basically for each PDF I create a document and load two fonts which I want to use. After the document is generated I close all the resources, but the file descriptors for both fonts remain open.
> The file descriptors should be automatically closed or an API should exist to close font resources.
> My basic code:
> doc = new PDDocument();
> page = new PDPage(PDRectangle.A4);
> doc.addPage(page);
> PDFont font = PDType0Font.load(doc, new File(settings.getProperty("font.location")));
> PDFont boldFont = PDType0Font.load(doc, new File(settings.getProperty("bold.font.location")));
> PDPageContentStream content = new PDPageContentStream(doc, page);
> // add content stuff
> content.close();
> bos = new ByteArrayOutputStream();
> doc.save(bos);
> bos.flush();



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org