pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Workaround for PDFBOX-2893
Date Fri, 18 Sep 2015 18:03:20 GMT
PDFBOX-2893 is mostly done, it was already set to resolved until I found 
a problem with merging, which has been solved. What remains are finding 
useful names, which John wanted to do.

So I'd suggest you open a new issue, and attach a minimal but 
fully-working test case.

Tilman

Am 18.09.2015 um 19:40 schrieb Vadim Bauer:
> Hello,
>
>
> we get this stacktrace when saving modified PDFs:
> Caused by: java.lang.IllegalStateException: Cannot read while there is 
> an open stream writer
> at 
> org.apache.pdfbox.cos.COSStream.createRawInputStream(COSStream.java:128)
> at 
> org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream(COSWriter.java:1138)
> at org.apache.pdfbox.cos.COSStream.accept(COSStream.java:369)
> at org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject(COSWriter.java:538)
> at org.apache.pdfbox.pdfwriter.COSWriter.doWriteBody(COSWriter.java:450)
> at 
> org.apache.pdfbox.pdfwriter.COSWriter.visitFromDocument(COSWriter.java:1039)
> at org.apache.pdfbox.cos.COSDocument.accept(COSDocument.java:445)
> at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1289)
> at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1190)
> at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1212)
>
> There is already an issue in jira but since july it is still WIP in 
> progress so we are looking for a workaround until the issue is fixed.
> https://issues.apache.org/jira/browse/PDFBOX-2893
>
> What we are actually doing is attaching a file to pdf and save it 
> under a new name.
>
> The error occurs in our case when we set the metadata:
> *private* *void* setMetadata(PDDocument doc, AppendParameter 
> appendParameter) *throws* IOException, TransformerException,
>          BadFieldValueException {
>       Calendar now = Calendar.getInstance();
>       PDDocumentCatalog catalog = doc.getDocumentCatalog();
>
>       PDMetadata metadata = *new* PDMetadata(doc);
> //catalog.setMetadata(metadata);
>
> *new* XmpSerializer().serialize(xmp, metadata.createOutputStream(), 
> *true*);
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message