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/02/28 17:29:18 UTC

[jira] [Resolved] (PDFBOX-3253) Close all COSStreams when creating a new pdf

     [ https://issues.apache.org/jira/browse/PDFBOX-3253?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler resolved PDFBOX-3253.
----------------------------------------
    Resolution: Fixed

I've extended COSDocument so that all COSStreams are collected which are created when creating a new pdf so that they can be closed when closing the COSDocument. COSStreams which are created when loading an existing pdf are already collected within objectPool and closed as well when closing COSDocument.

> Close all COSStreams when creating a new pdf
> --------------------------------------------
>
>                 Key: PDFBOX-3253
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3253
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.0
>            Reporter: Andreas Lehmkühler
>            Assignee: Andreas Lehmkühler
>             Fix For: 2.0.0
>
>
> Peter Prusinowski posted on users@ that he got a lot of debug warnings about COSStreams which are not closed. He provided the following code to reproduce the effect:
> {code}
>     public static void generate() throws IOException {
>         PDDocument doc = new PDDocument();
>         try {
>             PDPage page = new PDPage();
>             doc.addPage(page);
>             PDPageContentStream content = new PDPageContentStream(doc, page);
>             BufferedImage bi = ImageIO.read(new File("/tmp/test.png"));
>             PDImageXObject img = LosslessFactory.createFromImage(doc, bi);
>             content.drawImage(img, 0, 0);
>             content.close();
>         } finally {
>             if (doc != null) {
>                 doc.save("/tmp/testPdf.pdf");
>                 doc.close();
>             }
>         }
>     }
>     public static void main(String[] args) throws IOException {
>         generate();
>         generate();
>         generate();
>     }
> {code}
> I've got the same warnings using that specific code.



--
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