I am changing sources on MXDs in differents offices using ArcPy and ArcGIS 10.0. As observed here, the printer settings revert to the default printer when the instruction mxd.save() is sent.

Losing the printer is a minor issue in my case, but it becomes major if the print option "Scale map elements proportionally to changes in page size" is ticked while the "Use Printer Paper Settings" is selected. The screenshot below is my worst-case scenario, the best case would be unchecking both tick-boxes.

enter image description here

  • I would like to use comtypes to check the value of that option and set it to False (unticked) before saving the MXD - the idea is to call this as a function from an existing ArcPy script. (primary goal)

  • To secure the print settings further, I would ideally also like to untick the "Use printer setting" box if it is ticked. (secondary goal)

Can anyone help?

1 Answer 1


I assume you have installed comtypes successfully, according to the following SE Q/A:


import arcpy
from snippets102 import *
from comtypes.client import GetModule, CreateObject

import comtypes.gen.esriFramework as esriFramework
import comtypes.gen.esriArcMapUI as esriArcMapUI
import comtypes.gen.esriCarto as esriCarto

pMapDoc = CreateObject(esriCarto.MapDocument, interface=esriCarto.IMapDocument)
path = r'D:\my.mxd'
pageLayoutActiveView = CType(pMapDoc.PageLayout,esriCarto.IActiveView)

p = pMapDoc.PageLayout.Page

#unchecking "Scale map elements proportionally to changes in page size"
p.StretchGraphicsWithPage = False

#setting the size manually suppresses the default behaviour of "Use Printer Paper Settings"
p.Units=1 #1 is for Inches
p.PutCustomSize(width,height) #sizez of a4


This code can be customized to update the properties of an opened mxd in an active ArcMap session.

  • Thanks you Farid! This looks very promising indeed!! I am away from the office, and will be able to test your code Friday pm - I will keep you posted of course . My thanks again!!
    – Hélène
    Commented Feb 4, 2016 at 5:14
  • Just to confirm, it works great! Do you know if it is possible te read the current page size? Thinking about reading it then applying it as p.PutCustomSize(), so I keep the original page size for each MXD.
    – Hélène
    Commented Feb 5, 2016 at 18:27
  • 1
    Sure, simply add (width,height)=p.QuerySize() to the code and change p.PutCustomSize(width,height) accordingly. See the updated code snippet! Commented Feb 5, 2016 at 23:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.