title: IText PDF document - rotate some but not all pages
body: <p>I am using the iText API for Java and am running into an issue trying to combine multiple TIFFs into a PDF.  Some are rotated, some are not.  I can't quite figure out how rotate and preserve the width/height of the page.</p>
  
  <p>This SO is helpful but only for rotating the whole document</p>
  
  <p><a href="https://stackoverflow.com/questions/17033968/itext-document-rotate-the-page">iText Document : Rotate the page</a></p>
  
  <p>Here is some code that I am using to test artificially rotating the image.  This works but cuts off the image.  For example if the original image is 1000(width)x2000(height), it will rotate it but half the image is lost, since the page size remains 1000x2000.  Hopefully this makes sense.</p>
  
  <pre><code>Image img = Image.getInstance(part);  //part is a string pointer to a file.
  Rectangle imgPageSize;
  
  if (i == 0) {// testing - rotate first page
     img.setRotationDegrees((float) 90.0); //testing
     imgPageSize = new Rectangle(img.getHeight(), img.getWidth());
  }
  
  TiffToPDF.setPageSize(imgPageSize);  // this does not work
  if (!TiffToPDF.isOpen())
     TiffToPDF.open();
  TiffToPDF.add(img);
  </code></pre>