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

How to automatically show print dialog after export to pdf

4 Answers 223 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Imran
Top achievements
Rank 1
Imran asked on 29 Apr 2010, 10:56 PM
Hello

I am currently working on a project where it will save a lot of time if I could automatically make the adobe reader plugin to show the print dialog.

I have export to pdf working flawlessly based on the following article.

How To: Export grid to PDF file and show the result using the window
http://www.telerik.com/community/forums/aspnet-ajax/grid/export-to-pdf-and-save-programmatically.aspx

My application basically is using the resulting window to print labels.

It would be wonderful to have the adobe print dialog show up after the resulting window has opened.

On regular web pages it is rather easy using javascript, I am guessing the same javascript will need to be inserted in the created pdf, perhaps the same way as the page break can be inserted using <?hard-pagebreak?> in the grid's output, just not sure how to do it though.

Like always any leads would be highly appreciated.

Thanks
Imran

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 04 May 2010, 09:27 PM
Hello Imran,

There is no easy way to print the exported file directly. In theory, you could use this approach, but it is not guaranteed to work in all cases:
protected void Button1_Click(object sender, EventArgs e)
{
    ProcessStartInfo psi = new ProcessStartInfo();
    psi.UseShellExecute = true;
    psi.Verb = "print";
    psi.WindowStyle = ProcessWindowStyle.Hidden;
    psi.FileName = Server.MapPath("~/MyPDF.pdf");
    Process.Start(psi);
}

Regards,
Daniel
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
Imran
Top achievements
Rank 1
answered on 05 May 2010, 09:25 PM
Thanks a lot for the reply.

I tried but was not able to get the desired effect.

I am not automatically trying to print the file only to show the print dialog so that one click can be reduced.

Imran
0
Daniel
Telerik team
answered on 06 May 2010, 02:50 PM
Hello Imran,

You can create your own print preview window and then use this button to print the file but I'm afraid there is no way to invoke the default print dialog.

Kind regards,
Daniel
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
Imran
Top achievements
Rank 1
answered on 07 May 2010, 04:40 PM
Thanks tried that but it did not work.

I will keep on exploring other options.

Once again thanks for the input though.

Imran
Tags
Grid
Asked by
Imran
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Imran
Top achievements
Rank 1
Share this question
or