Philippe Couas wrote:

Hi Bruno

I have viewed Concatenate.java, but i have already an flow with an PDFWriter
OK,
then you can work with PdfImportedPage.
The problem is that you mix up different methods.
In your loop, you need something like this:
{
 PdfImportedPage page = writer.getImportedPage(reader, i);
 writer.getDirectContent.addTemplate(page, 0, 0);
 document.newPage();
}
(I write this from memory, you should check the
tutorial and the javadocs for the correct syntax.)
br,
Bruno



   public void idocument( Document document,java.io.OutputStream
fos,BufferedReader2 dataInputStream, int maxlinespage,Modele mp,boolean
crypt, MBufferedWriter    bl) throws IOException,DocumentException
   {
     Paragraph par=null;
     int i_xl;
     int i_yl;
float cpi_xpos; printd("IDoc01 "+rac_modele+"*"+pdf_modele+"*"); if(author!=null) document.addAuthor(author); if(subject!=null) { printd("IDoc02 sujet PDF "+subject+"*"); document.addSubject(subject); } Document.compress = false;
        writer = PdfWriter.getInstance(document, fos);
// MANY LINES
        ..................
        ......................

        if(pdfattachement!=null)
         {
                // External file
         PdfReader ajreader = new PdfReader(pdfattachement);
         ajreader.consolidateNamedDestinations();
         // we retrieve the total number of pages
         int ajn = ajreader.getNumberOfPages();
         PdfImportedPage ajpage;
          for (int i = 0; i < ajn; ) {
              ++i;
              ajpage = writer.getImportedPage(reader, i);
// NE FONCTIONNE PAS
              writer.addPage(ajpage); ???????

          }
         }
         */




-----Message d'origine-----
De : Bruno Lowagie [mailto:[EMAIL PROTECTED] Envoyé : jeudi 16 mars 2006 17:36
À : Philippe Couas
Cc : [email protected]
Objet : Re: [iText-questions] AddPage with an PdwWriter and not with PDFCopy


Philippe Couas wrote:

Hi,

Currently i use an PDFWRITER to dynamically create an PDF File. Now i need to add an external PDF File to this flow .

How could i add this external file with PDFWRITER ?

Or you close the document and afterwards concatenate
the newly created doc with the existing one;
or you read the existing one and add its pages to the
direct content of your PdfWriter object as PdfImportedPages. It's all in the
tutorial: http://itextdocs.lowagie.com/tutorial/general/copystamp/
br,
Bruno






-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to