I'm trying to scale a pdf file like scaling function in copier machine that can scale the document by percentage (like this : https://inspectapedia.com/graphics/Safari_Page_Setup.jpg), i'm using pdfbox to manage my pdf file. I have tried this code, but why it's not working? there's no error in the code.
void Scale(){
try
{
PDDocument doc = PDDocument.load(new File(filePath));
for (int p = 0; p < doc.getNumberOfPages(); ++p)
{
PDRectangle mediaBox = doc.getPage(p).getMediaBox();
mediaBox.transform(Matrix.getScaleInstance(0.5f, 0.5f));
doc.getPage(p).setMediaBox(mediaBox);
}
doc.save(new File(filePathEdited));
} catch (Exception e) {
e.printStackTrace();
}
}
Is anyone know why that code is not working?
EDIT
I need it to work on API 16