-
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.