Could it be that the page is rotated? Call page.getRotation() to find out
Tilman Am 29.07.2022 um 16:49 schrieb 刘啸:
When I use pdfbox to append pictures, the width of the current page is greater than the height. When I use 0,0 coordinates to insert, the pictures are appended to the lower right corner instead of the lower left corner. How can I solve this,The following is a code example: PDDocument load = PDDocument.load(new File("D:\\tv\\e97cd2c6-345d-46dc-ae96-9b757e185ee0.pdf")); PDPage page = load.getPage(0); PDPageContentStream contentStream = new PDPageContentStream(load, page, PDPageContentStream.AppendMode.APPEND, true,true); PDImageXObject pdImage = PDImageXObject.createFromFile("D:\\tv\\test.png", load); PDExtendedGraphicsState pdExtGfxState = new PDExtendedGraphicsState(); pdExtGfxState.setNonStrokingAlphaConstant(0.8f); pdExtGfxState.setAlphaSourceFlag(true); pdExtGfxState.getCOSObject().setItem(COSName.BM, COSName.MULTIPLY); contentStream.setGraphicsStateParameters(pdExtGfxState); contentStream.drawImage(pdImage, 0, 0, 100, 100); contentStream.close(); load.save("D:\\tv\\e97cd2c6-345d-46dc-ae96-9b757e185ee0-1.pdf");
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org