• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

PDF options

New Here ,
Nov 07, 2016 Nov 07, 2016

Copy link to clipboard

Copied

Hi everyone,

Is it possible to set a PDF to show bookmarks through scripting in InDesign (as in after exporting in the script, can you access the PDF DOM?)? Or does this need to be done directly in Acrobat?

I'd want to do the same as:  properties>navigation tab>bookmarks panel and page

Thanks

TOPICS
Scripting

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Nov 07, 2016 Nov 07, 2016

Hi Jake,

As far as I know you can't do it from the InDesign side so you would either have to send the pdf to Acrobat with some more vbs and have acrobat set the view options or try hack the raw binary file pdf file.

In other words see what acrobat does to the binary file and see if you can emulate that.

It might be quite easy or it might be not practical.

Regards

Trevor

Votes

Translate

Translate
Guru ,
Nov 07, 2016 Nov 07, 2016

Copy link to clipboard

Copied

Hi Jake,

As far as I know you can't do it from the InDesign side so you would either have to send the pdf to Acrobat with some more vbs and have acrobat set the view options or try hack the raw binary file pdf file.

In other words see what acrobat does to the binary file and see if you can emulate that.

It might be quite easy or it might be not practical.

Regards

Trevor

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 08, 2016 Nov 08, 2016

Copy link to clipboard

Copied

Thanks Trevor, I'll do some experiments

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Nov 08, 2016 Nov 08, 2016

Copy link to clipboard

Copied

Hi

The hack method could be quite tough but the vbs looks simple.

See How do I create PDF with JAVASCRIPT using VBS ? (JavaScript)

The js method from the acrobat DOM is this.pane = 'Bookmark'; (or this.pane = 'B')

Might be bookmark with a small b, I can't rembember

The script they give there is

Dim AcroApp
Set AcroApp = CreateObject("AcroExch.App")
AcroApp.Show()

Set objPDDocNew = CreateObject("AcroExch.PDDoc")
If objPDDocNew.Create() = False Then
 
MsgBox "Could not create new file"
End If

Set objPDDoc = CreateObject("AcroExch.PDDoc")
If objPDDoc.Open("C:\tmp\Untitled.pdf") = False Then
 
MsgBox "Could not open existing file"
 
Return
End If

lngPages
= objPDDoc.GetNumPages
'MsgBox "Existing doc page num " & lngPages

'
Add pages to new file
If objPDDocNew.InsertPages(-1, objPDDoc, 0, lngPages, True) = False Then
 
MsgBox "Could not insert pages"
End If 

Dim jso
Set jso = objPDDocNew.GetJSObject
jso
.app.alert(jso.author)
jso
.addScript "DocScript", "function f() {app.alert('doc alert')} f();"
Set jso = Nothing

If objPDDocNew.Save(1, "C:\tmp\tmp.pdf") = False Then
 
MsgBox "Could not save"
End If 

objPDDocNew
.Close()
Set objPDDocNew = Nothing
objPDDoc
.Close()
Set objPDDoc = Nothing
AcroApp.Hide()
AcroApp.Exit()
Set AcroApp = Nothing

So I would guess if your created document variable is objDoc then in vbs one would do Set objDoc.Pane = "Bookmark"

HTH

Trevor

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Nov 08, 2016 Nov 08, 2016

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 09, 2016 Nov 09, 2016

Copy link to clipboard

Copied

Hi Trevor,

Thanks for the link

I've made an action in Acrobat which does this, would it be easier to run the action using vb/javascript?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Nov 09, 2016 Nov 09, 2016

Copy link to clipboard

Copied

I would guess vbs but I would advise asking on the acrobat scripting thread above.

Gilad (Try67) knows a lot more about acrobat workflow than me

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 09, 2016 Nov 09, 2016

Copy link to clipboard

Copied

Hi Jake,

the following is not meant as a "solution", but a possible way one could explore.

And yes, it can be done with some ExtendScript, InDesign's printing to PostScript feature and distilling to PDF by using Acrobat Distiller. E.g. by writing to a Distiller hotfolder. Not by using export to PDF. But since you are using bookmarks created with InDesign and exported to PDF, this may not be reliable.

 

I'm speaking of pdfmark annotations that can be placed with one or several generic EPS files to InDesign pages.
But the interpretation of this kind of annotations for PDFs can only made by Acrobat Distiller when creating a PDF out of PostScript or EPS.

 

The basic code of the EPS file is very simple, pure text that can be written to a file with suffix ".eps".

The EPS file will be later placed by using ExtendScript's method place() . Simple as that.

 

Code for a minimal EPSF header:

%!PS-Adobe-3.0 EPSF-3.0

%%BoundingBox: 0 0 72 72

%%EndProlog

 

Code for a minimal footer:

%%EOF

 

Between header and footer can go the pdfmark annotation stuff. See here what's possible:

http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdfmark_reference.pdf

 

Especially:

 

Page 29:

Document open options (DOCVIEW)

 

NOTE April 7, 2023:

The link above is not valid anymore. For pdfmark references see:

https://opensource.adobe.com/dc-acrobat-sdk-docs/library/pdfmark/pdfmark_Syntax.html

 

A code like the one below inside an EPS will be translated by Distiller to include an instruction for Adobe Reader or Acrobat Pro to open the PDF with bookmarks showing:

 

[ /PageMode /UseOutlines /DOCVIEW pdfmark

 

If your bookmarks are simple ones, e.g. from a TOC with an InDesign document, you could also extract the necessary information for "Title" and "Pagenumber" for every bookmark by using the ExtendScript DOM and build your own bookmarks with pdfmark instructions. See Page 26: Bookmarks (OUT)

 

It's a shame that InDesign's PDF Export will not evaluate pdfmark instructions that come with placed EPS files.

 

Regards,
Uwe

 

EDITED April 7, 2023

Uwe Laubender
( Adobe Community Expert )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Nov 09, 2016 Nov 09, 2016

Copy link to clipboard

Copied

Very interesting, Uwe, be hear if it can be got to work

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 09, 2016 Nov 09, 2016

Copy link to clipboard

Copied

Hi Trevor,

forgot a line of PostScript, that should be included before doing the pdfmark annotations in the EPS code.
That line will disable the pdfmarks when printed on a PostScript printer, because pdfmark code will throw an error with the PostScript RIP:

/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 10, 2016 Nov 10, 2016

Copy link to clipboard

Copied

Thanks for all your help, I'll have a look into this and if I find a solution I'll be sure to post it here

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 10, 2016 Nov 10, 2016

Copy link to clipboard

Copied

LATEST

Hi Jake,

if you want to explore the pdfmark route, see the following ExtendScript script by Muppet Mark that is distilling a PostScript file with Acrobat Distiller using some parameters:

Re: how to run system command

You could also do a "Watched Folder" with Distiller where you move a PostScript file to.
Used together with a hotfolder from Acrobat Pro where you can run a preflight process automatically.

( That's also a note to myself 🙂 )

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines