Search code examples
windowspowershellpdftk

pdftk update_info command raising a warning which I don't understand


I'm trying to use the update_info command in order to add some bookmarks to an existing pdf's metadata using pdftk and powershell.

I first dump the metadata into a file as follows:

pdftk .\test.pdf dump_data > test.info

Then, I edit the test.info file by adding the bookmarks, I believe I am using the right syntax. I save the test.info file and attempt to write the metadata to a new pdf file using update_info:

pdftk test.pdf update_info test.info output out.pdf

Unfortunately, I get a warning as follows:

pdftk Warning: unexpected case 1 in LoadDataFile(); continuing

out.pdf is generated, but contains no bookmarks. Just to be sure it is not a syntax problem, I also ran it without editing the metadata file, by simply overwriting the same metadata. I still got the same warning.

Why is this warning occurring? Why are no bookmarks getting written to my resulting pdf?


Solution

  • using redirection in that fashion

    pdftk .\test.pdf dump_data > test.info

    will cause this known problem by building wrong file structure, so change to

    pdftk .\test.pdf dump_data output test.info
    

    In addition check your alterations are correctly balanced (and no unusual characters) then save the edited output file in the same encoding.

    Note:- you may need to consider

    Use dump_data_utf8 and update_info_utf8 in order to properly display characters in scripts other than Latin (e. g. oriental CJK)