7

I am using this code to generate a PDF from HTML String.

ITextRenderer renderer = new ITextRenderer();
renderer.setDocumentFromString(new String(htmlString.getBytes("UTF-8")));

In table some row contains data of a very large length.Due to which the text is overflowing the PDF.I have used Word Wrap in HTML.But this is not working in PDF generated by the code. I want to know if there is any alternative in IText 2 to Word Wrap?

Or can i generate my PDF in Landscape Mode so that i could display the whole data in PDF.

Any suggestion is welcomed.

I have attached one image at following URL. http://www.mediafire.com/download/l19qa33myluaqj4/pw-4_(2).jpg

Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165
Dexter
  • 105
  • 2
  • 9

2 Answers2

15

You can set your page in landscape mode using CSS, using:

@page { size: A4 landscape;}

The page size is part of CSS 3 specification, and is supported by flying saucer.

obourgain
  • 8,856
  • 6
  • 42
  • 57
2

I got the answer as suggested by @Bruno Lowagie

We can set our page in landscape mode using CSS, using:

@page { size: A4 landscape;}
Dexter
  • 105
  • 2
  • 9