idw to PDF

idw to PDF

Anonymous
Not applicable
541 Views
7 Replies
Message 1 of 8

idw to PDF

Anonymous
Not applicable
Hi friends
I had problem that Printing Idw File to pdf.
i have one code which below run successfully, but when i open this pdf file error occurs that
"File extension is not correct or file is corrupted."
can anyone help why this happened
thanks in advance.

Private Sub PrintidwAsPdf()
If ThisApplication.ActiveDocument.DocumentType = kDrawingDocumentObject Then

Dim oDrgDoc As DrawingDocument
Set oDrgDoc = ThisApplication.ActiveDocument


Dim oDrgPrintMgr As DrawingPrintManager
Set oDrgPrintMgr = oDrgDoc.PrintManager

Dim drawingname As String
drawingname = ThisApplication.ActiveDocument.DisplayName

' Remove file extension
drgnameno = Len(drawingname)
drgname = Left(drawingname, drgnameno - 4)
oDrgPrintMgr.Printer = "cutePDF Writer"

' Get the name of the printer that will be used if not pdf
If MsgBox("Inventor will now use """ & oDrgPrintMgr.Printer & """ to create a pdf of """ & drgname & """ ", vbYesNo + vbQuestion) = vbNo Then
Exit Sub
End If

oDrgPrintMgr.ColorMode = kPrintColorPalette

oDrgPrintMgr.NumberOfCopies = 1

oDrgPrintMgr.Orientation = kLandscapeOrientation

oDrgPrintMgr.PaperSize = kPaperSizeA4

oDrgPrintMgr.PrintRange = kPrintAllSheets

oDrgPrintMgr.ScaleMode = kPrintBestFitScale
Dim pdf_pathname As String
pdf_pathname ="C:\" & drgname & ".pdf"

' Save as filename
oDrgPrintMgr.PrintToFile pdf_pathname
End If
End Sub
0 Likes
542 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
Hi.
Did you find a solution.
I've got the same problem.

BE WELL
0 Likes
Message 3 of 8

Anonymous
Not applicable
Hi.
Did you find a solution.
I've got the same problem.

Marcus
0 Likes
Message 4 of 8

Anonymous
Not applicable
Well I changed your "cutePDF Writer" with my "Win2PDF" and all worked perfect! Sounds like there's something up with your writer.
Wayne
0 Likes
Message 5 of 8

Anonymous
Not applicable
Well its working fine with my "PDF995"
but when I try to open the created pdf it is saying that the file is corrupted.
0 Likes
Message 6 of 8

Anonymous
Not applicable
Creates corrupted PDF with Adobe PDF Writer (comes with Acrobat 7).
Tried Win2PDF and it worked... That makes three that do not work and one that does...
0 Likes
Message 7 of 8

Anonymous
Not applicable
I believe the error is in the PrintToFile method of the DrawingPrintManager. Try using the SubmitPrint method instead.

AFAIK, the PrintToFile method will create a PostScript file, but you have given it a .pdf extension (which creates a "corrupted" file because it is not pdf data). Message was edited by: Josh_Petitt
0 Likes
Message 8 of 8

Anonymous
Not applicable
I think this is true... I use distiller to create the pss file and then create the PDF.
0 Likes