Home > database >  How to modify the display settings of a pdf file in double-page view?
How to modify the display settings of a pdf file in double-page view?

Time:04-15

I have converted a pdf-file using ghostscript to pdf/A-2 using

gs -dPDFA=2 -dPrinted=false -dBATCH -dNOPAUSE -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -sPDFACompatibilityPolicy=1 -sOutputFile=file_PDFA-2.pdf file.pdf

I have used ghostscript version 9.26 on Ubuntu 18.04.5 LTS.

I use Acrobat Reader to display the pdf-document in double page view. Before using ghostscript, the first page is correctly show to the right (see figure). The ghostscript command apparently modifies this, which makes the document harder to read.

Pdf view before and after using ghostscript

Is there a way in ghostscript to modify this setting? Unfortunately, I couldn't find an option. Using other freely available tools to modify the settings after using ghostscript would also work.

Edit: link to the pdf-files before and after the conversion: link to the pdf-files

Thank you.

CodePudding user response:

So looking at the before PDF file I see, in the document Catalog (after decompressing the file):

28 0 obj
<<
  /Type /Catalog
  /Pages 12 0 R
  /Names 27 0 R
  /PageMode /UseOutlines
  /PageLayout /TwoPageRight
  /OpenAction 4 0 R
>>
endobj

And in the after file I see the Catalog only contains:

1 0 obj
<<
  /Type /Catalog
  /Pages 3 0 R
  /Metadata 24 0 R
>>
endobj

So it seems likely that the '/PageLayout' key having the value '/TwoPagesRight' is what causes Acrobat to display the way it does. Noe the /PageMode /UseOutlines which appears to be pointless since the PDF file doesn't actually seem to contain any Outlines.

We can use a /PUT pdfmark to add entries to dictionaries, and that is supported by both the pdfwrite device and the interpreter.

[ {Catalog} << /PageLayout /TwoPageRight >> /PUT pdfmark

Should work, but unfortunately does not. I'll try and find time to look into why it doesn't when I have a little time but that won't be today I'm afraid.

  • Related