Hi
I have a problem when inserting text to a PDF file.
I start to load the PDF file(1 paged) to memory and next my issue is to insert 
a textstring to the PDF file, but when the text is below the middle of the pdf 
file it generates a new page and puts the string into that page instead of 
placing it on the first page.
Is there another way to insert a positioned textstring to the pdf file? 
Here below is the code:
 PdfReader reader = new PdfReader(@"c:\pdf\Document.pdf");            Document 
document = new Document(PageSize.A4);            MemoryStream memoryStream = 
new MemoryStream();            PdfWriter writer = 
PdfWriter.GetInstance(document, memoryStream);            document.Open();      
      PdfContentByte cb = writer.DirectContent;            PdfImportedPage 
imported = writer.GetImportedPage(reader, 1);            
cb.AddTemplate(imported, 1f, 0, 0, 1f, 0, 0);
            Paragraph pText = new Paragraph(new Chunk(name, 
FontFactory.GetFont(FontFactory.COURIER_BOLD, 18, Font.ITALIC, 
BaseColor.RED)));            pText.SetLeading(400.0f, 0.0f);            
pText.Alignment = 1;            document.Add(pText);
            writer.CloseStream = false;            document.Close();
The rest of the code i omitted(sends a mail with the pdf attached)
I hope you can help me!

 
/Martin


                                          
------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
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

Reply via email to