https://pdf-renderer.dev.java.net/の api を確認しています。PDF をズーム レベル 100% の画像に変換したいと考えています。
誰もそれを試しましたか?
https://pdf-renderer.dev.java.net/の api を確認しています。PDF をズーム レベル 100% の画像に変換したいと考えています。
誰もそれを試しましたか?
int widthPage = (int)page.getBBox().getWidth();
int heightPage = (int)page.getBBox().getHeight();
if(page.getAspectRatio()<1){
widthPage = (int)(widthPage / page.getAspectRatio() );
heightPage = (int)(heightPage / page.getAspectRatio() );
}
// get the width and height for the doc at the default zoom
Rectangle rect = new Rectangle(0, 0, (int) widthPage, (int) heightPage);
// generate the image
Image img = page.getImage(rect.width, rect.height, // width & height
rect, // clip rect
null, // null for the ImageObserver
true, // fill background with white
true // block until drawing is done
);
// save it as a file
PDF表示にはiTextをお勧めします。これまでのところ、私にとってはかなり良かったです。