Skip to content

handle_data_names #13

@gladwig2

Description

@gladwig2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions