vat*_*ath 4 java bufferedimage jfreechart pdfbox
第一次海报,和我一起...
我有两个问题。首先,我想知道如何使用BufferedImage将图像添加到PDFBox 2.0文档。在这里已经问过这个问题:将BufferedImage添加到PDFBox文档
此后,PDFBox排除了整个PDJpeg类和xobject部分。
其次,如果有人已经问过这个问题并且已经回答了,但是答案已过时;更新/联系这两个问题的最佳方法是什么?(我没有任何要点,所以我无法发表评论)。
此后,PDFBox排除了整个PDJpeg类和xobject部分。
在版本2的开发过程中确实存在许多重构(以及重构,重构等),并且这种重构通常不仅仅局限于软件包的更改。通常,现在某些功能在哪里并不明显。
但是,可以将诸如添加BufferedImage到文档之类的基本功能视为不会丢失。
现在有了JPEGFactory,它提供了从中创建图像XObject的方法BufferedImage,尤其是:
/**
* Creates a new JPEG Image XObject from a Buffered Image.
* @param document the document where the image will be created
* @param image the buffered image to embed
* @return a new Image XObject
* @throws IOException if the JPEG data cannot be written
*/
public static PDImageXObject createFromImage(PDDocument document, BufferedImage image)
/**
* Creates a new JPEG Image XObject from a Buffered Image and a given quality.
* The image will be created at 72 DPI.
* @param document the document where the image will be created
* @param image the buffered image to embed
* @param quality the desired JPEG compression quality
* @return a new Image XObject
* @throws IOException if the JPEG data cannot be written
*/
public static PDImageXObject createFromImage(PDDocument document, BufferedImage image, float quality)
/**
* Creates a new JPEG Image XObject from a Buffered Image, a given quality and DPI.
* @param document the document where the image will be created
* @param image the buffered image to embed
* @param quality the desired JPEG compression quality
* @param dpi the desired DPI (resolution) of the JPEG
* @return a new Image XObject
* @throws IOException if the JPEG data cannot be written
*/
public static PDImageXObject createFromImage(PDDocument document, BufferedImage image, float quality, int dpi)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4377 次 |
| 最近记录: |