You're not adding the imported page to the document. Use
writer.getDirectContent().addTemplate(pip, 0, 0).

Best Regards,
Paulo Soares

> -----Original Message-----
> From: Magica de Spell [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, October 22, 2002 11:56
> To:   [EMAIL PROTECTED]
> Subject:      [iText-questions] import pages
> 
> hello,
> 
> what am I doing wrong in the following:
> 
> public class DummyPDF{
>   
>   DummyPDF(String name, String file, int dest) {
>     Document document = new Document();
>     try {
>       PdfWriter writer = PdfWriter.getInstance
>           (document, new FileOutputStream(name));
>       PdfReader reader = new PdfReader(file);
>       document.open();
>       document.add(
>           new Paragraph(" initial document " + name));
>       PdfImportedPage pip = 
>           writer.getImportedPage(m_reader, dest);
>       document.close();
>     }
>     catch(Exception e){
>     }
>   }
>   
>   public static void main(String[] args) {
>     if (args.length >= 3) {
>       try {
>         int i = Integer.parseInt(args[2]);
>         new DummyPDF(args[0], args[1], i);
>       }
>       catch (NumberFormatException e) {}
>     }
>   }
> }
> 
> 
> When I run java DummyPDF file1.pdf file2.pdf 7, the
> resulting file1.pdf only shows the inserted paragraph
> in Acrobat Reader. On the other hand, something seems
> to be written to file1.pdf and its size will depend on
> what is to be imported.
> 
> appreciating any help
> 
> Jezebel
> 
> 
> 
> 
>           ------- Bavaria ubique ------
> 
> 
> 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Y! Web Hosting - Let the expert host your web site
> http://webhosting.yahoo.com/
> 
> 
> -------------------------------------------------------
> This sf.net emial is sponsored by: Influence the future of 
> Java(TM) technology. Join the Java Community Process(SM) (JCP(SM)) 
> program now. http://ad.doubleclick.net/clk;4699841;7576301;v?
> http://www.sun.com/javavote
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This sf.net emial is sponsored by: Influence the future of 
Java(TM) technology. Join the Java Community Process(SM) (JCP(SM)) 
program now. http://ad.doubleclick.net/clk;4699841;7576301;v?
http://www.sun.com/javavote
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to