Hello,
I just posted a question on stackoverflow (
http://stackoverflow.com/questions/4430302/extra-space-inserted-on-new-pages-when-creating-pdfs-with-itextsharp)
and was pointed in this direction as my problem might be a bug.
I'm having problems with an extra space being inserted when creating a new
page. The first page looks fine but on any additional pages the extra space
appears at the top. I've made a mini example that inserts a new page with a
logo and a title for each article in a list. If I only insert the logo or
only the title it works fine, but if I try to insert both there's an extra
space coming from somewhere. (It's iTextSharp 5.0.5, c# and .net if that
helps!)
Here's the code:
public static void CreatePDF(List<Item> Articles)
{
Document document = new Document(PageSize.A4, 35, 35, 35, 35);
MemoryStream memoryStream = new MemoryStream();
PdfWriter writer = PdfWriter.GetInstance(document, memoryStream);
document.Open();
for (int i = 0; i < Articles.Count; i++)
{
if (i > 0)
{
document.NewPage();
}
Image logo = Image.GetInstance(@"C:\logo.gif");
document.Add(logo);
Paragraph title = new Paragraph("test title", new
Font(Font.FontFamily.HELVETICA, 20, Font.NORMAL, CMYKColor.BLACK));
document.Add(title);
}
document.Close();
SendPDFResponse(memoryStream, "myfile.pdf");
}
Cheers,
Annelie
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php