How can I export a multi-page project to a single PDF in Grapher via automation?

To export multiple pages in a Grapher project to a single PDF:

  1. Copy the script below.
  2. Open Grapher and turn on the Script Manager by clicking View | Display | Script Manager.
  3. Press Ctrl+A to select all of the existing lines in the Script Manager and then press DELETE.
  4. Press Ctrl+V to paste it into the Script Manager.
  5. Update the filename, filepath, and numpages in the User-defined variables section to be appropriate for your needs.
  6. Click the Start/Resume icon () in the Script Manager. 
  7. Once the file has completed running, you should have one PDF for each page. You can combine them into one in Adobe Acrobat Pro DC or some free online PDF merge/join software.

If you would like to print/export multiple pages to a single file without having to combine multiple files with a third-party application, please let us know!

 


Sub Main

'Create Grapher as an Object 
Dim Grapher As Object 
Set Grapher = CreateObject("Grapher.Application")
Grapher.Visible = True 

'====================================== 
'User-defined variables 
'====================================== 
'Path and Name of the project file to open and export
filepath = "C:\Users\L\Desktop\"
filename = "MultiPage.gpj" 

'Number of pages in the project
numpages = 5
'====================================== 

'Open file 
Set Plot1 = Grapher.Documents.Open(filepath+filename)

'Export objects to specified file 
For i=1 To numpages
    Plot1.SetActivePage(i)
    Plot1.Export2(filepath+"Export"+Str(i)+".pdf",False,"FitPage=0",True,"pdfv")
Next 

End Sub

 

Updated March 4, 2019

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.