Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning 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
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

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: 5812
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: 5812
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
 
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
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!