Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iText(sharp) side margins width

It looks like I can't set left margin to be less then 42pt width. I am setting it to 0f but it always ends as 42pt. If I set margin to any number greater then 0 it just adds it to initial margin of 42pt. I am setting margin of document object:

iTextSharp.text.Rectangle docRect = new iTextSharp.text.Rectangle(pageWidth, pageHeight);
DC = new Document(docRect);
DC.SetMargins(0f, 0f, 0f, 0f);

Page width and height are 6x9 in.

And I end with:

42pt margin|CONTENT CONTENT

I would appreciate any help. Thanks.

like image 260
Velja Radenkovic Avatar asked Dec 24 '09 16:12

Velja Radenkovic


1 Answers

I am using PdfPTable and the problem was default PdfPTable horizontal alignment which is CENTER. As soon as I set alignmentof table to left problem went away.

PdfPTable bTable = new PdfPTable(2);
bTable.HorizontalAlignment = Element.ALIGN_LEFT;

Thanks, Velja

like image 109
Velja Radenkovic Avatar answered Sep 23 '22 13:09

Velja Radenkovic