bblanchon / pdfium-binaries

📰 Binary distribution of PDFium
789 stars 166 forks source link

FPDF_RenderPage print pdf #117

Closed pushtime-sky closed 3 weeks ago

pushtime-sky commented 9 months ago

I am useing the c++ interface by pdfium.dll(117.0.5880.0),but When I try to print the attached filled form,the some content of the filled form is blank code: FPDFPage_Flatten(pdfPage, FLAT_PRINT); FPDF_RenderPage(hdcPrinter, pdfPage, 0, 0, pageWidth, pageHeight, islandscape ? 1 : 0,flags); cardclaimform_filled_printed.pdf

bblanchon commented 9 months ago

Hi @pushtime-sky,

Usually, when parts are missing, it's because forms were not rendered. See FPDFDOC_InitFormFillEnvironment() and FPDF_FFLDraw().

Best regards, Benoit

mara004 commented 9 months ago

From the docs one would expect the OP's FPDFPage_Flatten() call to achieve the same, but last time I tested it seemed to take no visible effect, neither with rendering nor saving. There may be something wrong with this API? (Also, it's a pity there's not matrix rendering equivalent to FPDF_FFLDraw() ...)

pushtime-sky commented 9 months ago

Hi@mara004 I am also try the api FPDFPage_Flatten() But is not effect。

pushtime-sky commented 9 months ago

@bblanchon thank you! I'll try it

mara004 commented 9 months ago

From a quick search, I saw Bug 2055 in pdfium's issue tracker, where @kmoon-chromium mentions that FPDFPage_Flatten() requires that you reload the page afterwards. Also, it is stated that flattening does not play with XFA.

However, this does not fix the issue for my non-XFA test sample. It may be that flattening is buggy and only works with a subset of documents, see also https://crbug.com/861842