Click here to Skip to main content
15,881,867 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hello All,

I am generating pdf using Itextsharp...

In this I am getting predefined page sizes like below... But I need to set customized page size.

Please suggest how to set customized page size using Itextsharp or any other.

C#
var doc = new Document(PageSize.A5);


Thanks in advance.

Regards,
Naveen
Posted

Page size is also have type Rectangle. So you can define your own rectangle size in that.

C#
var pgSize = new iTextSharp.text.Rectangle(myWidth, myHeight);
var doc = new iTextSharp.text.Document(pgSize, leftMargin, rightMargin, topMargin, bottomMargin);
 
Share this answer
 
Comments
NaVeN Kumar 17-Jul-13 2:10am    
Thank you gajendra... :)
mrivasa 1-Oct-14 19:05pm    
@gajendra, Is there a way to do the exact same thing but on the itext xml?
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900