Aspose.Pdf for Java是一款针对PDF文件操作和转换类的Java控件,可以通过代码灵活地对PDF文件进行全方位的处理,该产品无论是从功能上还是产品易用性上都受到了全球广大开发人员的好评,在新的17.2版本中该产品也进行了许多加强和修复了以往存在的BUG:
在新的版本中该产品支持转换PDF为PDFA_3U
Document doc = new Document("inFile.pdf");
PdfFormatConversionOptions opts = new PdfFormatConversionOptions("outLog.txt", PdfFormat.PDF_A_3U, ConvertErrorAction.Delete);
doc.convert(opts);
doc.save("outFile.pdf");
在新的版本中支持从PDF文件中提取标记的内容为图片
//Open document
Document document = new Document("sample.pdf");
//instantiate PdfExtractor
PdfExtractor pdfExtractor = new PdfExtractor();
//Extract Chart objects as image in a folder
pdfExtractor.extractMarkedContentAsImages(document.getPages().get_Item(1), "C:/Temp/Charts_page_1");
document.close();
在新的版本中支持转换PDF文件为像素化的TIFF图片
//Open document
//Create stream object to save the output image
java.io.OutputStream imageStream = new java.io.FileOutputStream("Image.tiff");
//Create Resolution object
//instantiate TiffSettings object
//set the compression of resultant TIFF image
tiffSettings.setCompression(com.
Aspose.Pdf.devices.CompressionType.CCITT4);
//set the color depth for resultant image
tiffSettings.setDepth(com.
Aspose.Pdf.devices.ColorDepth.Format4bpp);
//skip blank pages while rendering PDF to TIFF
tiffSettings.setSkipBlankPages(true);
//set image brightness
//tiffSettings.setBrightness(.5f);
//set IndexedConversion Type, default value is simple
tiffSettings.setIndexedConversionType(IndexedConversionType.Pixelated);
//Create TiffDevice object with particular resolution
com.
Aspose.Pdf.devices.TiffDevice tiffDevice = new com.
Aspose.Pdf.devices.TiffDevice(2480, 3508,resolution,tiffSettings);
//Convert a particular page (Page 1) and save the image to stream
tiffDevice.process(pdfDocument,1,1,imageStream);
//Close the stream
imageStream.close();
在新的版本中还对PDF转换为PDFA, HTML转换为PDF, PCL转换为PDF以及PDF转换为PPTX进行了增强