rorostar wrote:
> 
> What I'm trying to do is create a PDF file from several "template" pdf
> files.
> The first few pages of the PDF file are generated texts (cover page, table
> of content, etc), and then after that, I would need to append and edit from
> other existing template (basically adding certain text at certain pixel).
> I was able to do copy pages from several other pdf simply by doing this:
> PdfImportedPage page = writer.getImportedPage(reader, 1);
> PdfContentByte cb = writer.getDirectContent();
> cb.addTemplate(page, 0.90f, 0, 0, 0.90f, 20, 50);
> 
> However, the requirement has now changed and I would need to edit the
> imported page. Thus only PdfStamper would allow me to do this.

You don't need PdfStamper.
You can still use cb after adding the template.

for instance:
PdfImportedPage page = writer.getImportedPage(reader, 1);
PdfContentByte cb = writer.getDirectContent();
cb.addTemplate(page, 0.90f, 0, 0, 0.90f, 20, 50);
cb.moveTo(20, 50);
cb.lineTo(120, 150);
cb.stroke();

will add a line on top of the added page.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to