3

I have a small python script which exports a set of data driven pages to PDF. This works fine, including appending each page to an 'all' pdf.

My issue is that it creates rasters of each layer in the map.

I can use something like CutePDF to print to a vector map, and that works great. Much smaller filesizes, but this is not easily done in a batch process. It requires you to choose the file name of each page manually.

Can you make ArcPy's export to pdf method actually use vector format for the content of the map. If not, is there a way to automate the printing to file, using cutePDF or something else?

1
  • Let me see if I read you correctly: when using arcpy, you get raster, but with cutepdf you actually get the desired result, but of course not in batch?
    – ako
    Jul 29, 2011 at 6:10

2 Answers 2

3

This may or may not have anything to do with arcpy. In the ArcMap 9 series, when exporting maps which included raster layers or even bitmap patterns, vectors would be rasterized as well. If you are using some of the online map resources that may still be the case. I don't have an installation here to check it, but see if turning off any raster layers makes any difference.

3
3

I used the following python code to identify rasterising layers. Removing these (had to let go of some transparency) reduced the file size by 50%.

import arcpy

def DetectRasterization():
  mxd = arcpy.mapping.MapDocument("CURRENT")
  df_list = arcpy.mapping.ListDataFrames(mxd)
  foundRasterization = False
  noneFoundMsg = "No rasterizing layers were detected."
  for df in df_list:
    lyr_list = arcpy.mapping.ListLayers(mxd, data_frame=df)
    for lyr in lyr_list:
      if lyr.isRasterizingLayer or lyr.supports("BRIGHTNESS"):
        foundRasterization = True
        if lyr.isGroupLayer and lyr.transparency > 0:
          print "In data frame '" + df.name + "', the group layer '" + \
                   lyr.longName + "' is a rasterizing layer:\r",
          print "\tVisibility is " + str(lyr.visible) + ".\n" + \
                "\tTransparency is " + str(lyr.transparency) + " percent.\n"
        elif not lyr.isGroupLayer:
          print "In data frame '" + df.name + "', the layer '" + \
                   lyr.longName + "' is a rasterizing layer:\r",
          if lyr.transparency > 0:
            print "\tVisibility is " + str(lyr.visible) + ".\n" + \
                  "\tTransparency is " + str(lyr.transparency) + " percent.\n"
          else:
            print "\tVisibility is " + str(lyr.visible) + ".\n" + \
                  "\tTransparency is 0 percent, but the layer may be a\n" + \
                  "\traster layer or contain rasterizing symbology such\n" + \
                  "\tas bitmap picture symbols.\n"
      del lyr
    del lyr_list
    del df
  if not foundRasterization:
    print noneFoundMsg
  del df_list
  del mxd

DetectRasterization()

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.