How to add image

Help
Mark Khair
2012-02-24
2013-05-28
  • Mark Khair

    Mark Khair - 2012-02-24

    I want an image located on my local disk to the pdf. I've tried DrawInlineImageCCITT and DrawInlineImagePlain examples where I noticed that it draws a byte array, so I managed to convert the image to a byte array and draw it but the resulting pdf is corrupted.
    I also tried:
    PDImage pdImage = (PDImage) PDImage.META.createNew();
            pdImage.cosGetStream().addFilter(Filter.CN_Filter_DCTDecode);
            pdImage.cosGetStream().setEncodedBytes(bytes);
            creator.doXObject(null, pdImage);

    but I got the same results. Is there a way to add an image to the pdf?

    Thanks

     
  • Anonymous - 2012-02-28

    sorry for such a delay.

    you will find more support for platform images in the jPodRenderer part of the project, hosted here on sourceforge,too. jPodRenderer support "conversion" to platform graphics (rendering) and (for what reason ever) also the other way round is implemented there.

    drawback may be that jPodRenderer is GPL licensed.

    Anyway, in "DrawImage" there's a complete example for embedding an image, in "ImageConverterAwt2Pdf" you will find the conversion mechanics.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks