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. Image for the cookie policy date

Print a pdf document usef PdfViewerControl


I'm using PdfViewControl to display a pdf document. Once the viewer is loaded, I set the ViewMode property to FitWidth in order to display the document in a full screen fashion.

Then, when the user clicks a button, I get the pages using GetPages method provided by PdfViewControl and add them to the PrintDocument using SetPreview method.

The problem is that the document does not occupies all the available space (see attachment) on the sheet of paper and the image is higly pixelated.

Here is the code I use to initialize the viewer:

    var pdfBytes = await file.ToBytes();
    var pdfDocument = new PdfLoadedDocument(bytes);
    pdfViewer = new SfPdfViewerControl();
    pdfViewer.Loaded += (sendere=>
        var viewer = sender as SfPdfViewerControl;
        viewer.ViewMode = PageViewMode.FitWidth;

And here is the code I use to print the document:

    var pageCount = pdfViewer.PageCount;
    var pages = pdfViewer.GetPages(0pageCount100);
    var otherPages = pdfViewer.GetPages(0pageCount300);
    _document.SetPreviewPageCount(pageCount + 1PreviewPageCountType.Final);
    var pdfDocument = pdfViewer.ItemsSource as PdfDocument;
    for (int i = 0i < pageCount + 1i++)
        _pages[i= pages[i];
        _document.SetPreviewPage(i + 1pages[i]);

Any idea?




1 Reply

SM Suresh M Syncfusion Team February 3, 2014 08:41 AM UTC

Hi Laurent,


Thank you for your interest in Syncfusion products.


Can you please provide a simple sample to reproduce the issue, that would be more helpful for us to further investigate on the issue reported.


Please let us know if you need any further assistance.




Live Chat Icon For mobile
Up arrow icon