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

[jira] [Updated] (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:all-tabpanel ]

Gregor Ambrozic updated PDFBOX-3272:
------------------------------------
    Description: 
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();}}



  was:
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();
}}




> 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