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

PDF Viewer Printing in Hidden Mode & Silently

12 Answers 1132 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Phani Kumar
Top achievements
Rank 1
Phani Kumar asked on 12 Sep 2012, 08:38 PM
Hi ,



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

Sort by
0
Kammen
Telerik team
answered on 13 Sep 2012, 11:11 AM
Hello Phani,

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,

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.

0
Phani Kumar
Top achievements
Rank 1
answered on 13 Sep 2012, 07:23 PM

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,

 

 

 

0
Phani Kumar
Top achievements
Rank 1
answered on 14 Sep 2012, 02:25 PM
Any updates on this?



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.







0
Phani Kumar
Top achievements
Rank 1
answered on 14 Sep 2012, 07:13 PM
I got it working, there is no issue in printing PDF documents with RadPDFViewer on Xerox printers.

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.

0
Kammen
Telerik team
answered on 17 Sep 2012, 12:20 PM
Hello Phani Kumar,

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.

All the best,
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.

0
Phani Kumar
Top achievements
Rank 1
answered on 17 Sep 2012, 01:10 PM
Alright, at the moment as mentioned I have an alternate solution and do not find any issues regarding this.

Thanks for the update.



Regards,

Phani.



0
Bradley
Top achievements
Rank 1
answered on 11 Apr 2013, 03:24 PM
Has Telerik implemented anything since the last post to allow this? If not do you wish to share your alternate solution to printing the pdf?

Thanks,
Brad
0
Petya
Telerik team
answered on 16 Apr 2013, 12:26 PM
Hi 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.

0
Mi
Top achievements
Rank 1
answered on 23 Apr 2013, 09:14 AM
Hi! 

Is there somewhere a PIT entry for this? So I can vote for it!
0
Kammen
Telerik team
answered on 23 Apr 2013, 02:28 PM
Hi,

Here you can find the PITS Issue: Public URL

Regards,
Kammen
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ankesh
Top achievements
Rank 1
answered on 04 Aug 2020, 04:36 AM

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));

 

0
Dimitar
Telerik team
answered on 04 Aug 2020, 10:13 AM

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

Tags
PDFViewer
Asked by
Phani Kumar
Top achievements
Rank 1
Answers by
Kammen
Telerik team
Phani Kumar
Top achievements
Rank 1
Bradley
Top achievements
Rank 1
Petya
Telerik team
Mi
Top achievements
Rank 1
Ankesh
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or