Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create PDF in Landscape using ITextRenderer

 
Emanuel Borsoi
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?
 
Tim Moores
Bartender
Posts: 2687
36
  • 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


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
Bartender
Posts: 2687
36
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic