Using RadPdfViewer (Q2 Release) in our project to show PDF documents / Reports for viewing and printing purposes.
There is a requirement to print the PDF file without showing the document and the Print Dialog, could we achieve printing of PDF document through RadPdfViewer control by setting the Visibility to Hidden mode and execute Print Command.
What settings are to be used for Printing silently through RadPdfViewer (without a Print Dialog).
Are there any other functions / Rad Controls to print a PDF document
Regards,
Phani.
12 Answers, 1 is accepted
This code is enough to print the document of RadPdfViewer with the default printer, without showing the PrintDialog:
this
.viewer.Print(
new
PrintSettings(
"Document 1"
,
true
));
There is no other control that can be used to print PDF documents.
All the best,
the Telerik team
Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.
Thank you Kammen ,
Used the below same code and tested, it works without any issues when the Default Printer is virtual drive (like XPS, One Note, etc..)
Nothing is printed when the Default Printer is set to Actual Printer Drive...
Below are the code snippets that I have been testing with
.xaml
<telerik:RadPdfViewer Name="radPDFViewer" Height="0" />
.cs
radPDFViewer.DocumentChanged += radPDFViewer_DocumentChanged;
radPDFViewer.DocumentSource =
new PdfDocumentSource(new System.Uri(labelFileName, UriKind.Absolute), FormatProviderSettings
.ReadAllAtOnce);
void radPDFViewer_DocumentChanged(object sender, EventArgs e)
{
radPDFViewer.Print(new Telerik.Windows.Documents.Fixed.Print.PrintSettings(labelFileName, true));
}
Were there any issues with the above code in order to fire the Print to actual printer drive.
Also could you let me know whether there is an ability to provide the printer name in PDFViewer/Print Settings to always direct printing to a specific printer...
Regards,
Phani,
Created a RadWindow to show the PDF Viewer, added a print Button in the toolbar which is binded to the Print command.
Print function works on Virtual Drive XPS, but does not print to Actual Printer Drives.(Xerox printers).
Printing does not work whether the Dialog is shown or hidden.
I am trying to understand whether there is any issue with the PDF Viewer and does not support printing to some of the Printers...?In that case should I look into alternate option for showing PDF documents and printing?
The Printers I am testing on are
XEROX Phaser 6250
XEROX Phaser 6820N
Any feedback would be appreciated.
Regards,
Phani.
It is due to the User once impersonated does not have access to the printers...
Currently I am managing through some functions to temporarily set the required Printer as Default Printer.
Just wanted to check whether there is provision to supply the Printer Name to the Printing Functions.
Thank you & Regards,
Phani.
RadPdfViewer can only print silently with the default printer as this is the default WPF behavior. Setting the printer name when printing is not a trivial task and is not recommended since the printer can be offline or out of order.
That is why we do not plan to support silent printing with printer that is not default one.
Kammen
the Telerik team
Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.
Thanks for the update.
Regards,
Phani.
Thanks,
Brad
We are not sure what was Phani's solution, but we have not come up with a workaround in this regard. However, we are taking under consideration the implementation of this feature for one of our future releases.
Let us know if you have other questions.
Regards,
Petya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Is there somewhere a PIT entry for this? So I can vote for it!
Here you can find the PITS Issue: Public URL
Regards,
Kammen
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
We want to print PDF document show in RadPdfViewer (WPF) silently. We are able to print the document but unable to specify number of copies to be printed.
How can we specify number of copies while printing PDF document?
PrintSettings class doesn't have any parameter related to number of copies.
this.pdfViewer.Print(printDlg, new PrintSettings(this.Header.ToString(), true));
Hi Ankesh,
You should pass the print dialog when calling the print method. Here is an example:
FileStream fs= new FileStream(@"..\..\lorem.pdf", FileMode.Open);
PdfFormatProvider provider = new PdfFormatProvider(fs);
RadPdfViewer pdfViewer = new RadPdfViewer();
pdfViewer.Document = provider.Import();
PrintSettings settings = new PrintSettings();
PrintDialog dialog = new PrintDialog();
dialog.PrintTicket.CopyCount = 2;
pdfViewer.Print(dialog, settings);
I hope this helps. Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik