We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Designing a label in pdf and printing to a Zebra thermal printer

Thread ID:

Created:

Updated:

Platform:

Replies:

149980 Dec 17,2019 12:53 AM UTC Dec 19,2019 02:21 PM UTC WinForms 3
loading
Tags: PdfViewer
San
Asked On December 17, 2019 12:53 AM UTC

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).

private void PrintBarcode()
        {
            // Initialize print dialog.
            viewer.Load(Application.StartupPath + @"\barcode.pdf");
            //viewer.Load(stream);
            viewer.PrintDocument.DocumentName = "BG Label";
            //viewer.PrintDocument.Print();
            viewer.Print(false);
            //stream.Dispose();
        }

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.

Uthandaraja Selva Sundara Kani [Syncfusion]
Replied On December 17, 2019 11:04 AM UTC

Hi San, 
 
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, 
 
 
Note: In the sample, we have added the code snippet to view the PDF document using Stream. 
 
However, you can customize the Orientation and Size of the printed PDF document using PdfViewerControl.PrinterSettings API. Please find the UG documentation from below link, 
 
 
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.     
5.            .Net Framework     
6.            Visual Studio version.     
7.            Operating System     
 
Regards, 
Uthandaraja S 


San
Replied On December 18, 2019 06:08 AM UTC

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.  

Uthandaraja Selva Sundara Kani [Syncfusion]
Replied On December 19, 2019 02:21 PM UTC

Hi San, 
 
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. 
 
 
Regards, 
Uthandaraja S

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon