Duncan_McCloud wrote:
> Hello everyone,
> I am actually trying to add text on every page of an existing pdf file.
> I have no problem in doing except with a particular pdf file.
> Some of the pages of this pdf file seems to be a full A4 Size image.
> The result is that on those pages the Text is not added, or maybe it is
> added but it's overlapped by the existing image. 
> This is the code i use to add the Text on the page:
> 
> PdfReader pdfReader = new PdfReader(file);
> PdfStamper pdfStamper = new PdfStamper(pdfReader, FileStream);
> 
> for (int cont = 1; cont <= pdfReader.NumberOfPages; cont++)
> {
>     PdfImportedPage tempPage = pdfStamper.GetImportedPage(pdfReader, cont);
>     PdfContentByte cb = pdfStamper.GetOverContent(cont);                      
>       
>     BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA,
> BaseFont.CP1252,BaseFont.NOT_EMBEDDED);
>     cb.BeginText();
>     cb.SetFontAndSize(bf, 16);
>     cb.SetTextMatrix(0, 1, -1, 0, 17, 280);
>     cb.ShowText("TEST_STRING");
>     cb.EndText();
>     cb.AddTemplate(tempPage, 0, 0);
> }
> 
> pdfStamper.Close();
> pdfReader.Close();
> 
> As already said it works at 100% except on those particular pages.
> Is there any way to force the added Text to be printed over any other
> elements\object?

Seems like you are explicitly adding the tempPage over the TEST_STRING.
Switch the order in which you add the tempPage and the text,
and the problem will be solved.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to