1

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?

user32882
  • 5,094
  • 5
  • 43
  • 82
  • The warning means an input line was not understood and skipped (yes, It is very cryptic). Can you post a minimal example of your bookmark metadata? See e.g. https://unix.stackexchange.com/questions/17065/add-and-edit-bookmarks-to-a-pdf-file to make sure you use the right syntax. – notautogenerated Jan 18 '22 at 20:45

2 Answers2

3

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)

K J
  • 8,045
  • 3
  • 14
  • 36
0

I used pdftk --help >pdftk-help.txt to find the answer.

With credit to the previous answer, the following creates a text file of the information parameters: pdftk aaa.pdf dump_data output info.txt

Edit the info.txt file as needed.

The pdftk update_info option creates a new pdf file, leaving the original pdf untouched. Use: pdftk aaa.pdf update_info info.txt output bbb.pdf