galkahana / HummusJS

Node.js module for high performance creation, modification and parsing of PDF files and streams
http://www.pdfhummus.com
Other
1.15k stars 170 forks source link

Text in form field rotated on landscape page after portrait page #213

Open edparsons opened 6 years ago

edparsons commented 6 years ago

I'm experiencing a problem similar to this one (https://github.com/galkahana/HummusJS/issues/143) where after some portrait pages, the text I am writing into a text field on a landscape page is written vertically.

I am using pdf-form-fill.js (https://github.com/galkahana/HummusJSSamples/blob/master/filling-form-values/pdf-form-fill.js) which does not appear to that the hummus.PDFPageModifier(pdfWriter, 0); call or similar for me to add a third parameter of true to.

Can you let me know what I should add to the pdf-form-fill code so the text on landscape is oriented correctly to the current page rather than previous pages?

Thank you

galkahana commented 6 years ago

Must say im not sure why there's a problem due to different orientation. before trying anything, try to use the version i create in this branch: https://github.com/galkahana/HummusJSSamples/tree/lock-form/filling-form-values

there's a small update that might solve the issue.

if not, then the redrawing of annotations happens in here: https://github.com/galkahana/HummusJSSamples/blob/master/filling-form-values/pdf-form-fill.js#L162

which is a good place to know, in case you want to also change how exactly the text is placed, plus replace with something more robust in case you want to support unicode.

edparsons commented 6 years ago

Hi Gal, I tried with new file and no dice. So how would I edit like 162 to reset based on the current page rotation, rather than page 0s orientation. I'm attaching both a screenshot of what it looks like in chrome and the file you get when you download it.

screen shot 2017-10-31 at 3 06 07 pm

preview (2).pdf

edparsons commented 6 years ago

@galkahana if you try your form fill code on this document, so you get the same result? We are still struggling with this. preview.pdf