0

https://pdf-renderer.dev.java.net/の api を確認しています。PDF をズーム レベル 100% の画像に変換したいと考えています。

誰もそれを試しましたか?

4

3 に答える 3

1
    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
于 2012-02-19T17:48:42.860 に答える
0

PDF表示にはiTextをお勧めします。これまでのところ、私にとってはかなり良かったです。

于 2010-08-17T23:33:46.140 に答える