PDMWorks API SaveAsPDF

I need help saving a PDF out of the vault.

I have checked in the the slddrw and created a pdf upon checkin.Now my code looks like this.

docs = conn.Documents' get all docs in pdmconnection

doc = docs.item(docName)'docName = Assem1.slddrw

val = doc.saveasPDF(filePath)' filePath = H:\\Test

I get an ex on saveaspdf stating the document cannot befound.SolidworksApi macros