Issue 932 in pdfium: Filled forms are printed blank

720 views
Skip to first unread message

farhad.k… via monorail

unread,
Nov 7, 2017, 8:41:27 AM11/7/17
to pdfiu...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 932 by farhad.k...@gmail.com: Filled forms are printed blank
https://bugs.chromium.org/p/pdfium/issues/detail?id=932

When I try to print the attached filled form, I only get the blank form. I have traced the problem to this code fragment in fpdfview.cpp:

if (flags & FPDF_ANNOT) {
pContext->m_pAnnots = pdfium::MakeUnique<CPDF_AnnotList>(pPage);
bool bPrinting = pContext->m_pDevice->GetDeviceClass() != FXDC_DISPLAY;
pContext->m_pAnnots->DisplayAnnots(pPage, pContext->m_pContext.get(),
bPrinting, &matrix, false, nullptr);
}

This code excludes widget annotations from rendering. If I change the last line to

bPrinting, &matrix, true, nullptr);

then the printed page does contain form data and the normal display doesn't seem to be affected (so far as I can tell).

I also tried FPDFPage_Flatten(page, FLAT_PRINT) on the page before rendering to the printer device context, but could not get the form data to appear. I might be doing this wrong. Thanks.

Attachments:
cardclaimform_filled.pdf 106 KB

--
You received this message because:
1. The project was configured to send all issue notifications to this address

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

thes… via monorail

unread,
Nov 9, 2017, 3:27:08 PM11/9/17
to pdfiu...@googlegroups.com

Comment #1 on issue 932 by the...@chromium.org: Filled forms are printed blank
https://bugs.chromium.org/p/pdfium/issues/detail?id=932#c1

Attached is what I get with the Chrome PDF Viewer -> Print Preview -> Save as PDF with "Print as image" (available on Linux) turned on.

Visually, they are the same in the Chrome PDF Viewer, except the printed one has the forms flattened.

Attachments:
cardclaimform_filled_printed.pdf 82.9 KB

farhad.k… via monorail

unread,
Nov 16, 2017, 9:26:40 AM11/16/17
to pdfiu...@googlegroups.com

Comment #2 on issue 932 by farhad.k...@gmail.com: Filled forms are printed blank
https://bugs.chromium.org/p/pdfium/issues/detail?id=932#c2

I was able to solve my problem by creating a flattened copy of a document during print. Thanks.

shawnt… via monorail

unread,
Jan 29, 2018, 11:17:08 AM1/29/18
to pdfiu...@googlegroups.com

Comment #3 on issue 932 by shawnt...@gmail.com: Filled forms are printed blank
https://bugs.chromium.org/p/pdfium/issues/detail?id=932#c3

Hi Farhad,
I have a similar issue and try FPDFPage_Flatten(page, FLAT_PRINT) with your attached file still doesn't work. I am wondering how to create a flattened copy mentioned in your last post. Do you mean convert the PDF as an image? Basically what i am doing is:
FPDFPage_Flatten(page, FLAT_PRINT);
FPDF_RenderPage(dc, page, ..., FPDF_ANNOT | FPDF_PRINTING | FPDF_NO_CATCH);


By the way, changing annotations flag in fpdfview.cpp works for me and I build PDFium on Windows 10 with v8 and XFA enabled.

Best Regards,
Shawn

farhad.k… via monorail

unread,
Jan 29, 2018, 12:26:10 PM1/29/18
to pdfiu...@googlegroups.com

Comment #4 on issue 932 by farhad.k...@gmail.com: Filled forms are printed blank
https://bugs.chromium.org/p/pdfium/issues/detail?id=932#c4

Hi Shawn,

I have a vague recollection of this issue. Upon inspecting my code, I see that after a call to FPDFPage_Flatten, I unload the page and reload when rendering it to the printer device context. Not sure why I did this, but it seems to work for me.

I do not convert PDF pages to images for printing.

I feel that the change I suggested in fpdfview.cpp will fix this problem in a more proper way. I didn't use it as I wasn't comfortable with my understanding of the related source code.

I've attached my source file for your reference.

Regards,
Farhad


Attachments:
PrintDocument.cs 5.7 KB

shawnt… via monorail

unread,
Jan 29, 2018, 2:47:41 PM1/29/18
to pdfiu...@googlegroups.com

Comment #5 on issue 932 by shawnt...@gmail.com: Filled forms are printed blank
https://bugs.chromium.org/p/pdfium/issues/detail?id=932#c5

Hi Farhad,

Thanks for your reply and sample code. That is an interesting solution. But, I am using the C++ interface, and not sure what "page.Unload()" doing. Try next steps and still doesn't work, any idea?

FPDF_LoadPage(doc, index);
FPDFPage_Flatten(page, FLAT_PRINT);
FPDF_ClosePage(page);
FPDF_LoadPage(doc, index);

FPDF_RenderPage(dc, page, ..., FPDF_ANNOT | FPDF_PRINTING | FPDF_NO_CATCH);

Regards,
Shawn

n… via monorail

unread,
Sep 23, 2020, 6:37:55 PM9/23/20
to pdfiu...@googlegroups.com
Updates:
Status: WontFix

Comment #7 on issue 932 by ni...@chromium.org: Filled forms are printed blank
https://bugs.chromium.org/p/pdfium/issues/detail?id=932#c7

@reporter:
Tested printing with the chrome version 85.0.4183.108, the filled form can be printed with the filled information on (with/without "print as image" options checked).
Since I can't reproduce the issue and some of the comments are obsolete at the moment, I will close it as "WontFix". Please let us know if you have further concerns regarding this issue.
Thanks!
Reply all
Reply to author
Forward
0 new messages