So my question is, can I create a PDF which will always open at zoom 100% ?
- Posts: 12910
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Code: Select all
-c "[ /PageMode /UseNone /Page 1 /View [ /XYZ null null 1 ] /PageLayout /SinglePage /DOCVIEW pdfmark"
- This '-c ...' is a PostScript snippet using the special 'pdfmark' operator. It leads Ghostscript to insert the PDF code required for the view settings into the PDF root object (= '/Type /Catalog').
- The contents of the command line snippet appears to be 'unbalanced' regarding the '[' and ']' operators/keywords. But it is not! The initial '[' is balanced by the final 'pdfmark' keyword. (Don't ask -- I did not define this syntax...)
- Not all PDF viewers do respect the view settings embedded in the PDF file (Acrobat software does!).
- Most PDF viewers allow users to override the view settings embedded in PDF files (Acrobat software also does this). That is, you can tell your viewer to never respect any settings from the PDF files it opens, but f.e. to always open it with "fit to width".
- The page mode '/UseNone' means: document displays without bookmarks or thumbnails. It could be replaced by
- '/UseOutlines' (to display bookmarks also, not just the pages)
- '/UseThumbs' (to display thumbnail images of the pages, not just the pages)
- '/FullScreen' (to open document in full screen mode)
- The array for the view mode constructed as '[/XYZ <left> <top> <zoom>]' means: The zoom factor is 1 (=100%), the left distance from the page origin is the special 'null' value, which means to keep the previously user-set value; the top distance from the page origin is also 'null'. This array could be replaced by
- '/Fit' (to adapt the page to the current window size)
- '/FitB' (to adapt the visible page content to the current window size)
- '/FitH <top>' (to adapt the page width to the current window width; '<top>' indicates the required distance from page origin to upper edge of window)
- ...plus several others I cannot remember right now.
Code: Select all
gs \ -o out.pdf \ -sDEVICE=pdfwrite \ -c "[ /PageMode /UseNone /Page 1 /View [ /XYZ null null 1 ] /PageLayout /SinglePage /DOCVIEW pdfmark" \ -f in.pdf
If it worked, check if your PDF viewer honors the settings. If it doesn't honor them, see if there is an overriding setting within the viewers preference settings.
To learn more about the pdfmark operator, google for 'pdfmark reference filetype:pdf'. You should be able to find it on the Adobe website and elsewhere: