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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

PDF printing: stretched document on real printers

Thread ID:

Created:

Updated:

Platform:

Replies:

117188 Sep 1,2014 09:47 AM UTC Oct 24,2018 10:27 PM UTC Windows Forms 1
loading
Tags: PdfViewer
Luca Cavicchioli
Asked On September 1, 2014 09:47 AM UTC

Hello, I've got some problems printing PDF documents through PdfViewer:
When I print my document on a virtual printer (like Foxit PDF printer or Adobe Pdf virtual printer) it seems to be everything correct (see attachment "LabelCorrect.pdf") when I try to print the same document with any real printer the document appears stretched to fit the entire space on the page (see attachment "LabelWrong.pdf").
Note that I set the page size (in this case 100mm x 100mm) because these document have to be printed both on a Label Printer (with 100x100mm labels as paper) and on regular A4 laser printers but I'm obtaining the same results even if I don't set anything.
What I expect is to have the same visual results on both printers. Any suggestion?

The code I use to create the label and print it is:

// creates of PDF document an load it into PDFViewer
var pdfStream = new Drawer().GetPDFStream([...]); // Do some stuff to read from database and create a PDFStream
var pdfDocument = new PdfLoadedDocument(pdfStream);
pdfViewer.Load(pdfDocument);
[...]


private void tsBtnPrint_Click(object sender, EventArgs e)
{
PrintDialog dialog = new PrintDialog();
dialog.ShowDialog();
if (string.IsNullOrEmpty(dialog.PrinterSettings.PrinterName))
return;

var pageWidth = Convert.ToInt32([Label_Width] * Helpers.Mm2HundredthInches);
var pageHeight = Convert.ToInt32([Label_Height] * Helpers.Mm2HundredthInches);

var pageSettings = new PageSettings
{
PaperSize = new PaperSize("Custom", pageWidth, pageHeight),
};

pdfViewer.PrintDocument.PrinterSettings.FromPage = 1;
pdfViewer.PrintDocument.PrinterSettings.ToPage = pdfViewer.PageCount;
pdfViewer.PrintDocument.PrinterSettings.PrinterName = dialog.PrinterSettings.PrinterName;
pdfViewer.PrintDocument.PrinterSettings.Copies = 1;
pdfViewer.PrintDocument.DefaultPageSettings = pageSettings;
pdfViewer.PrintDocument.PrintController = new StandardPrintController();
pdfViewer.PrintDocument.Print();
}

Thank you
   Luca Cavicchioli




Attachment: Labels_86e2207c.zip

Parthipan R [Syncfusion]
Replied On September 2, 2014 11:44 AM UTC

Hi Luca,

Thank you for interested in Syncfusion Products.

We are able to reproduce this issue and we have logged an issue report on this. As per our forum regulation, we will not be able to share the fix for the issue through forum. However, if you are interested in receiving this fix then, we would request you to use our Direct-Trac Support system to get the fix for this issue and resolve all your technical queries. For more details, please login into http://www.syncfusion.com/Account/ and we will be happy to help you.

Please let us know in case of any queries.

 

Regards,

Parthipan.


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.

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

;