----- Original Message -----
From: "Sven Henckel" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 01, 2003 21:31
Subject: [iText-questions] Re: Add an Annotation to a PDF document?


> >> What do you mean by crop box issue?
> >> Is there a chance to solve this problem?
>
> > I'm only guessing, you didn't specify what you meant by "incorrect
> object
> arrangement".
>
> I specified the page size of the new document as you can see in the code
> fragment. The
> import of the PDF document is also done the way the code shows.
> The result is that the page size of the new document doesn't equal the
> page
> size of the imported one.
> Moreover, the document object are arranged incorrectly, which might be a
> result of the wrong page
> size, e.g. some of them are placed out of the media box.
>

You made all the pages the size of the first page size, which may not
necessarily be true. You'll have to make each page size the size of the
media box and then apply the size of the crop box in PdfWriter.

>
> >> Is there any sample code, tutorial or whatever?
> >> I haven't found any on www.lowagie.com/iText concerning
> PdfAnnotation.
>
> > The tutorial here is Adobe's pdf reference. What doubt do you have
> with
> PdfAnnotation.createText()?
>
> I don't have any doubts that this will work and is a great solution, but
> I'm
> not so experience with it and would
> appreciate a working example code.
>

There are no examples on annotations but how wrong can you get with one
method call?
Did you try?

Best Regards,
Paulo Soares

> Thanks for your help!
>
> Best regards,
> Sven
>
>
>
>
> "Sven Henckel" <[EMAIL PROTECTED]> schrieb im
> Newsbeitrag
> news:[EMAIL PROTECTED]
> > >> 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
>
>
>
>
>
> -------------------------------------------------------
> 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
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to