TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Javier
NA
7
7.3k
Create a PDF report
Jun 13 2011 10:09 PM
I created a printDocument object that prints out a report. It works fine. This is the OnPrintPage event handler:
private void OnPrintPage(object sender, PrintPageEventArgs e)
{
if (page == 2)
{
Header(e);
Page2(e);
}
else
{
Header(e);
Page1(e);
}
}
I want to create a PDF of the same document. This is the code:
SaveFileDialog sfd = new SaveFileDialog();
sfd.Title = "Create PDF";
sfd.Filter = "(*.pdf)|*.pdf";
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.Paragraph(printDocument));
doc.Close();
}
This doesn't work. Can you please help me to identify the problem and find a solution? Thank you.
Reply
Answers (
2
)
ASP.net Data list Control
Recover users password by asking the for their email id