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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to