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);

Reply via email to