How to generate a Pdf in Land Scape orientation from a html string using Itext 2

StackOverflow https://stackoverflow.com/questions/17529658

  •  02-06-2022
  •  | 
  •  

Domanda

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

È stato utile?

Soluzione

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.

Altri suggerimenti

I got the answer as suggested by @Bruno Lowagie

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

@page { size: A4 landscape;}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top