D_Bester
D_Bester

Reputation: 5911

How do I insert bookmarks into a new PDF file using GhostXPS?

I want to convert XPS to PDF using GhostXPS. Using command line:

"S:\GhostXPS\gxpswin32-9.18.exe" @"S:\Temp\PS\XPS\TestXPSWrite.txt" 

Where the options are in the TestXPSWrite.txt file:

-sDEVICE=pdfwrite -sOutputFile="S:\Temp\PS\XPS\TestMerged.pdf" 
-dNOPAUSE -dBatch 
"S:\Temp\PS\XPS\Test1.xps" 
"S:\Temp\PS\XPS\Test2.xps" 
"S:\Temp\PS\XPS\Test3.xps" 
"S:\Temp\PS\XPS\Bookmarks.txt"

Contents of Bookmarks.txt file:

[/Title (Summary) /Page 1 /OUT pdfmark
[/Title (TOC) /Page 2 /OUT pdfmark
[/Title (Chapter 1) /Page 3 /OUT pdfmark

Everything works fine except the Bookmarks.txt file which fails because it isn't an XPS file. If these were PostScript files using regular GhostScript exe then the bookmarks work fantastic. But not with XPS.

How do I insert bookmarks into a new PDF file using GhostXPS?

Upvotes: 0

Views: 1039

Answers (1)

KenS
KenS

Reputation: 31159

Bluntly, you can't.

The only way currently to add such content is, as you are aware, to use the pdfmark PostScript operator (that's what's in your bookmarks.txt file, its actually a PostScript program).

But since GhostXPS doesn't understand PostScript, you can't do that.

You could double process the file, passing the newly created PDF file back through Ghostscript and the pdfwrite device to get a second new PDF file and add the bookmarks during that stage. But double processing can cause odd things to happen with the content.

There may be a solution to this at a later date.

Upvotes: 1

Related Questions