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
S B Ray
NA
11
0
pdf file not being created
Apr 1 2009 3:10 AM
Dear All,
I am trying to create a pdf file for a report but it is not being created.
I am using itextsharp.dll.
The code is as given below:
Document doc = new Document(PageSize.A4);
PdfWriter.GetInstance(doc, new FileStream(filename, FileMode.Create));
doc.Open();
// create a caption for the page
Paragraph newp = new Paragraph("XYZ Report");
newp.SetAlignment("center");
doc.Add(newp);
Paragraph blp = new Paragraph("");// for adding new lines
doc.Add(blp);
Paragraph blp1 = new Paragraph("");
doc.Add(blp1);
StringBuilder stbld = new StringBuilder();
for (int i = 0; i < grdcap1.Length; i++)
{
stbld.Append(Convert.ToString(grdcap1[i]));
}
string cap = stbld.ToString();
Paragraph newcap = new Paragraph(cap);
newcap.SetAlignment("center");
doc.Add(newcap);
StringBuilder headbld = new StringBuilder();
for (int k = 0; k < grdhead1.Length; k++)
{
headbld.Append(Convert.ToString(grdhead1[k]));
}
string head = Convert.ToString(headbld);
Paragraph newhead = new Paragraph(head);
newhead.SetAlignment("left");
doc.Add(newhead);
doc.Close();
But the file is not being created. Not even a blank file.
What is the problem?
What wrong have I done?
Thanks for your reply.
Reply
Answers (
1
)
how to generate multiple form under a running thread ..
How to add icon to an exe file?