I am doing the following in order to add a vector logo to my PDF documents. I had my
graphics artist make the logo in vector and then save it as a PDF. I then read this PDF
fragment from the classpath and then use iText to write it to an empty region of a PDF
that I created using JasperReports. I wanted t do it this way so that the logo would not
be distored regardless of the size or zoom of the PDF. There is a code sample below. Is
this possible using Seam PDF?
| InputStream in =
getClass().getClassLoader().getResourceAsStream("pipetracker/model/state/type/pipetracker_paperwork_logo.pdf");
| PdfReader pdfReaderLogo = new PdfReader(in);
| Rectangle psizeLogo = pdfReaderLogo.getPageSize(1);
|
| // step 1: creation of a document-object
| Document document = new Document(psize);
| // // step 2: we create a writer that listens to the document
| PdfWriter writer = PdfWriter.getInstance(document, baos2);
| document.open();
| PdfContentByte cb = writer.getDirectContent();
|
| PdfImportedPage pageReport = writer.getImportedPage(pdfReader, 1);
| PdfImportedPage pageLogo = writer.getImportedPage(pdfReaderLogo,
1);
|
| cb.addTemplate(pageReport, 0, 0);
| cb.addTemplate(pageLogo, .4f, 0f, 0f, .4f, 20, 610);
|
| document.close();
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4036181#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...