Hi,

Gesendet: Di, 12. Jul 2011
Von: SasiKanth Chandran
> Hi,
> I am trying to generate a PDF which will contain a report in tabular format. 
> At the top left corner of each page i added a  .jpeg...but the image is not 
> shown when viewing the PDF. 
> I understood from the pdfbox mailing archive list that " PDJpeg can not be 
> created while a ContentStream is being operated > on."  But i am not sure 
> about solution for this issue. 
That's exactly the point, add the PDJpeg BEFORE creating the content stream. 
[1] is a simple example on how to add images to a pdf.

> Can you please guide me the way to show image along with text/table in the 
> PDF doc ?

> Code Snippet:
> PDPage page = new PDPage();doc.addPage( page );
> PDPageContentStream contentStream = new PDPageContentStream(doc, page);
> PDJpeg imageObj = new PDJpeg(doc,new FileInputStream("logo.jpg"));
> contentStream.drawImage( imageObj, 10, 760 );
> createTable(doc, page, contentStream, slicedContent,currentPage,noOfPages);

> Attached the two generated pdf with added image and without image along with 
> table data.
> Thanks,Sasi

BR
Andreas Lehmkühler

[1] 
http://svn.apache.org/repos/asf/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/examples/pdmodel/AddImageToPDF.java

Reply via email to