Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

DeterminingText Orientation

 
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an application that is displaying PDFs to users. I discovered that some of the PDFs need to rotated to landscape mode to display properly. No problem. I used the iText library to intercept these PDF types and rotate all the pages 90 degrees. Now I have discovered that one of the PDF types supplied to my application needs to have, for example, pages 1&2 displayed in portrait mode and pages 3 thru 5 in landscape mode, i.e. only 3 thru 5 need to be rotated. I thought I could handle this by checking the PageSize width in relation to height but all pages return 612.0 by 792.0. Is there some other way of determining text orientation on a PDF page using the iText library?
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this code, which gives you the mediabox for a page. Those dimensions will reflect the orientation.
 
Jay Damon
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ulf. Unfortunately, your code does not seem to work either. I neglected to mention in my original post that, due to vendor issues, I am stuck using iText 1.3. I think you expected I would get a PdfRectangle object using your code. In fact, I got a PdfArray object. The data is in the array object at elements 2 & 3 but is still incorrect.
reply
    Bookmark Topic Watch Topic
  • New Topic