Solved! Go to Solution.
Yep, that is what I think. Please, take a look at the code to see if I changed stuff correctly. I figured out to use ListLayers. See how close I am.
import arcpy, os, sys from os import path as p from arcpy import mapping as m #Make parameters for people to choose mxd and folder of PDFs to compare mxdList = string.split(arcpy.GetParameterAsText(0), ";") pdf_path = arcpy.GetParameterAsText(1) report = {} #Use Search Cursor to go through Attribuite Table to get Sheet number info for mapDoc in mxdList: arcpy.AddMessage(mapDoc) mxd = arcpy.mapping.MapDocument(mapDoc) df = arcpy.mapping.ListLayers(mxd, "*,Traff Proj")[0] for lyr in m.ListLayers(mxd, "*, Grid"): if lyr.description == "*, Grid": max_list = [] rows = arcpy.SearchCursor(lyr) for row in rows: max_list.append(row.Sheet_ID) sheet_count = max(max_list) arcpy.AddMessage('Sheet count: %s'%sheet_count) print 'Sheet count: %s'%sheet_count else: arcpy.AddError('No Layers in %s match data source'%mapDoc) page_list = []
page_list = []
arcpy.env.workspace = ws = pdf_path
for pdf_doc in arcpy.ListFiles('*.pdf'):
    page_list.append(int(''.join([i for i in pdf_doc.split('.')[0] if i.isdigit()])))
page_count = max(page_list)
arcpy.AddMessage('PDF page count: %s' page_count)
if page_count == sheet_count:
    arcpy.AddMessage('%s Sheet Count matches number of pages in %s' %(mapDoc,pdf_doc))
else:
    arcpy.AddMessage('%s Sheet Count does not match number of pages in %s' %(mapDoc,pdf_doc))
It doesn't like my code for sheet count. I've attached to error again for you. It finishes counting the PDFs but it is puzzled on how to give me a sheet count. Error is Sheet_count not defined. So wouldn't I need to write, sheet_count = arcpy.mapping.ListLayers.
import arcpy, os, sys
from os import path as p
from arcpy import mapping as m
#Make parameters for people to choose mxd and folder of PDFs to compare
mxdList = string.split(arcpy.GetParameterAsText(0), ";")
pdf_path = arcpy.GetParameterAsText(1)
report = {}
#Use Search Cursor to go through Attribuite Table to get Sheet number info
for mapDoc in mxdList:
    arcpy.AddMessage(mapDoc)
    mxd = arcpy.mapping.MapDocument(mapDoc)
    df = arcpy.mapping.ListLayers(mxd, "*,Traff Proj")[0]
    for lyr in m.ListLayers(mxd, "*, Grid"):
        if lyr.description == "*, Grid":
            max_list = []
            rows = arcpy.SearchCursor(lyr)
            for row in rows:
                max_list.append(row.Sheet_ID)
        else:
            arcpy.AddError('No Layers in %s match data source'%mapDoc)
        sheet_count = max(max_list)
        arcpy.AddMessage('Sheet count: %s'%sheet_count)
        print 'Sheet count: %s'%sheet_count
                
        page_list = []
        arcpy.env.workspace = ws = pdf_path
        for pdf_doc in arcpy.ListFiles('*.pdf'):
            page_list.append(int(''.join([i for i in pdf_doc.split('.')[0] if i.isdigit()])))
        page_count = max(page_list)
        arcpy.AddMessage('PDF page count: %s' page_count)
        if page_count == sheet_count:
            arcpy.AddMessage('%s Sheet Count matches number of pages in %s' %(mapDoc,pdf_doc))
        else:
            arcpy.AddMessage('%s Sheet Count does not match number of pages in %s' %(mapDoc,pdf_doc))
import arcpy, os, sys, string
from os import path as p
from arcpy import mapping as m
#Make parameters for people to choose mxd and folder of PDFs to compare
mxdList = string.split(arcpy.GetParameterAsText(0), ";")
pdf_path = arcpy.GetParameterAsText(1)
#Use Search Cursor to go through Attribuite Table to get Sheet number info
sheet_count = 0
for mapDoc in mxdList:
    arcpy.AddMessage(mapDoc)
    mxd = arcpy.mapping.MapDocument(mapDoc)
    for lyr in m.ListLayers(mxd, "*, Grid"):
        if lyr.description == "*, Grid":
            max_list = []
            rows = arcpy.SearchCursor(lyr)
            for row in rows:
                max_list.append(row.Sheet_ID)
            sheet_count = max(max_list)
            arcpy.AddMessage('Sheet count: %s'%sheet_count)
            print 'Sheet count: %s'%sheet_count
        else:
            arcpy.AddError('No Layers in %s match data source'%mapDoc)
                
    page_list = []
    
    # List all PDF's in the pdf_path folder
    
    arcpy.env.workspace = ws = pdf_path
    for pdf_doc in arcpy.ListFiles('*.pdf'):
        page_list.append(int(''.join([i for i in pdf_doc.split('.')[0] if i.isdigit()])))
    page_count = max(page_list)
    arcpy.AddMessage('PDF Page Count: %s' %page_count)
    if page_count == sheet_count:
        arcpy.AddMessage('%s Sheet Count matches number of pages in %s' %(mapDoc,pdf_doc))
    else:
        arcpy.AddMessage('%s Sheet Count does not match number of pages in %s' %(mapDoc,pdf_doc))