I am developing an application that creates a label with text and barcode using PDF API and printing through PDFViewer API. However, I cannot seem to correctly print the PDF label on a Zebra thermal printer. Below are the actual PDF label sample, print output using Acrobat Reader, and print output through PDFViewer.
PDF label output
Acrobat reader print output
PDFViewer print output
As you can see, the printing is almost OK with Acrobat reader but rotated when printed using PDFViewer. Also, I cannot seem to silently print through code, whether through a stream or by saving to PDF first. I was able to print only when pdf file was opened in PDFViewer. Below is my code for printing the label, the commented lines are for the other printing options (through a stream).
By the way, would like to ask for advice if this is the best way to implement a label designer and print it in Windows forms. I know there is a separate barcode control but printing it with text seems cumbersome.
USUthandaraja Selva Sundara Kani Syncfusion Team December 17, 2019 06:04 AM
Thanks for contacting Syncfusion support.
We are unable to reproduce the issue “Printed Document is rotated when using PdfViewerControl.Print()” with our PDF documents and provided code snippet. Kindly refer the sample in the below link which we used to reproduce the reported issue,
Please try the above suggestion and if you still face the same issue, kindly share the following details to analyze more on this and assist you a better solution,
1.PDF document used
2.Simple / Modified sample to reproduce the issue.
3.Replication procedure to reproduce the issue
4.Syncfusion product version.
6.Visual Studio version.
SASanDecember 18, 2019 01:08 AM
Sorry forgot to attach the image for the supposedly rotated print out. Please see below.
But I was able to finally get the right output. I think it has something to do with how I set the page size. I'm a bit confused with the unit used in the size settings. Is it in points or pixels? I think the page is automatically rotated if the page size settings do not fit the label size settings of the printer. Also although this is just a trivial issue, the print status dialog still is showing even though the ShowPrintStatusDialog is set to false, even with your sample. I was able to only hide the status dialog by changing the PrintController to StandardPrintController.
USUthandaraja Selva Sundara Kani Syncfusion Team December 19, 2019 09:21 AM
We are glad to hear that you have resolved the issue at your end. Please find the details below,
I think it has something to do with how I set the page size.I'm a bit confused with the unit used in the size settings.Is it in points or pixels? I think the page is automatically rotated if the page size settings do not fit the label size settings of the printer.
We need more details about the page size you mentioned. Please let us know whether you mentioned our PdfViewerControl.PrinterSettings.PageSize or Microsoft PrintDocument.DefaultPageSettings.PaperSize API. So that, it will be helpful for us to analyze on this and provide you more details.
Also although this is just a trivial issue, the print status dialog still is showing even though the ShowPrintStatusDialog is set to false, even with your sample.I was able to only hide the status dialog by changing the PrintController to StandardPrintController.
The ShowPrintStatusDialog hides the PrintStatusDialog when we use the PdfViewerControl Print methods. Please find the workable sample from below link,
The PdfViewerControl.PrintDocument exposed for customize the print in sample level. So, if we use the PdfViewerControl.PrintDocument.Print method in sample level, then we need to handle the PrintStatusDialog hiding operation in sample level as you mentioned and this is the behavior.