5

I've been asked to automate the exporting of metadata from ESRI feature classes into .pdf files. We don't want the .xml files, rather a .pdf version of what you see in the Description panel in Catalog. Manually we can achieve this by using the print button in the description panel tools and then using the cutepdf print drive. But I don't see a print option for metadata in ArcPy, all I see are options for exporting to .xml files.

In ArcObjects the IGxView object which looks like it could do what I need.

Is there a way to do what I want in ArcPy or should I use ArcObjects and its IGxView instead?

2 Answers 2

5

@dvdhns suggestions, are what you should do.

However you don't need to write a xslt for html conversion because Esri has done this for you. see this code snippet:

import arcpy
from arcpy import env
env.workspace = "C:/data"
#set local variables
dir = arcpy.GetInstallInfo("desktop")["InstallDir"]
xslt = dir + "Metadata/Stylesheets/ArcGIS.xsl"
arcpy.XSLTransform_conversion("vegetation", xslt, "vegetation.html", "#")

This code converts your table/Layer metadata directly to html. (You don't need to convert it to a standalone xml file)

Afterward, use this python library to convert formatted HTML to PDS.

2
  • Good point! I had forgotten that there was an HTML converter built in.
    – dvdhns
    Commented Feb 24, 2015 at 22:18
  • Thank you both for you help, this works great. The python library to convert .html to .pdf is cumbersome to set up but seems very powerful. I'm looking forward to playing with it more.
    – Dowlers
    Commented Feb 25, 2015 at 3:53
3

No. You cannot directly export ESRI Feature Class metadata into PDF files.

This is how I would attempt to do it using python, rather than ArcObjects:

  1. Use arcpy to export the metadata to xml files.
  2. Use python and xslt (xml style sheets) to format the xml files into something human readable, my recommendation is a simply formated txt or html file.
  3. Use a python PDF library to convert the txt or html file you just created into a PDF.

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.