I'm trying to figure out how to rotate a PDF 90 degrees in iTextSharp, but all I can find is how to rotate it 180 degrees, like so:
PdfContentByte pcb = writer.DirectContentUnder;
int page_count = pdf_reader.NumberOfPages;
for (int z = 1; z <= page_count; z++)
{
PdfImportedPage pdf_page = writer.GetImportedPage(pdf_reader, z);
double pdfWidth = pdf_page.Width;
double pdfHeight = pdf_page.Height;
if (pdfWidth > pageWidth)
{
pcb.AddTemplate(pdf_page, -1f, 0, 0, -1f, pdfWidth, pdfHeight);
}
[...]
}
That pcb.AddTemplate line at the end is where the rotation is happening. I've tried changing the parameters, but all I've been able to do is either make the pdf page half its size, or disappear completely.
I'm running out of time to get this resolved; any assistance would be greatly appreaciated.