dont have a before print Event Triggers 😉
i want to make a rule with automatic print with a right sheet size, but in all my try dont work 😞
that is my last one
'Dim oDraw As Document
oDraw = ThisApplication.ActiveDocument
oDrawDoc = ThisApplication.ActiveDocument
oDrgPrintMgr = oDrawDoc.PrintManager
oDrgPrintMgr.PrintRange = kPrintAllSheets
oDrgPrintMgr.AllColorsAsBlack = False
oDrgPrintMgr.ScaleMode = kPrintBestFitScale 'oDrgPrintMgr.ScaleMode = kPrintModel
'Printer setup, default printer
oPrintMgr = ThisApplication.ActiveDocument.PrintManager
oPrintMgr.ColorMode = kPrintDefaultColorMode
oPrintMgr.Orientation = kLandscapeOrientation
oPrintMgr.PaperSize = SizeActiveSheet
oPrintMgr.SubmitPrint
Sorry for my horrible english again and thanks for your help!
another test
'impression
Dim oDraw As Document
oDraw = ThisApplication.ActiveDocument
oDrawDoc = ThisApplication.ActiveDocument
oDrgPrintMgr = oDrawDoc.PrintManager
question = MessageBox.Show("IMPRESSION DE LA PAGE ACTIVE?", "PRINT MANAGER",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
nombredecopie = InputBox("COMBIEN DE COPIE", "PRINT MANAGER", "1")
If Cancel
Return
Else If question = vbNo Then
oDrgPrintMgr.PrintRange = kPrintAllSheets
oDrgPrintMgr.AllColorsAsBlack = False
oDrgPrintMgr.ScaleMode = kPrintBestFitScale
'oDrgPrintMgr.ScaleMode = kPrintBestFitScale
oPrintMgr = ThisApplication.ActiveDocument.PrintManager
oPrintMgr.ColorMode = kPrintDefaultColorMode
oPrintMgr.Orientation = kLandscapeOrientation
oPrintMgr.PaperSize = kPaperSizeB
oPrintMgr.SubmitPrint
Return
Else If question = vbYes Then
oDrgPrintMgr.PrintRange = kPrintCurrentSheet
oDrgPrintMgr.AllColorsAsBlack = False
oDrgPrintMgr.ScaleMode = kPrintBestFitScale
'oDrgPrintMgr.ScaleMode = kPrintBestFitScale
oPrintMgr = ThisApplication.ActiveDocument.PrintManager
oPrintMgr.ColorMode = kPrintDefaultColorMode
oPrintMgr.NumberOfCopies = nombredecopie
oPrintMgr.Orientation = kLandscapeOrientation
oPrintMgr.PaperSize = kPaperSizeB
oPrintMgr.SubmitPrint
End If
Hi,
I am struggling to understand your question, but the following code works well at my side. Could you take a look if it helps?
Dim oDrawDoc As Document oDrawDoc = ThisApplication.ActiveDocument Dim oPrintMgr As PrintManager oPrintMgr = oDrawDoc.PrintManager 'specify your printer name oPrintMgr.Printer = "\\cnbeipdwccmss01\BEIPRN002" oPrintMgr.ColorMode = kPrintDefaultColorMode oPrintMgr.Orientation = kLandscapeOrientation oPrintMgr.PaperSize = SizeActiveSheet oPrintMgr.SubmitPrint
Xiaodong,
I found this thread when doing a search. I am trying to create an iLogic rule to print to my default printer.
This is what I have and the errors that show up.
Can you tell me what I am missing and how to make it work?
Thanks
Inventor Suite 2012
Windows 7
Hi Cadmanto,
I didn't test it, but I think you want to use:
kPrintBestFitScale rather than Best Fit
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi Curtis,
I tried that and I am still getting this error message.
Here is what my code looks like. Can you tell if there is anything that doesn't look right?
Inventor Suite 2012
Windows 7
Hi Cadmanto,
I don't see the code listed just the error message, but here's a snippet to try. I tested this with my printer name and it works.
Note: please check your printer name for accuracy, in case I've retyped it incorrectly.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim oDrawDoc As Document oDrawDoc = ThisApplication.ActiveDocument Dim oPrintMgr As PrintManager oPrintMgr = oDrawDoc.PrintManager
Dim sMyPrinter As String
sMyPrinter = "KONICA MINOLTA 423SeriesPCLFiltration" oPrintMgr.Printer = sMyPrinter oPrintMgr.ColorMode = kPrintDefaultColorMode oPrintMgr.Orientation = kLandscapeOrientation oPrintMgr.Scale = kPrintBestFitScale
oPrintMgr.PaperSize = kPaperSizeB
oPrintMgr.SubmitPrint
Sorry Curtis. I forgot to include the screen shot. I have since modified it as per your suggestions and I am still getting the same error.
Inventor Suite 2012
Windows 7
Hi Cadmanto,
hmmm, I'm not sure what would be the issue.
As a test can you comment out the Printer line as such:
' oPrintMgr.Printer = sMyPrinter
The printer used should then just be the last used printer. This will test to see if the problem concerns the printer name or some other line in the snippet.
Another thought would be to change the paper size line to:
Hi Cadmanto,
Are you still having this issue? I agree with what Curtis_Waguespack shared. One more I'd suggest is you could try with other printer e.g. PDF to see if this problem occurs.
Yes, I am still having the issue. I at the moment have moved away from it. I already have one that works for pdf, so I have tried that. Thanks for the suggestion. I did try what Curtis suggested, but at this point I am thinking this has something to do with how our network code to that printer is setup.
Usually things like this are something very simple.
Inventor Suite 2012
Windows 7 Professional
Intel (R) Xeon (R) CPU 3.47 GHz
12.0 GB Memory, 64 bit OS
Scott, Where did you get your printername from?
When i copy my name from the standard print option from within Inventor and use this in the code for me it's working
So i use this code sMyPrinter = "\\SERVER001\7525_Boven"
See also post 3 from xiaodong.liang for code that works.
Rob.
Hi Rob,
I originally got the printer name from the printer properties inside of control panel.
I tried what you suggested and it appears it has moved on from the printer name.
Now it is hanging up on the "Original Size".
These are the options in print manager.
and here is what I have so far in the code.
Inventor Suite 2012
Windows 7 Professional
Intel (R) Xeon (R) CPU 3.47 GHz
12.0 GB Memory, 64 bit OS
oPrintMgr.OriginalSize is no option for the printer API. You did used oPrintMgr.PaperSize before in your code you posted here. That's the right option to set the size of the printerpaper. See also the post from Curtis where he wrote this:
oPrintMgr.PaperSize = kPaperSize11x17
Rob,
I have been playing with this all afternoon. I have been going through this thread trying all kinds of variations that have been suggested here. In my experimenting I have figured out that the "oPrintMgr.PaperSize" is the way to go.
Since I last posted I have at least gotten the rule to send to the printer. Now the problem is it is coming out on letter size. Even though I have specified both the "Bsize" and 11x17 and everytime I run the rule I get this message now.
Thanks for the suggested links. I will check them out.
Inventor Suite 2012
Windows 7 Professional
Intel (R) Xeon (R) CPU 3.47 GHz
12.0 GB Memory, 64 bit OS
Rob,
I found the segment under the help, and I tried what they suggested (which was close to what I had), but it still printed out the 11 x 17 drawing on letter size. I even went as far as commenting out this line and got the same result with the same error message as I posted in the last posting.
Kind of makes me wonder if this code line is even beeing recognized by the rule/printer.
This is what I got so far.
Inventor Suite 2012
Windows 7 Professional
Intel (R) Xeon (R) CPU 3.47 GHz
12.0 GB Memory, 64 bit OS
It looks like the Inventor information isn't right. You need to use the PaperSizeEnum. before the papersize name or find the Value for the papersize format.
This is the way it works on my printer.
oPrintMgr.PaperSize = PaperSizeEnum.kPaperSizeA3
or
oPrintMgr.PaperSize = 14340
You can find this information in the Api help under: PaperSizeEnum Enumerator
A part of this page:
kPaperSize10x14 | 14337 | Paper size for 10x14. |
kPaperSize11x17 | 14338 | Paper size for 11x17. |
kPaperSizeA0 | 14357 | Paper size for ISO A0 (Applicable to drawings only). |
kPaperSizeA0Oversize | 14358 | Paper size for ISO A0 Oversize (Applicable to drawings only). |
kPaperSizeA1 | 14359 | Paper size for ISO A1 (Applicable to drawings only). |
Rob.
Rob,
I actually thought you might have been on to something. As it turns out it gives me the same error message as I have been getting. I still get a print on an "A" size showing the middle of the 11 x 17 drawing. I tried both the code and the text string based on what you suggested. from the API portion of the help.
I will continue to play with this trying different combinations.
Thanks again for your help.
Inventor Suite 2012
Windows 7 Professional
Intel (R) Xeon (R) CPU 3.47 GHz
12.0 GB Memory, 64 bit OS
Ragnar111 to use the BestFitScale you first need to set the Scalemode to kCustomScale.
And than use PrintScaleModeEnum before the print scale.
Hope this works for you.
Rob.
oPrintMgr.Scalemode = kCustomScale oPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale