Hi ,
Below is the code .
Here LOC.i where i can be any number between 15 to 40 is the control name . temp2.pdf is my template2
new2 is my template1
and news.pdf is my output file .
i am really not sure why this is happening .is this because of the same control names repeated for all the sheets
please let me know asap where i made a mistake,
below is my code.
for (int i = 0; i < intPages; i++)
{
Form formpdf = new Form(@"D:\docs\secondpage.pdf", @"D:\docs\temp2.pdf");
if (i != intPages - 1)
{
for (int j = 15; j < 40; j++)
{
count++;
formpdf.FillField("LOC" + "." + j, "jairam" + count);
}
}
else
{
for (int j = 15; j < 15 + remainder; j++)
{
count++;
formpdf.FillField("LOC" + "." + j, "jairam" + count);
}
}
formpdf.Save();
mergepdf();
}
public void mergepdf()
{
PdfFileEditor editor = new PdfFileEditor();
string inFile1 = @"D:\docs\new2.pdf";
string inFile2 = @"D:\docs\temp2.pdf";
//Creating output stream object that will store the resulting PDF file after appending
string outFile = @"D:\docs\news.pdf";
FileStream outputStream = new FileStream(outFile, FileMode.Create);
//Creating stream objects holding the PDF files in Open Mode
FileStream inStream1 = new FileStream(inFile1, FileMode.Open);
FileStream inStream2 = new FileStream(inFile2, FileMode.Open);
//Calling Append method and providing five arguments
editor.Append(inStream1, inStream2, 1, 1, outputStream);
//Closing output stream
outputStream.Close();
inStream1.Close();
inStream2.Close();
File.Delete(@"D:\docs\new2.pdf");
File.Copy(@"D:\docs\news.pdf", @"D:\docs\new2.pdf");
File.Delete(@"D:\docs\news.pdf");
inStream1.Dispose();
inStream2.Dispose();
outputStream.Dispose();
//open the source file and append the page to the file
}