List of usage examples for org.apache.pdfbox.tools TextToPDF TextToPDF
TextToPDF
From source file:com.validation.manager.core.tool.Tool.java
License:Apache License
public static File convertToPDF(File f, String filename) throws FileNotFoundException, IOException { TextToPDF ttp = new TextToPDF(); File pdf;//from w w w . jav a2 s . co m try (PDDocument pdfd = ttp.createPDFFromText(new FileReader(f))) { pdf = new File(filename); if (pdf.getParentFile() != null) { pdf.getParentFile().mkdirs(); } pdfd.save(pdf); } pdf.deleteOnExit(); return pdf; }