PDFBOX printing of document with bufferedimage fai

2019-07-08 20:10发布

问题:

Obviously, none of this is blurred irl...

I start out with a blank document which you see below here:

I have a user give me an account number and the form gets populated. A window pops up and gets a signature. It creates the document you see here:


I can save this document and pull it up in adobe and it is formatted and I can see the signature, can print it out, yadda yadda. However, if I attempt to print it from my application I get this:

For comparison, here is the code I use to save it:

contentStream.close(); // type PDPageContentStream containing a page of the overlayDoc
mergedDoc = overlayObj.overlay(overlayDoc, originalDoc); // overlayObj is of type Overlay. Docs are of type PDDocument
mergedDoc.save(someFileName);

And this is the code I am attempting to use to print it:

contentStream.close(); // same as above
mergedDoc = overlayObj.overlay(overlayDoc, originalDoc); // same as above
PrinterJob printJob = PrinterJob.getPrinterJob(); // java.awt.print.PrinterJob
mergedDoc.print(printJob);

My understanding is that the print method of a PDDocument takes a PrinterJob object and prints to that. A document is being printed, but it doesn't have the signature field correct. It's just a black box. I have also tried to save this as an image, which it does, but when I attempt to print the image I get the same issue.

Again, I can open this saved file and it does not have the box. When I am viewing it on the screen it doesn't have that black box. It is only there when I attempt to print it. Everything else works out correctly.

Any guesses where I should start? I've worked on this one for the better part of a day w/o success.

标签: java pdfbox