You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Roman (JIRA)" <ji...@apache.org> on 2017/10/26 09:34:00 UTC

[jira] [Created] (PDFBOX-3980) Can' close source PDF file in PDDocument

Roman created PDFBOX-3980:
-----------------------------

             Summary: Can' close source PDF file in PDDocument
                 Key: PDFBOX-3980
                 URL: https://issues.apache.org/jira/browse/PDFBOX-3980
             Project: PDFBox
          Issue Type: Bug
            Reporter: Roman


PDDocument provides no way to closing its source pdf file (which is hold in private *pdfSource* property)

The only public *close* function (see below) for that closes all together, which makes PDDocument not suit for further text extraction. 

{code}
    public void close() throws IOException
    {
        if (!document.isClosed())
        {
            // close resources and COSWriter
            if (signingSupport != null)
            {
                signingSupport.close();
            }

            // close all intermediate I/O streams
            document.close();
            

            // close the source PDF stream, if we read from one
            if (pdfSource != null)
            {
                pdfSource.close();
            }
        }
    }
{code}

While we need this part to be extracted into separate public function:

{code}
            // close the source PDF stream, if we read from one
            if (pdfSource != null)
            {
                pdfSource.close();
            }
{code}

This would allow to store PDDocuments in cache, to be later used for text extraction, and, in the same time, it would not lock file on disk.




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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