i have a pdf which I need to down scale. The pdf is in A4 portrait mode, what I need is to shrink the content of the pdf to 5 % and put this into a new PDF also in size A4 and portrait mode. Its not an option to convert the pdf to images, scale them and put it back to a pdf. I am looking for a way to solve this in java. Is there a way to solve this with pdfbox or itext?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
If you use iText 7, then this is an option:
Note that 5% (the
0.05
values in thewriteLiteral()
method) is really small. If there's text, it will be very hard to read what it says. Maybe you meant 95%. In that case use:writeLiteral("\nq 0.95 0 0 0.95 0 0 cm\nq\n")
.Source: How to shrink pages in an existing PDF?
Note: iText 5 is being discontinued, but the iText 5 answer was already posted on Stack Overflow in 2014: Shrink PDF pages with rotation using Rectangle in existing PDF
Answer for PDFBox 2.0.*:
You'll see something tiny in the bottom left.