I have a point feature class in a personal geodatabase. I would like to select a group of points and open all the hyperlinked pdf documents in the group, or even export all the hyperlinked pdfs somewhere. Any ideas?
You can create a list of the URL's and then use the code below to download them:
def main():
import os
folder = r'C:\GeoNet\DownloadPDFs'
# loop through selected hyperlinks and create the list of PDF urls
lst = ['http://www.esri.com/training/assets/downloads/esri-course-catalog.pdf',
'http://www.esri.com/library/brochures/pdfs/arcgis-desktop.pdf',
'http://www.esri.com/library/brochures/pdfs/arcgisextbro.pdf',
'http://www.esri.com/library/brochures/pdfs/arcgis-for-mobile.pdf',
'http://www.esri.com/library/brochures/pdfs/arcgis-online.pdf']
# process pdfs
for pdf_url in lst:
pdf_out = os.path.join(folder, os.path.split(pdf_url)[1])
print(pdf_out)
download_file(pdf_url, pdf_out)
def download_file(download_url, output_pdf):
# https://stackoverflow.com/questions/24844729/download-pdf-using-urllib
response = urllib2.urlopen(download_url)
file = open(output_pdf, 'wb')
file.write(response.read())
file.close()
if __name__ == '__main__':
main()