PDFBOX printing of document with bufferedimage fails

做~自己de王妃 提交于 2019-12-24 01:01:58

问题


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.

来源:https://stackoverflow.com/questions/32771489/pdfbox-printing-of-document-with-bufferedimage-fails

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!