I have a PDF file with bookmarks (aka index and document outline), which seem to specify the zoom in which the document is displayed after the link is followed. I know this because when I view the file in Evince and click on a bookmark, Evince automatically changes the zoom level.

Although this is documented in ISO 32000-1:2008 (Section 12), I don't like this behavior. I want my PDF viewer to display the document in the same zoom level after using bookmarks.

A relatively new key allow-links-change-zoom in dconf is supposed to remedy this problem. However, even after setting the key to false, Evince continued to show the previous behavior. (Perhaps I might have needed to reboot the computer; but I can't check this because I don't have access to a newer version of Evince right now.)

That is why I've been trying to remove the zoom information from the bookmarks of the PDF file.

Keywords like /XYZ, /Fit and GoTo that appear in the specification does not occur in the file. Perhaps the bookmark is encoded somehow. So erasing the data by hand or by sed doesn't seem to work.

How can I do the task?

1 Answer 1


You might need to uncompress the file using pdftk to actually be able to find the destination keywords.

If you still have a copy of the v1.7 PDF standard, you can also check section 8.2 for more details about the syntax. The section about named destinations might be of help.

Here is a little script I use for stripping the zoom factors from bookmarks in PDFs:


# decrypt the file
pdftk "$1" output decrypted.pdf && \
pdftk decrypted.pdf output uncompressed.pdf uncompress && \
# remove zoom factors in bookmarks
sed 's#/Fit#/XYZ#g' uncompressed.pdf > uncompressed_output.pdf && \
# compress the output
pdftk uncompressed_output.pdf output output.pdf compress && \
mv "$1" "$1.original" && \
mv output.pdf "$1" && \
rm decrypted.pdf uncompressed.pdf uncompressed_output.pdf

Save this to a file removezoom.sh and make it executable. You can then call it as

~$ ./removezoom.sh yourFile.pdf

Edit: Ah, sorry, I was referring to section 8.2 in the document formatted by Adobe, named "PDF Reference, sixth edition". The formatting is different from the original ISO document, or so Library of Congress claims.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .