iTextsharp landscape document

No need to initialize the Document and reset the page size...

Document doc = new Document(iTextSharp.text.PageSize.A4.Rotate(), 10, 10, 10, 10);

...will do the trick.

(4.1.6.0)


Try this

Document Doc = new Document(new Rectangle(288f, 144f), 10, 10, 10, 10);
Doc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());

you might also need this to expand a table to max width.

var _pdf_table = new PdfPTable(2); // table with two  columns
PdfPCell hc = new PdfPCell();
_pdf_table.WidthPercentage = 100; //table width to 100per
_pdf_table.SetTotalWidth(new float[] { 25, iTextSharp.text.PageSize.A4.Rotate().Width - 25 });// width of each column

You must make sure that when setting the page size you do it before a call to Doc.Open();

Regards.

Tags:

C#

Itextsharp