pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rohail Kidwai <rKid...@dataserv.us>
Subject buffered image to pdf in pdfbox2.0
Date Mon, 27 Apr 2015 13:58:10 GMT
Hey,  I am trying to figure out how to write a bufferedimage to a pdf in pdfbox 2.0 and am
having some trouble.

Since the PDPixelMap has been removed in 2.0. Can you please give me some guidance here?

Thanks.


code that used to work in 1.8

BufferedImage img;


PDDocument doc = new PDDocument();


PDRectangle pageSize = new PDRectangle(width, height);


PDPage pdfPage = PDPage(pageSize);

PDPixelMap pdPixelMap = new PDPixelMap(doc, img);
PDPageContentStream contents = new PDPageContentStream(doc, pdfPage);
contents.drawXObject(pdPixelMap, 0, 0, img.getWidth(), img.getHeight());
contents.close();


doc.addPage(pdfPage);


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message