Merge two pdf's both lanscape and portrait in to one pdf using itextsharp

Posted by Rajasekhar0544 under C# on 12/12/2013 | Points: 10 | Views : 3241 | Status : [Member] | Replies : 5
Hi,

I want to merge two pdf's (landscape and portrait) into one pdf using iTextSharp in C#.
Please help me.

Thanks,
RajSekhar.




Responses

Posted by: vishalneeraj-24503 on: 12/12/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Please refer:-
http://viralpatel.net/blogs/itext-tutorial-merge-split-pdf-files-using-itext-jar/
http://stackoverflow.com/questions/14218443/working-with-both-landscape-and-portrait-document


Rajasekhar0544, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 12/12/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
http://forums.asp.net/t/1692347.aspx
http://stackoverflow.com/questions/6029142/merging-multiple-pdfs-using-itextsharp-in-c-net
http://forums.asp.net/t/1692347.aspx?Merging+two+pdf+pages+into+one+using+itextsharp

Rajasekhar0544, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 12/12/2013 [Member] Starter | Points: 25

Up
0
Down
Hi.

You can refer
http://www.codeproject.com/Articles/20499/Merge-Landscape-and-Portrait-PDFs-using-ASP-NET

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Rajasekhar0544, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bageshkumarbagi on: 12/12/2013 [Member] Starter | Points: 25

Up
0
Down
hi,

try with this link
http://www.codeproject.com/Articles/69177/PDF-Merge
http://www.wacdesigns.com/2008/10/03/merge-pdf-files-using-c/

Thanks,
Bagesh Kumar Singh
Mark as answer if you have been satisfied

Rajasekhar0544, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ring on: 12/12/2013 [Member] Starter | Points: 25

Up
0
Down
Hello, please refer the code below, hope it helps
public static void CombineMultiplePDFs(string[] fileNames, string outFile)

{
int pageOffset = 0;
int f = 0;
Document document = null;
PdfCopy writer = null;
while (f < fileNames.Length)
{
// we create a reader for a certain document
PdfReader reader = new PdfReader(fileNames[f]);
reader.ConsolidateNamedDestinations();
// we retrieve the total number of pages
int n = reader.NumberOfPages;
pageOffset += n;
if (f == 0)
{
// step 1: creation of a document-object
document = new Document(reader.GetPageSizeWithRotation(1));
// step 2: we create a writer that listens to the document
writer = new PdfCopy(document, new FileStream(outFile, FileMode.Create));
// step 3: we open the document
document.Open();
}
// step 4: we add content
for (int i = 0; i < n; )
{
++i;
if (writer != null)
{
PdfImportedPage page = writer.GetImportedPage(reader, i);
writer.AddPage(page);
}
}
PRAcroForm form = reader.AcroForm;
if (form != null && writer != null)
{
writer.CopyAcroForm(reader);
}
f++;
}
// step 5: we close the document
if (document != null)
{
document.Close();
}
}


Rajasekhar0544, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response