This is a migrated thread and some comments may be shown as answers.

RadPdfViewer.Print on Windows 10 - PDF goes to "Spooling" and disappears.

3 Answers 219 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
AmitThk
Top achievements
Rank 1
AmitThk asked on 31 Aug 2015, 09:53 AM

Hello,

 We are facing this strange issue with PDFViewer.Print functionality on Windows 10 only.

Attached is the sample using latest Telerik dlls (Telerik_UI_for_WPF_2015_2_728_Dev.msi).  The problem is - once we print - it goes into the Printing queue and shows "Spooling" but does not print - rather disappears after some time. Please advise.

 

class Program
{
    /// <summary>
    /// Main method.
    /// </summary>
    /// <param name="args">The args.</param>
    [STAThread]
    static void Main(string[] args)
    {
        string fileName = "CMI9063.pdf";
        if ((args != null) && (args.Length > 0))
        {
            fileName = args[0];
        }
        // Load the PDF file.
        byte[] buffer = LoadPdfFile(fileName) ?? new byte[] { };
        using (MemoryStream stream = new MemoryStream(buffer))
        {
            PrintDialog printDialog = new PrintDialog { UserPageRangeEnabled = true };
            if (printDialog.ShowDialog() == true)
            {
                RadPdfViewer radPdfViewer = new RadPdfViewer { DefaultFormatProviderSettings = FormatProviderSettings.ReadOnDemand };
                radPdfViewer.ClearDocument();
                radPdfViewer.Document = new PdfFormatProvider(stream, FormatProviderSettings.ReadOnDemand).Import();
                radPdfViewer.Print(printDialog, PrintSettings.Default);
 
                //System.Windows.MessageBox.Show("Successfully print to \"" + printDialog.PrintQueue.FullName + "\"", "Print", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
            }
        }
    }
 
 
    private static byte[] LoadPdfFile(string filePath)
    {
        byte[] buffer;
        string folder = Directory.GetCurrentDirectory();
        if (!filePath.StartsWith(folder))
        {
            filePath = Path.Combine(folder, filePath);
        }
 
        //load from physical path
        if (File.Exists(filePath))
        {
            using (FileStream fs = new FileStream(filePath, FileMode.Open))
            {
                buffer = new byte[fs.Length];
                fs.Read(buffer, 0, buffer.Length);
            }
        }
        else
        {
            return null;
        }
 
        return buffer;
    }
}

3 Answers, 1 is accepted

Sort by
0
Nikolay Demirev
Telerik team
answered on 03 Sep 2015, 08:37 AM
Hi Amit,

There really is an issue related with the printing in Windows 10. I have been able to reproduce it. I have logged an item in our Feedback portal where you can track the progress on the matter.

I have updated your Telerik Points as a token of our appreciation for reporting the bug.

Regards,
Nikolay Demirev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Réjean
Top achievements
Rank 1
answered on 19 Oct 2016, 02:41 PM

Hi,

Is the above code snippet supposed to work when using R2 2016 SP1 DLLs?

I only get blank pages when printing (on Windows 7 and Windows 10).

Thanks,

Réjean

0
Deyan
Telerik team
answered on 24 Oct 2016, 01:04 PM
Hello Réjean,

According to the comments in the feedback the fix is included in 2016 Q1 SP1. When testing on our side with R2 2016 SP1, the documents seems to be printed correctly. We have previously seen WPF printing problems related to printer drivers. A possible solution is to try printing with version of the printer drivers and version of RadPdfViewer. 

If you still face the same issue after the software upgrade, please write again with a more detailed description of your machine setup so that we may try reproducing it on our side.

I hope this helps.

Regards,
Deyan
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
Tags
PDFViewer
Asked by
AmitThk
Top achievements
Rank 1
Answers by
Nikolay Demirev
Telerik team
Réjean
Top achievements
Rank 1
Deyan
Telerik team
Share this question
or