Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

How to append a page to existing pdf using asp.net,

i used the following code.
C#
Document doc = new Document();
doc.NewPage();

but old page is replacing with new content.But i need just append of data to existing pdf, i.e if the pdf contains 2 pages,if i want to add the data then 3rd page should be created and content should be fall in 3rd page only.
Posted
Updated 2-May-11 5:21am
v2
Comments
Manfred Rudolf Bihy 2-May-11 9:42am    
What library are you talking about?
Add more details please!
kirangadu 3-May-11 0:01am    
Hi..this is my function which i am using.
i am using iTextSharp namespace,
protected void Button1_Click(object sender, EventArgs e)
{
string newFile = @"C:\Mydata\t5.pdf";



iTextSharp.text.pdf.PdfReader reader = new iTextSharp.text.pdf.PdfReader(@"C:\Mydata\t5.pdf");

Document doc = new Document();

//string no = reader.NumberOfPages.ToString();
//int no2 = Convert.ToInt32(no);
iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(doc, new FileStream(newFile, FileMode.Create));

doc.Open();

for (int i = 1; i < 3; i++)
{

doc.NewPage();

doc.Add(new Paragraph(TextBox2.Text));

}

doc.Close();



}

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900