title: Rotate PDF page contents and not the actual page
body: <p>I have researched this and tried to rotate a single page PDF's contents. I am able to rotate the page 90, 180 or 270 degrees. I don't want to rotate the page but rather the contents.</p>
  
  <p>Here's the method I have adapted so far:</p>
  
  <pre><code>public static byte[] RotatePdf(byte[] fileBytes, int degreesClockwise)
  {
      if (degreesClockwise % 90 != 0) 
          throw new ApplicationException(string.Format("degreesClockwise must be 0, 90, 180, 360: {0}", degreesClockwise));
  
      PdfReader reader = new PdfReader(fileBytes);
      using (var fs = new MemoryStream())
      {
          PdfStamper stamper = new PdfStamper(reader, fs);
  
          PdfDictionary pageDict = reader.GetPageN(1);
          int desiredRotation = degreesClockwise; // x degrees clockwise from what it is now
          PdfNumber rotation = pageDict.GetAsNumber(PdfName.ROTATE);
          if (rotation != null)
          {
              desiredRotation += rotation.IntValue;
              desiredRotation %= 360; // must be 0, 90, 180, or 270
          }
          pageDict.Put(PdfName.ROTATE, new PdfNumber(desiredRotation));
  
          stamper.Close();
  
          return fs.ToArray();
      }
  }
  </code></pre>
  
  <p>Any suggestions would be greatly appreciated.</p>