You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Evgeniy Muravitskiy (JIRA)" <ji...@apache.org> on 2015/09/25 11:26:04 UTC
[jira] [Issue Comment Deleted] (PDFBOX-2981) Not correct support of
incremental save
[ https://issues.apache.org/jira/browse/PDFBOX-2981?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Evgeniy Muravitskiy updated PDFBOX-2981:
----------------------------------------
Comment: was deleted
(was: If you will use this patch can you change method PDDocument.prepareIncrement(COSDocument) from:
{code}
...
COSBase object = cosDoc.getObjectFromPool(cosObjectKey).getObject();
if (object != null && cosObjectKey!= null && !(object instanceof COSNumber))
{
objectKeys.put(object, cosObjectKey);
keyObject.put(cosObjectKey,object);
}
...
{code}
to:
{code}
COSObject objectFromPool = cosDoc.getObjectFromPool(cosObjectKey);
COSBase object = objectFromPool.getObject();
if (object != null && cosObjectKey!= null && !(object instanceof COSNumber))
{
if (!incrementalUpdate || objectFromPool.isNeedToBeUpdated() ||
(object instanceof COSDictionary && ((COSDictionary) object).isNeedToBeUpdated()))
{
objectKeys.put(object, cosObjectKey);
keyObject.put(cosObjectKey, object);
}
}
{code}
)
> Not correct support of incremental save
> ---------------------------------------
>
> Key: PDFBOX-2981
> URL: https://issues.apache.org/jira/browse/PDFBOX-2981
> Project: PDFBox
> Issue Type: Bug
> Components: Writing
> Affects Versions: 2.0.0
> Reporter: Evgeniy Muravitskiy
> Attachments: Incremental_save_fix.patch
>
>
> When write code like follows:
> {code}
> try {
> PDDocument document = PDDocument.load(new File(SOURCE_PATH));
> // SOME_OBJECT is not object number of catalog, info dictionary or encrypt
> COSObjectKey key = new COSObjectKey(SOME_OBJECT, 0);
> COSObject objectFromPool = document.getDocument().getObjectFromPool(key);
> COSDictionary object = (COSDictionary) objectFromPool.getObject();
> object.setItem(COSName.getPDFName("Test"), COSBoolean.TRUE);
> object.setNeedToBeUpdated(true);
> OutputStream writer = new BufferedOutputStream(new FileOutputStream(OUTPUT_PATH));
> document.saveIncremental(writer);
> writer.close();
> document.close();
> } catch (IOException e) {
> e.printStackTrace();
> }
> {code}
> in result file I`ve got nothing. It`s related with next problem: when we use {{PDDocument.save(OutputStream)}} - {{OutputStream}} is real output stream (for example, {{FileOutputStream}} or {{BufferedOutputStream}}), but incremental save use {{ByteArrayOutputStream}} which not store data in some file and only keep it in memory. Also when save is incremental data from source file is not send to result file.
--
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