List of usage examples for org.apache.pdfbox.rendering PDFRenderer renderImage
public BufferedImage renderImage(int pageIndex) throws IOException
From source file:pdf.NormativPDF.java
public void createNormativPNG(String path) throws IOException { File file = new File(path); PDDocument doc = PDDocument.load(file); PDFRenderer renderer = new PDFRenderer(doc); BufferedImage image = renderer.renderImage(0); SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy."); ImageIO.write(image, "PNG", new File( "pdf_docs\\normativ_picture\\" + product.getName() + "-" + sdf.format(dateNormativ) + ".png")); doc.close();/*from w w w . j a v a2s . co m*/ }
From source file:pdf.StockItemsPDF.java
public void createStockItemsPNG(String path) throws IOException { File file = new File(path); PDDocument doc = PDDocument.load(file); PDFRenderer renderer = new PDFRenderer(doc); BufferedImage image = renderer.renderImage(0); SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy."); ImageIO.write(image, "PNG", new File("pdf_docs\\stock_items_picture\\" + "sipic-" + sdf.format(dateOfWriteOff) + ".png")); doc.close();//from w w w.j av a 2s . co m }
From source file:pdf.SuppliesListPDF.java
public void createDailyReportPNG(String path) throws IOException { File file = new File(path); PDDocument doc = PDDocument.load(file); PDFRenderer renderer = new PDFRenderer(doc); BufferedImage image = renderer.renderImage(0); SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy."); ImageIO.write(image, "PNG", new File("pdf_docs\\lager_lists_picture\\" + "llpic-" + dateSuppliesList.getTime() + ".png")); doc.close();// ww w . ja v a 2s. com }
From source file:pdf.WorkOrderPDF.java
public static void main(String[] args) throws IOException { //DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); //System.out.println(dtf.format(java.time.LocalDateTime.now()));; File file = new File("pdf_docs\\work_orders\\work_order_template.pdf"); PDDocument doc = PDDocument.load(file); PDFRenderer renderer = new PDFRenderer(doc); BufferedImage image = renderer.renderImage(0); ImageIO.write(image, "PNG", new File("pdf_docs\\work_orders_picture\\" + "wopic.png")); doc.close();/* w w w .ja va 2s .c om*/ }
From source file:pdf.WorkOrderPDF.java
public void createWorkOrderPNG(String path) throws IOException { File file = new File(path); PDDocument doc = PDDocument.load(file); PDFRenderer renderer = new PDFRenderer(doc); renderer.renderImageWithDPI(0, 600); BufferedImage image = renderer.renderImage(0); SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy."); ImageIO.write(image, "PNG", new File("pdf_docs\\work_orders_picture\\" + "wopic-" + numOfWorkOrder.split("\\/")[0] + "_" + numOfWorkOrder.split("/")[1] + ".pdf")); doc.close();// w w w. j ava2s . c o m }
From source file:pdf.WriteOffMaterialsPDF.java
public void createWriteOffMaterialsPNG(String path) throws IOException { File file = new File(path); PDDocument doc = PDDocument.load(file); PDFRenderer renderer = new PDFRenderer(doc); BufferedImage image = renderer.renderImage(0); SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy."); ImageIO.write(image, "PNG", new File( "pdf_docs\\write_off_materials_picture\\" + "wompic-" + sdf.format(dateOfWriteOff) + ".png")); doc.close();/*from w ww .jav a 2 s . c om*/ }
From source file:pdf.WriteOffProductsPDF.java
public void createWriteOffProductsPNG(String path) throws IOException { File file = new File(path); PDDocument doc = PDDocument.load(file); PDFRenderer renderer = new PDFRenderer(doc); BufferedImage image = renderer.renderImage(0); SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy."); ImageIO.write(image, "PNG", new File( "pdf_docs\\write_off_products_picture\\" + "woppic-" + sdf.format(dateOfWriteOff) + ".png")); doc.close();//from w w w.j a v a 2 s . com }
From source file:pdfthumbnailgenerator.PDFThumbnailGenerator.java
/** * @param args the command line arguments *//*from ww w . j ava 2 s. co m*/ public static void main(String[] args) { if (args.length < 3) { System.out.println("Usage: pdfPath jpegOutputPath"); System.exit(-1); } File file = new File(args[1]); try { try (PDDocument document = PDDocument.load(file)) { PDFRenderer renderer = new PDFRenderer(document); BufferedImage image = renderer.renderImage(0); ImageIO.write(image, "JPEG", new File(args[2])); document.close(); System.exit(0); } } catch (Exception ex) { System.exit(-1); } }