Skip to content
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

Error while trying to fill form fields: Inconsistent ending of dictionary. Wrong nesting of startDictionary and endDictionary #303

Open
gomikestrat opened this issue Jul 14, 2018 · 5 comments

Comments

@gomikestrat
Copy link

gomikestrat commented Jul 14, 2018

Hello,

I've followed the form fill example ( http://pdfhummus.com/post/161128437261/a-good-day-to-everyone-today-we-will-discuss-a ) and I have come across this error:

Inconsistent ending of dictionary. Wrong nesting of startDictionary and endDictionary
TypeError: Inconsistent ending of dictionary. Wrong nesting of startDictionary and endDictionary

Log file:

ObjectsContext::EndDictionary, stack underflow. Trying to end a dictionary when there's no open dictionaries

With the pdfs provided on the example I can successfully fill the forms but some other pdfs (v1.6) that I've got produce this error. Does it have to do with the supplied pdf? I can always read all the form fields successfully.

@Ventajou
Copy link

I'm encountering the same error, it happens whenever I create a text field with 2 child widgets. In my case, I've tracked it down to the following lines: https://github.com/galkahana/HummusJSSamples/blob/master/filling-form-values/pdf-form-fill.js#L195-L197

When I comment them out, the error disappears but the resulting PDF is invalid. I've not been able to figure out what was wrong.

@Ventajou
Copy link

@gomikestrat take a look at galkahana/HummusJSSamples#20 and see it if fixes the issue for you

@gomikestrat
Copy link
Author

@Ventajou yes my friend, your fix works! Excellent work!
There is a minor issue though: the text is not aligned correctly in the field and its cropped a little bit but I'll mess a bit with the code and I'll figure something out.

@hnitzsche
Copy link

hnitzsche commented Sep 13, 2018

@gomikestrat look for xobjectForm.getContentContext() inside the writeAppearanceXObjectForText() function and chain in .Tm(1,0,0,1,0,3) for example. Adjust the bold value to your needs then.

@pgrmCreate
Copy link

pgrmCreate commented Apr 23, 2019

I got the same error on "NodeJs" and "log file" and when i try this pdf-form-fill.js on this pull request, i have on ouput a simple copy of my pdf in input.

It is solved with version 101 of hummus ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants