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.

Print a pdf document usef PdfViewerControl

Thread ID:

Created:

Updated:

Platform:

Replies:

115709 Jan 31,2014 03:34 AM Feb 3,2014 03:41 AM WinRT 1
loading
Tags: General
Laurent De Cant
Asked On January 31, 2014 03:34 AM

Hi,


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;
    };
 
    pdfViewer.LoadDocument(pdfDocument);
    contentGrid.Children.Add(pdfViewer);

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?


Regards,

Laurent



print_83385939.zip

Suresh M [Syncfusion]
Replied On February 3, 2014 03:41 AM

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.

 

Thanks,

Suresh


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.

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.

;