|
-
June 15th, 2011, 01:31 PM
#1
Create PDF of a document
I have a printDocument object that creates a document using GDI for printing. It works fine and I can print it out and I can print preview it. Now I want to create a PDF with this document. This is the code that I have:
SaveFileDialog sfd = new SaveFileDialog();
if (sfd.ShowDialog() == DialogResult.OK)
{
iTextSharp.text.Document doc = new iTextSharp.text.Document();
PdfWriter.GetInstance(doc, new FileStream(sfd.FileName, FileMode.Create));
doc.Open();
doc.Add(new iTextSharp.text.Document(printDocument));
// Here there's an error message about invalid arguments
// How can I tell the program to use the document already created, without recreating the document here again?
doc.Close();
}
Thank you.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|