Example
I have found a solution and have no time to upload it to share with you,
Itextsharp is used.
/// <Summary>
/// Merge PDF files
/// </Summary>
/// <Param name = "lstfiles"> list of files to be merged </param>
/// <Returns> </returns>
Private bool mergepdf (list <string> lstfiles)
{
Bool breturn = false;
Try
{
Int F = 1;
Pdfreader reader = new pdfreader (lstfiles [f]);
Int n = reader. numberofpages;
Document document = new document (reader. getpagesizewithrotation (1 ));
Using writer = Using writer. getinstance (document, new filestream (lstfiles [0], filemode. Create ));
Document. open ();
Required contentbyte cb = writer. directcontent;
Pdfimportedpage;
Int rotation;
While (F <lstfiles. Count)
{
Int I = 0;
While (I <n)
{
I ++;
Document. setpagesize (reader. getpagesizewithrotation (I ));
Document. Newpage ();
Page = writer. getimportedpage (reader, I );
Rotation = reader. getpagerotation (I );
If (rotation = 90 | rotation = 270)
{
CB. addtemplate (page, 0,-1f, 1f, 0, 0, reader. getpagesizewithrotation (I). Height );
}
Else
{
CB. addtemplate (page, 1f, 0, 0, 1f, 0, 0 );
}
}
F ++;
If (F <lstfiles. Count)
{
Reader = new pdfreader (lstfiles [f]);
N = reader. numberofpages;
}
}
Document. Close ();
Breturn = true;
}
Catch
{
Breturn = false;
}
Return breturn;
}
}