You can calculate the values ββfor PDFTranscoder transcodes. Thus, A4 is 210 x 297 mm. PDF.Transcoder.KEY_PIXEL_TO_MILLIMETER has a default value of 0.264583 (see Documentation ).
Now calculate the values ββfor:
- KEY_WIDTH: 210 / 0.264583 = 793.7
- KEY_HEIGHT: 297 / 0.264583 = 1122.52
Thus, the code for receiving an A4 document will look like this:
PDFTranscoder t = new PDFTranscoder(); t.addTranscodingHint(PDFTranscoder.KEY_HEIGHT, (float)1122.52); t.addTranscodingHint(PDFTranscoder.KEY_WIDTH, (float)793.70);
You can check the size in Adobe Reader and see that the size of the document will be 210x297 mm = A4.
source share