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

handle_data_names #13

Open
gladwig2 opened this issue Apr 8, 2016 · 0 comments
Open

handle_data_names #13

gladwig2 opened this issue Apr 8, 2016 · 0 comments

Comments

@gladwig2
Copy link

gladwig2 commented Apr 8, 2016

I'm wondering if handle_data_names should be converting the value to a string.

currently it does this:
for (key, value) in fdf_data_names:
yield b''.join([b'<<\n/V /', smart_encode_str(value), b'\n/T (',

which generates when passed a value of:

/.../fdfgen/init.py(68)handle_data_names()
-> yield b''.join([b'<<\n/V /', smart_encode_str(value), b'\n/T (',
(Pdb) value
'Off'
(Pdb)

generates fdf that looks like this (as seen in Emacs utf8):
<<
/V /\376\377^@o^@f^@f
/T (\376\377^@U^@s^@ ^@m^@A^@i^@l)
/Clrf 2
/ClrFf 1

but when I use the generated fdf, I get:
linux-3:~/..$ pdftk RoutineLandscaping_100614.pdf fill_form tmp.fdf output ./output/output.pdf
Unhandled Java Exception:
Unhandled Java Exception:
java.lang.NullPointerException
at gnu.gcj.runtime.NameFinder.lookup(libgcj.so.14)
at java.lang.Throwable.getStackTrace(libgcj.so.14)
at java.lang.Throwable.stackTraceString(libgcj.so.14)
at java.lang.Throwable.printStackTrace(libgcj.so.14)
at java.lang.Throwable.printStackTrace(libgcj.so.14)

So, I wonder, since handle_data_strings is there to handle strings, if instead handle_data_names should just pass the values like this:
for (key, value) in fdf_data_names:
yield b''.join([b'<<\n/V /', value, b'\n/T (',

doing this, the generated fdf looks like this:

<</V /Off
/T (\376\377^@U^@s^@ ^@m^@A^@i^@l)
/Clrf 2
/ClrFf 1

which works fine with pdftk fill_form.

This is just one example of course. Perhaps I'm passing in a value incorrectly..? but the name and the original php makes me wonder.

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

1 participant