Printing Drawings using DrawingPrintManager

Printing Drawings using DrawingPrintManager

Raider_71
Collaborator Collaborator
499 Views
5 Replies
Message 1 of 6

Printing Drawings using DrawingPrintManager

Raider_71
Collaborator
Collaborator

Hi, I have gone through the posts about this topic but can't seem to find a solution to my issue. I am using the DrawingPrintManager object to print my drawings. Things appear to work fine but certain things don't work. For instance, one customer has a "Konica Minolta Bizhub C224e" printer with a Tray 1 A3, Tray 2 A4 & Manual feed. I have tried setting the PaperSize and PaperSource properties but no matter what I use, it keeps printing to A4.

Does anyone have any ideas or pointers for me here? Surely there must be a way to control this or is there just something silly I am missing?

 

For the PaperSize property, I use the enum as required, like in "PaperSizeEnum.kPaperSizeA3" for example.

 

For PaperSource I use the following which I found online:

 

// <summary>The upper bin of a printer (or the default bin, if the printer only has one bin).</summary>
    Upper = 1,
    /// <summary>The lower bin of a printer.</summary>
    Lower = 2,
    /// <summary>The middle bin of a printer.</summary>
    Middle = 3,
    /// <summary>Manually fed paper.</summary>
    Manual = 4,
    /// <summary>An envelope.</summary>
    Envelope = 5,
    /// <summary>Manually fed envelope.</summary>
    ManualFeed = 6,
    /// <summary>Automatically fed paper.</summary>
    AutomaticFeed = 7,
    /// <summary>A tractor feed.</summary>
    TractorFeed = 8,
    /// <summary>Small-format paper.</summary>
    SmallFormat = 9,
    /// <summary>Large-format paper.</summary>
    LargeFormat = 10, // 0x0000000A
    /// <summary>The printer's large-capacity bin.</summary>
    LargeCapacity = 11, // 0x0000000B
    /// <summary>A paper cassette.</summary>
    Cassette = 14, // 0x0000000E
    /// <summary>The printer's default input bin.</summary>
    FormSource = 15, // 0x0000000F
    /// <summary>A printer-specific paper source.</summary>
    Custom = 257, // 0x00000101

 

I really appreciate any help you can provide.

 

Pieter

 

0 Likes
Accepted solutions (1)
500 Views
5 Replies
Replies (5)
Message 2 of 6

Michael.Navara
Advisor
Advisor
Accepted solution

I don't know where you get the values for your printer, but you can use this rule to obtain valid values for each installed printer. Variable sourceId is what are you looking for.

 

AddReference "System.Drawing.dll"

Logger.Debug("-----------")
For Each printerName As String In System.Drawing.Printing.PrinterSettings.InstalledPrinters
	Logger.Debug(printerName)

	Dim ps As New System.Drawing.Printing.PrinterSettings()
	ps.PrinterName = printerName

	For Each paperSource As System.Drawing.Printing.PaperSource In ps.PaperSources

		Dim sourceName As String = paperSource.SourceName
		Dim sourceId As Integer = paperSource.RawKind

		Logger.Debug("{0} - ({1})", sourceName, sourceId)
	Next
	Logger.Debug("-----------")
Next

 

Message 3 of 6

Raider_71
Collaborator
Collaborator

Hi Michael, thanks for the feedback I will give it a go and let you know.

 

Much appreciated!

 

P

0 Likes
Message 4 of 6

Raider_71
Collaborator
Collaborator

Hi @Michael.Navara 

 

I have built a very basic printing function which, on my end, seems to work but I only have a small HP laserjet printer. I set it to the default tray and then I set it to Manual Feed. It seems to work as expected but the person I am trying to do this for is having issues and he says there is no difference when he changes the paper source on his side.

 

I am not sure if you have a more "complex" printer that side you can test this on?

 

VB.Net Solution attached.

0 Likes
Message 5 of 6

Michael.Navara
Advisor
Advisor

I tested your application on our office printer "HP LaserJet 500 color MFP M570 PCL6 Class Driver" and it works as expected. There is only one possible issue on our printer, there is no option to force manual source. When the manual source is empty the default one is used.

MichaelNavara_0-1723449785801.png

 

0 Likes
Message 6 of 6

Raider_71
Collaborator
Collaborator

Thanks for confirming @Michael.Navara 

0 Likes