を使用して、資産フォルダーに保存されている pdf をビットマップに変換しようとしていますPdfViewer.jar
。
これは私のコードです:
public static Bitmap renderToBitmap(InputStream inStream) {
Bitmap bitmap = null;
try {
byte[] bArray = IOUtils.toByteArray(inStream);
ByteBuffer buf = ByteBuffer.wrap(bArray);
PDFPage mPdfPage = new PDFFile(buf).getPage(0, true);
float width = mPdfPage.getWidth();
float height = mPdfPage.getHeight();
bitmap = mPdfPage.getImage((int) (width), (int) (height), null);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
inStream.close();
} catch (IOException e) {
// do nothing because the stream has already been closed
}
}
return bitmap;
}
このコードは私が必要とすることをしています。しかし、結果として得られるビットマップの品質は非常に低くなります。作成されたビットマップの品質を上げるにはどうすればよいですか?