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: Flattening (?) Problem 2.0.5->2.0.11
Date Thu, 31 Jan 2019 05:17:19 GMT
Hi,
The current version is 2.0.13. Did you try with that one? Also try with 
a 2.0.14 snapshot
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/2.0.14-SNAPSHOT/

and please share the source file, and modify the code so that the fifth 
parameter of

PDPageContentStream() is true.

Consider printing from PDFBox itself.

Tilman

Am 31.01.2019 um 02:52 schrieb Aaron Mulder:
> I have a PDF workflow where I take a base document with forms, then
> append a footer that puts values in the form fields and save the
> result, then open it with PDFBox and flatten it:
>
> doc = PDDocument.load(tempFile);
> doc.getDocumentCatalog().getAcroForm().flatten();
>
> Then I add an image to the page and save and close the doc:
>
> PDPage page = doc.getPage(0);
> PDImageXObject image = LosslessFactory.createFromImage(doc,
> toBufferedImage(generateBarcode("PC"+pcId)));
> PDPageContentStream contentStream = new PDPageContentStream(doc, page,
> PDPageContentStream.AppendMode.APPEND, true);
> contentStream.drawImage(image, 246, 36 );
> contentStream.close();
> doc.save(tempFile);
> doc.close();
>
> Finally, I print it from the command line.  With PDFBox 2.0.5 the
> resulting document prints fine.  I'm using this command on macOS:
>
> /usr/bin/lpr -P TestPrinter -o InputSlot=Tray2 file.pdf
>
> With PDFBox 2.0.11 when I do the same, the form fields all come
> through as empty on the printout.  (They do appear when I open the doc
> in Preview.)
>
> I don't really know why; I just tried updating to the latest on a
> lark.  It feels like the flattening failed on 2.0.11.  The printer is
> a bit dated and I think I went with flattening in the first place
> because that was the only way to get the doc to print correctly from
> the command line.
>
> I will stick with 2.0.5 for now because for this case it's critical
> that the printouts work.  :)
>
> Thanks,
>        Aaron
>
> Output from 2.0.5: http://opentools.org/files/print-job-2514255277731407198.pdf
> Output from 2.0.11: http://opentools.org/files/print-job-4933385101348305078.pdf
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


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


Mime
View raw message