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

Created on 14 Jul 2018  路  5Comments  路  Source: galkahana/HummusJS

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.

Most helpful comment

@gomikestrat take a look at https://github.com/galkahana/HummusJSSamples/pull/20 and see it if fixes the issue for you

All 5 comments

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.

@gomikestrat take a look at https://github.com/galkahana/HummusJSSamples/pull/20 and see it if fixes the issue for you

@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.

@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.

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_ ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ankitrshah89 picture ankitrshah89  路  5Comments

KPrabs106 picture KPrabs106  路  5Comments

chunyenHuang picture chunyenHuang  路  3Comments

GautierT picture GautierT  路  6Comments

MOuli90 picture MOuli90  路  6Comments