Hi
I am trying to print a PDF containing logos and barcodes.
I am using a Zebra PAX label printing using thermal transfer ribbon, so within its printer driver settings I have set the label size and the Graphics Dithering setting to NONE to ensure pure B&W printing.
Printing the PDF through Adobe takes note of the driver settings and prints perfectly.
Using the code below, the logo are "greyscaled" and the label doesn't fill the label, i.e. doesn't take note of the printer driver settings.
Any ideas?
private
void
btnPrint_Click(
object
sender, RoutedEventArgs e)
{
PrintSettings printSettings =
new
PrintSettings()
{
DocumentName =
"pdfLabel"
,
UseDefaultPrinter =
false
};
PrintDialog p =
new
PrintDialog();
PrintQueue q = FindPrintQueueByName(
"ZebraPAX"
);
if
(q ==
null
)
{
q = p.PrintQueue;
}
p.PrintQueue = q;
p.MinPage = 1;
p.MaxPage = 1;
this
.pdfViewer.Print(p, printSettings);
}
private
PrintQueue FindPrintQueueByName(
string
name)
{
PrintServer server =
new
PrintServer();
foreach
(PrintQueue queue
in
server.GetPrintQueues(
new
EnumeratedPrintQueueTypes[] {
EnumeratedPrintQueueTypes.Connections, EnumeratedPrintQueueTypes.Local }))
{
if
(queue.Name == name)
{
return
queue;
}
}
return
null
;
}
9 Answers, 1 is accepted
** UPDATE **
Re-installed driver - still the same.
Printed to a laserjet, still ignores the printer driver options.
Is this a bug?
Hello Andrew,
The PdfViewer printing implementation doesn't take care of the colors while printing. It uses the WPF API for printing which takes Visual and page size, which we get from the print dialog. We are passing a Visual with all the UI elements we have in the UI of the RadPdfViewer with the same colors as in the UI. We only make sure the page size and margins are correct. The WPF has its own way of respecting the printer settings for the color and we don't have control over it.
If the page you print does not fit your label, please check the size of the label in the Print dialog, because our code gets if from there, arranges the page and passes it to the WPF API.
Please let me know what is the size of your print paper, so I can test it on our end.
If your
Regards,
Nikolay Demirev
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
Hi Nikolay
The print size is not a big problem.
The main problem is the logo and the barcodes as you can see in the photo attached (telerik.png).
As a work around i'm kicking of a Process (AcroRd32.exe) and printing it silently through that, much better result (adobe.png)
Ideally i would like to keep everything in Telerik, can I load the PDF into a report viewer???
Many Thanks
Andy
Hi Nikolay
Just had a thought, you say it's the WPF way of handling the printing.Would the PDF viewer in Winforms use the printer driver settings or Blazor / Asp.NET etc???
Kind Regards
Andy
Hello Andrew,
Although the API used in WinForms is a bit different the .Net Framework is still responsible for the printing. In addition, I do not think that in both cases the printer settings can be avoided. I believe that Adobe Acrobat may scale the document a bit and this is what can cause the difference. Can you try this by printing with a 100% in Adobe and see if there is still a difference (see attached)?
I am looking forward to your reply.
Regards,
Dimitar
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
Hi Dimitar
The most important issue to us and our customer is the quality of the barcodes and logos.
As you can see in my 2 attached photos from my previous post, the barcodes are unreadable when printing via the PDF viewer, where printing via and Adobe process results in a perfect barcode which is readable.
We'll still use the viewer to display the PDF, but I think we'll go along the Adobe process route to print them.
Thanks for quick responses and help.
Kind Regards
Andy
Hi Andrew,
I have prepared a small Winforms application that you can use to print your PDF file. Can you test this with it and see if there is a difference? You can change the paper type in the code depending on the exact size.
Thank you in advance for your patience and cooperation. I am looking forward to your reply.
Regards,
Dimitar
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
Hi Dimitar
Apologies for the delay in getting back but I had other work commitments.
Yes, your WinForms app worked, it printed the barcode successfully ( the height was reduced for same reason though?) and the graphics printed fine, through the printer driver?
How does the WinForms differ from the WPF then for printing?
Many Thanks
Andy
Hi Andrew,
Although both are .NET Desktop platforms they are indeed different. In this case, the printing API provided for WinForms and WPF is completely different. I am not sure why Microsoft decided this but there is not much we can do about that.
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.