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"); From int rotation = page getRotation(); It can be seen that the current PDF is rotated 270 degrees, and if you add pictures on this basis, the effect pictures will be inverted??How to solve it