print to PDF with iLogic

print to PDF with iLogic

Stöcker
Contributor Contributor
3,659 Views
6 Replies
Message 1 of 7

print to PDF with iLogic

Stöcker
Contributor
Contributor

Hi,

 

we need 3of9 barcodes on our drawings and the built in pdf saver aswell as SmartInventor PDF Exporter wont save the barcode right. 

So i wrote a simple iLogic rule which gets activated via a macro by the user.

 

oPrintMgr = ThisApplication.ActiveDocument.PrintManager
pdfname = ThisDoc.FileName(False)
filePath = ThisDoc.Path
oPrintMgr.Printer = "Microsoft Print to PDF"
oPrintMgr.ColorMode = kPrintGrayScale
oPrintMgr.Orientation = kLandscapeOrientation
oPrintMgr.Scalemode = kCustomScale
oPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale
oPrintMgr.PaperSize = kPaperSizeA4
oPrintMgr.PrintToFile(filePath+"\"+pdfname+".pdf")

So far it works pretty good, except for the Colormode. It always prints the PDF file in Color. 

Anything i am missing?

 

Thanks in advance.

 

P.S.: I cant use any other PDF Printer than Microsoft PDF to print here at work.

0 Likes
Accepted solutions (1)
3,660 Views
6 Replies
Replies (6)
Message 2 of 7

chandra.shekar.g
Autodesk Support
Autodesk Support

@Stöcker,

 

 

Hoping that below iLogic code may help.

 

pdfname = ThisDoc.FileName(False)
filePath = ThisDoc.Path
Dim doc = ThisDoc.Document 
doc.SaveAs(filePath+"\"+pdfname+".pdf", True)

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 7

Stöcker
Contributor
Contributor

Hello Chandra,

 

as i wrote in my opening post, i cant use the save to pdf function because the 3of9 code is incorrect if i do so.

If i print to a PDF it works fine, except that it will print it in color and not black only.

0 Likes
Message 4 of 7

chandra.shekar.g
Autodesk Support
Autodesk Support

@Stöcker,

 

Can you please provide sample drawing file which contain 3of9 code to test? Please make sure that file is non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 5 of 7

Stöcker
Contributor
Contributor

I cannot, sorry.

 

It is nothing special, just an additional field where the partnumber gets written in a 3of9 font like this *<PartNumber*.

 

When i save the drawing as a PDF the 3of9 Code in the PDF is wierdly spaced, not in the right text height etc. When i print directly from the .idw or print as a PDF it works perfectly fine.

0 Likes
Message 6 of 7

chandra.shekar.g
Autodesk Support
Autodesk Support

@Stöcker,

 

Try the suggestions in below forum discussion.

 

https://forums.autodesk.com/t5/inventor-forum/font-bar-code-dwg-to-pdf/td-p/5514508

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 7 of 7

Stöcker
Contributor
Contributor
Accepted solution

I dont get your response sorry.

 

I do exactly what is suggested in the post you linked. The only issue i am having is that i want to print the pdf in bw and not colored.

 

 Update:

I managed to get it to print the pdf in bw

 

I changed

oPrintMgr.ColorMode = PrintColorModeEnum.kPrintGrayScale

to

oPrintMgr.AllColorsAsBlack = True

and now it works.