Loading a pdf image (Python)

Loading a pdf image (Python)
 1# this example loads a pdf image, since the image is a pdf
 2# some PostScriptImageOptions are created and initialised to
 3# use in IGraphicImages.load_from_file method
 4
 5# create an IPostScriptImageOptions object
 6options = impact.creator.post_script_image_options()
 7
 8# define the post script options
 9options.interpolate = 1
10options.resolution = 100
11options.colour_mode = ipColourMode.cmColour
12
13# get the images collection from the active drawing
14images = impact.active_drawing.graphic_images
15
16# define some local variables
17fileName = "d:\1.pdf"
18embed = 0
19
20# call the IGraphicImages.load_from_file to load the image
21# into the drawing
22image = images.load_from_file( fileName, embed, options )
23
24# clear the output toolbox
25impact.gui.output_toolbox.clear()
26
27# determine if the image was loaded successfully
28if not image.isNone():
29    impact.gui.output_toolbox.add("successfully loaded " + fileName)
30else:
31    impact.gui.output_toolbox.add("failed to load " + fileName)