-
Notifications
You must be signed in to change notification settings - Fork 22
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
PPF-706: PyPDFForm does not handle fields in forms rotated 90 degrees #706
Comments
Hey, sorry for a rather late response. As you can see from my commit history I have been quite busy recently with other stuffs and haven't spent much time developing this project. Anyway, this is not a scenario I have thought about when I initially designed |
Thank you! I will look into FormWrapper. Also, no apologies necessary.
Thank you for all that you do!
…On Mon, Aug 12, 2024, 9:30 AM Jinge Li ***@***.***> wrote:
Hey, sorry for a rather late response. As you can see from my commit
history I have been quite busy recently with other stuffs and haven't spent
much time developing this project.
Anyway, this is not a scenario I have thought about when I initially
designed PdfWrapper, so I will need sometime to look at how I can
implement this. In the meantime, I tried your snippet with FormWrapper (link
to docs <https://chinapandaman.github.io/PyPDFForm/simple_fill/>) and it
filled the form fine. So I'd say for a temp measure try using that instead.
It's a trim down version of the PdfWrapper but it still supports the two
basic filling and flattening functionalities.
—
Reply to this email directly, view it on GitHub
<#706 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BKLSJMUGOU6ER3XGBD7MTLDZRC2GRAVCNFSM6AAAAABMDEZP6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBUGAYDCMRYGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Thank you for the feedback! FormatWrapper works to a certain degree. As long as I do not flatten the result, the form fills correctly. The rendering of newlines was an issue with the sample_form, i did not make the textbox allow multi-lines. I have corrected and update the attachment, "sample_form.pdf" There is still an issue with this solution. It leaves the pdf editable this is not ok for us in certain reports where the information generated using our product needs to remain as is. However, using flatten=True in FormWrapper renders the text not visible in the final pdf. I am digging around the flatten code to see why this maybe happening. At the moment, I do not know the PDF specification so I need to start from there. I will dig around some more and provide an update, hopefully soon. |
So I finally spent some time looking at this yesterday. Unfortunately it is not an easy change to support landscape mode for the For now I suggest stick with |
I view the final output in a browser. I only use Adobe Acrobat for preparing the initial editable form. I can definitely confirm its not related to the viewing software or viewing modes, because my previous approach which uses fdfgen and then pdftk-java produces the right results when viewed using the same browser (or other PDF viewers). FYI, the main reason we are evaluating PyPDFForm and underlying pypdf as an alternative is to get closer to a python implementation and remove the Java footprint from our tech-stack. However, I do understand the complications you mention. I was digging around myself and did not find any quick solutions either. I will try to continue with what we have for the moment but I will keep looking at this as time permits. |
Umm not sure what browser you are using. Chrome seems to work for me. Snippet: from PyPDFForm import FormWrapper
filled = FormWrapper("sample_form.pdf").fill(
{"order_nbr" : "Order001\nOrder002",
"cntr_nbr" : "Container001\nContainer002"
},
flatten=True
)
with open("output.pdf", "wb+") as output:
output.write(filled.read()) |
Ok Yes, I can confirm Chrome on Linux and Windows renders this as you have shown. Firefox on Linux and Windows does not render the Orders or Containers. More surprisingly, even Adobe Acrobat Does not render the fields. I can definitely advise people to use Chrome, but the choice of end user's Browser, is unfortunately not in my control. However, at least, I still have a recommendation for them. Thank you! |
Version
PyPDFForm=1.4.31
Issue Description
Background - We use fillable pdfs that have been created by rotating a default form clockwise by 90 degree. This has been done because the "landscape" mode can accommodate all the columns we need on a single printed page. So far we have been using fdggen and then flatten using pdftk and this is able to handle the form, and fields, that are thus rotated. PyPDFForm, does fill the form however it does not handle the rotation of the text.
Also, please notice the \n character in the data. In the output generated by PyPDFForm, the newline character is replaced with a visual representation. I don't know if this would be converted to newlines in the pdf automatically if this issue is fixed.
Code Snippet
PDF Form Template
sample_form.pdf
Screenshots (if applicable)
output.pdf
The text was updated successfully, but these errors were encountered: