How can I add pages to my Grapher project with a custom page size?

Grapher 14 added the ability to create multi-page project files. However, all added pages are letter size with portrait orientation. If you wish to create a project with many pages, and you want all of your pages to be a custom size, you can use the script below to create the project, and then you can add content to each page. If you would like the pages to be a predefined page size, see How can I add pages to my Grapher project with a specific predefined page size?.


To run the script:

  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. Click the green arrow Start/Resume icon in the Script Manager.


Sub Main

'Initializes Grapher 
Dim Grapher As Object 
Set Grapher = CreateObject("Grapher.Application")
Grapher.Visible = True 

'User defined variables 
numpages = 3
outpath = "C:\temp\"
outfilename = "Plot1.gpj"
pwidth = 5
pheight = 6.1

'Set up page 1 
Set Plot1 = Grapher.Documents.Add(grfPlotDoc)
Plot1.PageSetup.Width = pwidth
Plot1.PageSetup.Height = pheight

'Add any additional pages and set them up 
For i=2 To numpages
    Plot1.PageSetup.Width = pwidth
	Plot1.PageSetup.Height = pheight

'Activate page 1

'Save the file

End Sub


Please contact us if you would like us to add your vote to our suggestion file for the ability to set a default page size to use for added pages.


Updated February 2023

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



Please sign in to leave a comment.