You can start by reading the tutorial (or buying the book). See 
http://itextdocs.lowagie.com/tutorial/general/copystamp/index.html#pdfwriter.

Paulo 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Larouche Jean-François
> Sent: Friday, March 02, 2007 5:51 PM
> To: Post all your questions about iText here
> Subject: Re: [iText-questions] Merging PDF, but different 
> from example.
> 
> So its not possible to use something like this?
> There must be a way, i probably dont use it correctly.
>  
> ByteArrayOutputStream pdfOutputStream = new ByteArrayOutputStream();
> Document document = new Document();
> PdfWriter writer = PdfWriter.getInstance(document, pdfOutputStream);
> document.open()
>  
> document.add(..);
> document.add(..);
>  
> PD4ML htmlConverter = new PD4ML();
> htmlConverter.setHtmlWidth( 780 );
> ByteArrayOutputStream pdfOutputStream2 = new ByteArrayOutputStream();
> htmlConverter.render(new URL("file:///C:/tmp.html "), 
> pdfOutputStream2);
> pdfOutputStream2.close();
> PdfReader reader = new PdfReader(pdfOutputStream2.toByteArray());
> reader.consolidateNamedDestinations();
> writer.addToBody(reader.getPageN(1));
>  
> document.add(..);
> document.add(..);
> document.close();
>  
> using this i get:
> java.lang.NullPointerException
>  at 
> com.lowagie.text.pdf.PdfWriter.getNewObjectNumber(PdfWriter.java:1997)
>  at 
> com.lowagie.text.pdf.PRIndirectReference.toPdf(PRIndirectRefer
> ence.java:91)
>  at com.lowagie.text.pdf.PdfDictionary.toPdf (PdfDictionary.java:152)
>  at 
> com.lowagie.text.pdf.PdfIndirectObject.writeTo(PdfIndirectObje
> ct.java:167)
>  at com.lowagie.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:392)
>  at com.lowagie.text.pdf.PdfWriter$PdfBody.add (PdfWriter.java:372)
>  at com.lowagie.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:325)
>  at com.lowagie.text.pdf.PdfWriter.addToBody(PdfWriter.java:762)
>  at ca.qc.inspq.pqdcs.pdf.ReponsePDF.generatePDF(ReponsePDF.java :102)
>  at ca.qc.inspq.junit.ReponsePDFTest.main(ReponsePDFTest.java:80)
>  
> Jeff
>  
> On 3/2/07, Paulo Soares <[EMAIL PROTECTED] > wrote: 
> 
>       Importing pages doesn't preserve links. You may be 
> asking too much of the PDF format.
>       
>       Paulo
>       
>       > -----Original Message-----
>       > From: [EMAIL PROTECTED] 
>       > [mailto: 
> [EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]> ] On
>       > Behalf Of Larouche Jean-François 
>       > Sent: Friday, March 02, 2007 4:49 PM
>       > To: Post all your questions about iText here
>       > Subject: Re: [iText-questions] Merging PDF, but different 
>       > from example.
>       >
>       > Ack i just tough about it, i cannot do that, there might by 
>       > hyperlinks inside the PD4ML generated pdf. If i clip an image
>       > i will loose all this information.
>       > I really need to just get that content and insert in 
> a cell as is. 
>       >
>       >
>       > On 3/2/07, Larouche Jean-François < [EMAIL PROTECTED]> wrote:
>       >
>       >       I dont know if this will work, because if i clip an
>       > image, the content wont readjust itself in the Cell 
> if its smaller. 
>       >
>       >       I will try to find the example you talking 
> about and try it.
>       >
>       >       Thanks!
>       >
>       >
>       >
>       >       On 3/2/07, Paulo Soares < [EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]> > wrote:
>       >
>       >               There are lots of examples about importing PDF
>       > pages and treating them as images.
>       >
>       >               Paulo
>       >
>       >               > -----Original Message----- 
>       >               > From: 
> [EMAIL PROTECTED]
>       >               > [mailto:
>       > [EMAIL PROTECTED] 
>       > <mailto:[EMAIL PROTECTED]> ] On
>       >               > Behalf Of Larouche Jean-François 
>       >               > Sent: Friday, March 02, 2007 4:36 PM
>       >               > To: Post all your questions about iText here
>       >               > Subject: Re: [iText-questions] Merging PDF,
>       > but different 
>       >               > from example.
>       >               >
>       >               > Well i want to add the "content" of all pages
>       > in another PDF
>       >               > inside a PdfPCell.
>       >               > That cell is inside a dynamically generated
>       > Document with iText.
>       >               >
>       >               > Would that be possible?
>       >               >
>       >               > Im still digging through mailing 
> archive without luck. 
>       >               >
>       >               > On 3/2/07, Bruno Lowagie < [EMAIL PROTECTED]
>       > <mailto: [EMAIL PROTECTED]> > wrote: 
>       >               >
>       >               >       Larouche Jean-François wrote: 
>       >               >       > But its only working if i close all
>       > the PDFs, re-read
>       >               > them, and merge on 
>       >               >       > a page basis.
>       >               > 
>       >               >       Are you saying you tried using bytes
>       > from a document
>       >               >       that wasn't closed? The close method 
>       > creates the
>       >               >       Cross-Reference table and the trailer 
>       > of the document.
>       >               >       Those are essential parts in a PDF file.
>       >               >
>       >               >       > The only problem, the user want its
>       > content tight and 
>       >               > not separated by
>       >               >       > pages.
>       >               >
>       >               >       You want to reflow/repurpose the 
>       > content of a PDF
>       >               >       file? But PDF is a PDL, it's 
> not a format like 
>       >               >       Word/RTF/HTML/... The layout on each
>       > page is fixed.
>       >               >       You user wants something that is 
>       > probably impossible.
>       >               >
>       >               >       > And its not all, the PDF elements 
>       > generated by PD4ML
>       >               >
>       >               >       What PDF elements are you 
> talking about? 
>       >               >       Pages in a PDF? Because there are
>       > elements in iText 
>       >               >       (paragraphs, phrases, lists,...), but a
>       > PDF doesn't
>       >               >       know anything about the structure of 
>       > its content.
>       >               >       Once you go to PDF, all structure is 
>       > lost (unless
>       >               >       you're creating Tagged PDF).
>       >               >       br,
>       >               >       Bruno 
>       
>       
>       Aviso Legal:
>       Esta mensagem é destinada exclusivamente ao 
> destinatário. Pode conter informação confidencial ou 
> legalmente protegida. A incorrecta transmissão desta mensagem 
> não significa a perca de confidencialidade. Se esta mensagem 
> for recebida por engano, por favor envie-a de volta para o 
> remetente e apague-a do seu sistema de imediato. É proibido a 
> qualquer pessoa que não o destinatário de usar, revelar ou 
> distribuir qualquer parte desta mensagem. 
>       
>       Disclaimer:
>       This message is destined exclusively to the intended 
> receiver. It may contain confidential or legally protected 
> information. The incorrect transmission of this message does 
> not mean the loss of its confidentiality. If this message is 
> received by mistake, please send it back to the sender and 
> delete it from your system immediately. It is forbidden to 
> any person who is not the intended receiver to use, 
> distribute or copy any part of this message. 
>       
>       
> --------------------------------------------------------------
> -----------
>       Take Surveys. Earn Cash. Influence the Future of IT
>       Join SourceForge.net's Techsay panel and you'll get the 
> chance to share your 
>       opinions on IT & business topics through brief 
> surveys-and earn cash
>       
> http://www.techsay.com/default.php?page=join.php&p=sourceforge
> &CID=DEVDEV 
> <http://www.techsay.com/default.php?page=join.php&p=sourceforg
> e&CID=DEVDEV> 
>       _______________________________________________
>       iText-questions mailing list
>       [email protected] 
> <mailto:[email protected]> 
>       https://lists.sourceforge.net/lists/listinfo/itext-questions 
>       Buy the iText book: http://itext.ugent.be/itext-in-action/
>       
> 
> 
> 


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to