Kamil created PDFBOX-4177: ----------------------------- Summary: PDFBox seems to scale up image while it should not Key: PDFBOX-4177 URL: https://issues.apache.org/jira/browse/PDFBOX-4177 Project: PDFBox Issue Type: Bug Reporter: Kamil Attachments: test.jpg
I have a test image (in attachment) and the following code: {code:java} public static void main(String[] args) { final String filename = "test.jpg"; try ( final PDDocument doc = new PDDocument(); final FileInputStream input = new FileInputStream(new File(filename)); final ByteArrayOutputStream pdfOut = new ByteArrayOutputStream(); final FileOutputStream output = new FileOutputStream("test.pdf") ) { final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, IOUtils.toByteArray(input), filename); final PDPage page = new PDPage(new PDRectangle(jpeg.getWidth(), jpeg.getHeight())); doc.addPage(page); try (final PDPageContentStream contents = new PDPageContentStream(doc, page)) { contents.drawImage(jpeg, 0, 0); } doc.save(pdfOut); pdfOut.flush(); IOUtils.write(pdfOut.toByteArray(), output); }catch (Exception e) { e.printStackTrace(); } } {code} The image in test.pdf is double sized (and quality is worse) than in original image -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org