Problem with PDF printing

Good morning
I made a test project for printing a label.
I can generate the PDF and save it on file perfectly but if I try to print it the measurements change.
The label has a size of 45x52mm andif I print it by opening the file generated with Acrobat the result is perfect.


If instead I print it at runtime passing the PdfDocument to a "PdfViewerControl" object, the result is this:

I also tried to use "PdfDocumentView" to open the generated PDF file and start printing with its Print method but also in this case the label is displayed well on the monitor but printed incorrectly.

Attachment: PdfLabelTester_df65efb7.zip

5 Replies 1 reply marked as answer

DD Divya Dhayalan Syncfusion Team April 8, 2021 05:43 PM UTC

Hi CSharpino, 
   
Thanks for contacting Syncfusion support.   
 
From the given details, we tried to reproduce the issue by printing the created label with PdfDocumentView and PdfViewerControl, but the issue is not reproduced as expected. And also, we suspect the issue might because of the dimension of the printing file and we can resolve these kind of issues by using the ScalePercentage PrinterSettings, which will resize the printing content size.  
 
Please refer the below code for the same, 
// Prints the document with custom scaling.  
pdfviewer1.PrinterSettings.PageSize = PdfViewerPrintSize.CustomScale;  
// Scale percentage with the page to be resized and it is applicable only for Custom Scale. The default value is 100.  
pdfviewer1.PrinterSettings.ScalePercentage = 120; 
 
And also, please refer the below UG link to know more about ScalePercentage PrinterSettings, 
 
We request you to try the ScalePercentage PrinterSettings and let us know whether this helps to solve your issue. Kindly share some more detailed replication steps if the issue is not solved with the above solution, which will be helpful for us proceed further on this and provide you a better solution. 
 
Regards, 
Divya 



CS CSharpino April 9, 2021 07:18 AM UTC

I made the suggested change but the result is wrong.
As you can see from the photo, without changing the scale, the label is compressed on the vertical axis but stretched on the horizontal axis.
The scaling fixes the vertical axis but makes the horizontal axis problem worse.




The dimensions of the print file are correct because if I open the pdf with Acrobat and look in the file properties for the page dimensions I see 45 x 52 mm.




DD Divya Dhayalan Syncfusion Team April 13, 2021 02:58 AM UTC

Hi CSharpino, 
 
We are currently checking on this, we will update further details on 14th April 2021. 
 
Regards, 
Divya 



DD Divya Dhayalan Syncfusion Team April 14, 2021 11:40 PM UTC

Hi CSharpino, 
 
We are currently checking for the optimized solution for the query and we will update further details on 15th April 2021. 
 
Regards, 
Divya 



DD Divya Dhayalan Syncfusion Team April 15, 2021 05:10 PM UTC

Hi CSharpino, 
   
Thank you for your patience. 
 
We checked the issue with the actual size printing, but we could not be able to reproduce the issue in our end. We suspect the issue might because of any specific printer settings, however we can overcome these kind of page size issues by setting the PageSize PrinterSettings as `Fit`. So, we request you to try to print the document with the PageSize PrinterSettings as `Fit`. Please find the below code snippet for the same, 
private void Print(MemoryStream stream) 
        { 
            PdfViewerControl viewer = new PdfViewerControl(); 
            viewer.Load(stream); 
            // Prints the document with Fit PageSize.   
            viewer.PrinterSettings.PageSize = PdfViewerPrintSize.Fit; 
            viewer.Print("Microsoft Print to PDF"); 
        } 
 
And also please refer the below UG link to print a document with more options in WPF PdfViewer, https://help.syncfusion.com/wpf/pdf-viewer/printing-pdf-files 
 
Please try the above solution to resolve this issue if the issue is not resolved kindly provide us some more details about your printer and printer settings of the printer, which will be helpful for us to analyze better on this and provide you a better solution. 
 
Regards, 
Divya 


Marked as answer
Loader.
Up arrow icon