-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page.ByReference and Page.ByIndex change the behaviour of Flatten and Render #199
Comments
Hi, it's best to not mix the two different options in the same process, as they will both reference a different instance of the page object. I personally have never used More things you might want to check:
I see that the unit tests for |
Hi, thank you for your quick response! I initially tried avoiding mixing the two different options, but I could only get the desired result by doing so. I tried what you suggested and saved the PDF as a new file (FPDF_SaveAsCopy):
For now I found a solution that seems a little odd, but works. |
So basically you're saying that flatting with |
Sorry for the missunderstanding. I did everything on the original document. I only used FPDF_SaveAsCopy to save a copy of the PDF to disk after flattening to be able to visually ensure that the PDF got flattened (with or without migrations). I only used FPDF_SaveAsCopy, because I didn't find another way to save a go-pdfium document to disk. So I did everything as mentioned as in my original comment. For me it only works, if I flatten with ByReference and render with ByIndex. |
That's odd indeed, almost sounds like you need to re-open the page to make the flattening have effect. Will do some tests soon. Note: all the tests inside pdfium itself only test flattening and then saving the document and comparing the result, it never does anything directly with the page after flattening. So you might want to do |
I have a pdf with annotations and form fields that I want to render to Images.
To render both, annotations and form fields, I need to flatten the page first and then render it (without flattening I only get annotations). Therefor I use FPDFPage_Flatten and RenderPageInDPI:
If I change the Page to ByIndex instead of ByReference in FPDFPage_Flatten, neither annotations nor form fields are rendered:
If I change the Page to ByReference instead of ByIndex in RenderPageInDPI, also neither annotations nor form fields are rendered:
The text was updated successfully, but these errors were encountered: