org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap Java Examples
The following examples show how to use
org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReportConvertPdf.java From yuzhouwan with Apache License 2.0 | 5 votes |
private static void drawImageWithScale(PDDocument doc, PDPageContentStream content, String imgPath, int bufferedImageType, float scale) throws IOException { BufferedImage bufferedImage = ImageIO.read(new File(imgPath)); BufferedImage image = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), bufferedImageType); image.createGraphics().drawRenderedImage(bufferedImage, null); PDXObjectImage xImage = new PDPixelMap(doc, image); content.drawXObject(xImage, 100, 100, xImage.getWidth() * scale, xImage.getHeight() * scale); }