i am using C# with iTextSharp to rotate a page in a PDF file, for this i use this code
filname = @"C:\tr\jbklk.pdf";
using (FileStream outStream = new FileStream(filname, FileMode.Create))
{
iTextSharp.text.pdf.PdfReader reader = new iTextSharp.text.pdf.PdfReader(@"C:\tr\2.pdf");
iTextSharp.text.pdf.PdfStamper stamper = new iTextSharp.text.pdf.PdfStamper(reader, outStream);
iTextSharp.text.pdf.PdfDictionary pageDict = reader.GetPageN(2);
int desiredRot = 90; // 90 degrees clockwise from what it is now
iTextSharp.text.pdf.PdfNumber rotation = pageDict.GetAsNumber(iTextSharp.text.pdf.PdfName.ROTATE);
if (rotation != null)
{
desiredRot += rotation.IntValue;
desiredRot %= 360; // must be 0, 90, 180, or 270
}
pageDict.Put(iTextSharp.text.pdf.PdfName.ROTATE, new iTextSharp.text.pdf.PdfNumber(desiredRot));
stamper.Close();
}
this means that i have to create a new file and rotate the page in this new file is there any way to rotate the page in the same source file without creating a new file? thanks