Forum guidelines
  • Home
  • »
  • .NET General
  • »
  • How to convert string to System.Drawing.Printing.PrintDocument?
AuthorQuestion
How to convert string to System.Drawing.Printing.PrintDocument?
Posted By swathi on 12 Jul 2010
Hi I have been working on C sharp for sometime now and I am stuck with a problem in my code. My requirement is when I choose to print a document, it has to open in a preview pane automatically. This program automatically generates PDF documents and this has to be opened in the preview pane. I have the path to this PDF file. Now when I try to Preview it using PrintPreviewDialog and when I give this path to the Document name, it says it cannot implicitly convert string to System.Drawing.Printing.PrintDocument.

How do I do this? I am in a fix. Any help would be highly appreciated. Thanks in advance.

Regards,
Swathi

AuthorReply
Re: How to convert string to System.Drawing.Printing.PrintDocument?
Posted By Arshad on 13 Jul 2010  

Hi there,
Just go through the below link, might be helpfull for you.
http://ondotnet.com/pub/a/dotnet/2002/06/24/printing.html
 
Regards,
Arshad

Re: How to convert string to System.Drawing.Printing.PrintDocument?
Posted By swathi on 13 Jul 2010  
Hi Arshad,

Thank you for replying back. I have gone through the link you have posted. The program posted in the link uses Print Dialogs and Graphics class.. But in my program 

I have a path to the file that has to printed. I am not able to understand how I can assign it to the Print Document variable. I should not use print dialogs in 

my program. It should be completely automated. Kindly let me know if you know of any solution to this and Thanks once again for the link. 

Regards,
Swathi

SPONSORED BY

Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.