Hello,
I have a task of grabbing a page from a pdf document and save it as an image file, jpeg would be fine.
I can get a page of a pdf using:
pdfDoc = arcpy.mapping.PDFDocumentOpen(output_pdfPath)
pdfDoc.deletePages(pagesToDelete)
pdfDoc.saveAndClose()
Does anyone know how to take that newly saved pdfDoc and export it as a jpeg?
Thanks,
Solved! Go to Solution.
So, we settled on using Ghostscript and shelling out in some fashion via python running and external process to convert from the .pdf to a .tif. Hope this helps someone.
There are some blogs and post outside of GeoNet that threat this topic:
Ned Batchelder: Extracting JPGs from PDFs
Converting a PDF to a series of images with Python - Stack Overflow
You could use Image Magick (ImageMagick: Convert, Edit, Or Compose Bitmap Images ) which can be called from Python via a few different interfaces (such as PythonMagick).
Yes, I've seen those two posts. The Ned Batchelder post doesn't work at all. I am attaching the .jpg it produced. It seems to have only extracted the water mark and not the map.
The problem with ImageMagick is that I'd have to install it on the user's machine, an undesirable side effect.
Is there any other way to get this done?
Steve
So, we settled on using Ghostscript and shelling out in some fashion via python running and external process to convert from the .pdf to a .tif. Hope this helps someone.