>> The page size as well as the object arrangement in the new document >> are not correct. >> > It may be a crop box issue.
What do you mean by crop box issue? Is there a chance to solve this problem? >> Secondly, I don't get the annotation working (a popped up annotation >> in the colored rectangle). >> > Your code fragment doesn't create any annotation. Use PdfAnnotation.createText(). Is there any sample code, tutorial or whatever? I haven't found any on www.lowagie.com/iText concerning PdfAnnotation. "Sven Henckel" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Thanks for your help! > > The importing of the PDF document seems to be solved and the colored > rectangle in the center > of the first document page seems to be solved as well. > But I still have two problems. > > > The page size as well as the object arrangement in the new document are not > correct. > > Secondly, I don't get the annotation working (a popped up annotation in the > colored rectangle). > > I hope you can help! > > > Here is some code fragment: > > // creation of a reader > PdfReader reader = new PdfReader("test_input.pdf"); > > // total number of pages > int n = reader.getNumberOfPages(); > > // the size of the first page > Rectangle pagesize = reader.getPageSize(1); > float width = pagesize.width(); > float height = pagesize.height(); > > float llx = (width / 2) - 200; > float lly = (height / 2) - 100; > float urx = (width / 2) + 200; > float ury = (height / 2) + 100; > > // creation of a document-object > Document document = new Document(pagesize); > > // creation of a writer that listens to the document > PdfWriter writer = PdfWriter.getInstance(document, new > FileOutputStream("test_output.pdf")); > > // opening the document > document.open(); > > // adding the content > PdfContentByte cb = writer.getDirectContent(); > int i = 0; > > while (i < n) { > > document.newPage(); > i++; > PdfImportedPage page = writer.getImportedPage(reader, i); > cb.addTemplate(page, 0, 0); > > if (i == 1) { > > Rectangle rect = new Rectangle(llx, lly, urx, ury); > rect.setBackgroundColor(new Color(255,0,0)); > cb.rectangle(rect); > cb.stroke(); > } > } > > // closing the document > document.close(); > > > Best regards, > Sven > > > > > "Paulo Soares" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > news:[EMAIL PROTECTED] > > > > > > > -----Original Message----- > > > From: Sven Henckel [SMTP:[EMAIL PROTECTED] > > > Sent: Thursday, May 29, 2003 13:25 > > > To: [EMAIL PROTECTED] > > > Subject: [iText-questions] Add an Annotation to a PDF document? > > > > > > Hi all, > > > > > > how is it possible to add an annotation to an existing document? > > > I know that it's not possible to simply add it, but to open an exisiting > > > PDF > > > document, write its whole content in a new file and add an annotation to > > > it. > > > > > In the near future it may be possible to add annotations and fields > > to PdfStamper but not at the moment. > > > > > I would like to have a fully filled (with red) rectangle in the center > of > > > the first page of this PDF document. In this rectangle the annotation > > > should > > > be displayed (already popped up when opening the PDF). > > > > > > I have no idea how to realize this and hope that someone can help me. > > > > > Create a new document and import the pages, one by one. After > > importing the first page place the rectangle (PdfContentByte.rectangle()) > > and the annotation (PdfAnnotation and PdfWriter.addAnnotation()). > > > > Best Regards, > > Paulo Soares > > > > > Any code will be appreciated! > > > > > > Thanks a lot! > > > > > > Best regards > > > Sven > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.net email is sponsored by: eBay > > > Get office equipment for less on eBay! > > > http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 > > > _______________________________________________ > > > iText-questions mailing list > > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/itext-questions > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: eBay > > Get office equipment for less on eBay! > > http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: eBay > Get office equipment for less on eBay! > http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 ------------------------------------------------------- This SF.net email is sponsored by: eBay Get office equipment for less on eBay! http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions