Excellent! My invoices are now perfect. iText rules.

For posterity's sake, here is the code I am using to insert a PDF image in
my file:

    try {
      PdfReader imgReader = new PdfReader("logo.pdf");
      PdfImportedPage page;
      page = writer.getImportedPage(imgReader, 1);
      cb.addTemplate(page,
                     .8f, // x-scale
                     0f, // rotation
                     0f, // rotation
                     .8f, // y-scale
                     left-130, // x position
                     top+180);// y position
    } catch (IOException ex) {
      logger.log("Sorry, got IO exception reading pdf image file");
    }

-gabe


On Wed, 28 Jan 2004, Bruno wrote:

> Quoting Gabe Johnson <[EMAIL PROTECTED]>:
>
> >
> > This task is allegedly easy one, according to a previous post on this
> > list.
> >
> > I have an image saved as a PDF file: logo.pdf
> >
> > I am generating a series of PDF invoices and would like to include lgo.pdf
> > at the top of each file.  I am using a page-event callback to include the
> > header, as it is more complicated than HeaderFooter allows. It seems like
> > this should be trivial, but I can't seem to find anything in the API.
>
> You have most of the elements you need.
> The only thing you need is a PdfTemplate with the original PDF.
> See http://www.lowagie.com/iText/tutorial/ch13.html
> and you'll have a PdfImportedPage that can be used as PdfTemplate.
> Then look at http://www.lowagie.com/iText/tutorial/ch12.html#openclose
> and in an onEndPage event (rather than onStartPage) add the PdfTemplate
> at the desired position with addTemplate:
> http://www.lowagie.com/iText/tutorial/ch10.html#templates
>
> br,
> Bruno Lowagie
>


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to