Thanks, everyone, for your suggestions.
I solved it on my own. I just treated the input PDF file before signing.
The 100% working for me. Now the signature is showing on multiple pages horizontally.
If anyone is also facing the same issue, take the reference from the code.
string src = @"C:\Test\inputFile.pdf";
string dest = @"C:\Test\OutFile.pdf";
var reader = new PdfReader(src);
using (var fs = new FileStream(dest, FileMode.Create, FileAccess.Write))
{
// Create a new document. We'll set page size for each page individually.
var doc = new Document();
PdfWriter writer = PdfWriter.GetInstance(doc, fs);
doc.Open();
for (int i = 1, loopTo = reader.NumberOfPages; i <= loopTo; i++)
{
// Get page size with rotation applied (so width/height match visual)
iTextSharp.text.Rectangle pageRect = reader.GetPageSizeWithRotation(i);
// Use that as the new page size so orientation is preserved
doc.SetPageSize(new iTextSharp.text.Rectangle(pageRect.Width, pageRect.Height));
doc.NewPage();
// Import the page from the source
PdfImportedPage imported = writer.GetImportedPage(reader, i);
PdfContentByte cb = writer.DirectContent;
// Get original rotation (0, 90, 180, 270)
int rot = reader.GetPageRotation(i) % 360;
// Add the imported page with a transform that cancels the rotation
switch (rot)
{
case 90:
{
// rotate -90 (or counter-rotate) so content appears same but writer page has no /Rotate
cb.AddTemplate(imported, 0, -1, 1, 0, 0, pageRect.Height);
break;
}
case 180:
{
cb.AddTemplate(imported, -1, 0, 0, -1, pageRect.Width, pageRect.Height);
break;
}
case 270:
{
cb.AddTemplate(imported, 0, 1, -1, 0, pageRect.Width, 0);
break;
}
default:
{
// no rotation, normal placement
cb.AddTemplate(imported, 1, 0, 0, 1, 0, 0);
break;
}
}
}
doc.Close();
writer.Close();
}
reader.Close();