This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Create PDF in Landscape using ITextRenderer

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i'm using iText to create the PDF from Strings (HTML code). Here my code:



As you can see, i'm using org.w3c.dom.Document in order to ba able to parse a HTML code including all internal style attributes. My problem is that in this way i'm not able to create a landscape PDF. The solution would be to use com.itextpdf.text.Document and create a object using new Document(PageSize.A4.rotate()); but then it's not possible to use iTextRenderer and parse my HTML-String.

Any hints?
 
Saloon Keeper
Posts: 5865
146
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm confused. ITextRenderer is part of FlyingSaucer, but Document is part of iText. While FlyingSaucer does use iText underneath, I don't think you can mix and match classes like that.
 
Emanuel Borsoi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:I'm confused. ITextRenderer is part of FlyingSaucer, but Document is part of iText. While FlyingSaucer does use iText underneath, I don't think you can mix and match classes like that.



well...then i did a little bit of confusion.
But my problem remains. I need to create a landscape PDF parsing HTML code. Is it possible? The code you see above works, but i can't find the way to set the document format before writing to it.
 
Emanuel Borsoi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:Does this help: http://stackoverflow.com/questions/613971/both-landscape-and-portrait-for-pdf-with-flying-saucer-itext



Not really, i don't know where to put "@page land { size:landscape; }". I've tried in my css but it doesn't work.

Tim Moores wrote:First result in creating landscape pdf using flyingsaucer.



Sorry, but i thought that iTextRenderer is part iText.
 
Tim Moores
Saloon Keeper
Posts: 5865
146
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

but i thought that iTextRenderer is part iText.


Nope, part of FlyingSaucer.
 
Emanuel Borsoi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:

but i thought that iTextRenderer is part iText.


Nope, part of FlyingSaucer.



now, i've seen...

EDIT:

Once read this it became clear
 
No holds barred. And no bars holed. Except this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!