how to change page landscape in iTextSharp.text.pdf

Last Reply on May 10, 2016 02:01 AM By Shashikant

Posted on May 10, 2016 01:59 AM


First of all, I thank you for your below code that I am using in my project

Generate (Create) PDF and send as email attachment in ASP.Net"

It is working fine.

pls advice me how to change page landscape. Currently it is portrait

Dim pdfDoc As New Document(PageSize.A4, 10.0F, 10.0F, 10.0F, 0.0F)

Pls advice me



Posted on May 10, 2016 02:01 AM


Please refer below code.


Document Doc = new Document(new Rectangle(288f, 144f), 10, 10, 10, 10);

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 });

also you can refer below link

I hope this will help you out.