0

I am running a script that pulls certain .mxd files out of a folder and prints them for me. For some reason, when I use the script, part of the layout is cutoff; on the other hand, when I open each .mxd individually and print, everything comes out fine. Is there a way to control the print setup within my script to correct this?

    import arcpy, os
    from arcpy import env
    env.workspace = r"folder directory"

    ws = env.workspace

    locator = arcpy.ListFiles("*LOCATOR.mxd")
    for i in locator:
        filepath = os.path.join(ws, i)
        mxd = arcpy.mapping.MapDocument(filepath)
        arcpy.mapping.PrintMap(mxd)

    vicinity = arcpy.ListFiles("*VICINITY.mxd")
        for k in vicinity:
        filepath = os.path.join(ws, k)
        mxd = arcpy.mapping.MapDocument(filepath)
        arcpy.mapping.PrintMap(mxd)
  • Can you share the script you are using? That will help people to understand your problem and help you. – Sara Barnes Aug 31 '15 at 18:20
  • The script has only printed out one .mxd correctly, but I do not know what sets it apart from the others – PHP Aug 31 '15 at 18:53
1

It doesn't look like there is any way to control page setup through arcpy.mapping. See this page. It is possible that the system is using your default printer settings and not the settings saved in the MXD. I suggest having a look at creating PDF files from the MXDs using arcpy.mapping.ExportToPDF.

You'll have a bit more control when creating PDFs and then you can print them directly.

-1

You didn't say what version of Arc, but here's some additional properties of MapDocuments.

It looks like you can control many more options (try searching that page for 'print' to pick out the important ones). I'm guessing you may have the wrong size or data frame selected and setting it in the script would rectify it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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