List of usage examples for java.io IOException getMessage
public String getMessage()
From source file:PhraseWithColorRedAndNormalFontPDF.java
public static void main(String[] args) { Document document = new Document(); try {//ww w.jav a2 s .c om PdfWriter.getInstance(document, new FileOutputStream("PhraseWithColorRedAndNormalFontPDF.pdf")); document.open(); Phrase phrase = new Phrase("(3) this is a phrase with a red, normal font Courier, size 20.\n", FontFactory.getFont(FontFactory.COURIER, 20, Font.NORMAL, new Color(255, 0, 0))); document.add(phrase); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:EncryptedPDFAllowAssemblyFillInScreenReadersModifyContents.java
public static void main(String[] args) { Document document = new Document(); try {/*from w w w . j av a 2 s . c o m*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("EncryptedPDFAllowAssemblyFillInScreenReadersModifyContents.pdf")); // setEncryption(boolean strength, String userPassword, String // ownerPassword, int permissions) writer.setEncryption(PdfWriter.STRENGTH40BITS, "java2s.com", "World", PdfWriter.AllowAssembly | PdfWriter.AllowFillIn | PdfWriter.AllowScreenReaders | PdfWriter.AllowModifyContents); document.open(); document.add(new Paragraph("Hello World")); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:SettingPageSizeAndMargins.java
public static void main(String[] args) { Document document = new Document(PageSize.A5, 36, 72, 108, 180); try {/*from w ww.j a va2s .c o m*/ PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeAndMargins.pdf")); document.open(); document.add(new Paragraph("The left margin of this document is 36pt (0.5 inch);")); document.add(new Paragraph("the right margin 72pt (1 inch);")); document.add(new Paragraph("the top margin 108pt (1.5 inch);")); document.add(new Paragraph("the bottom margin 180pt (2.5 inch).")); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:CustomPDFDocumentPageSizePDF.java
public static void main(String[] args) { Rectangle pageSize = new Rectangle(216, 720); Document document = new Document(pageSize); try {/*from w ww.j a v a2s.c o m*/ PdfWriter.getInstance(document, new FileOutputStream("CustomPDFDocumentPageSizePDF.pdf")); document.open(); document.add(new Paragraph("The size of this page is 216x720 points.")); document.add(new Paragraph("216pt / 72 points per inch = 3 inch")); document.add(new Paragraph("720pt / 72 points per inch = 10 inch")); document.add(new Paragraph("The size of this page is 3x10 inch.")); document.add(new Paragraph("3 inch x 2.54 = 7.62 cm")); document.add(new Paragraph("10 inch x 2.54 = 25.4 cm")); document.add(new Paragraph("The size of this page is 7.62x25.4 cm.")); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:SettingPageSizeLEGALNOTE.java
public static void main(String[] args) { Document document = new Document(); try {/* w ww . j a v a2 s . c om*/ PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeLEGALNOTE.pdf")); document.open(); document.add(new Paragraph("First Page.")); document.setPageSize(PageSize.LEGAL); document.newPage(); document.add(new Paragraph("This PageSize is LEGAL.")); document.setPageSize(PageSize.NOTE); document.newPage(); document.add(new Paragraph("This PageSize is NOTE.")); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:FuncEvaluator.java
public static void main(String[] args) { if (args.length != 2) { System.err/*from w ww .j av a 2 s.c om*/ .println("usage: java FuncEvaluator scriptfile " + "script-exp"); return; } ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("rhino"); try { System.out.println(engine.eval(new FileReader(args[0]))); System.out.println(engine.eval(args[1])); } catch (ScriptException se) { System.err.println(se.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } }
From source file:PDFMetaSubjectKeywordsCreatorAuthorCreationDateProducer.java
public static void main(String[] args) { Document document = new Document(); try {//from ww w. j a v a2 s . c o m PdfWriter.getInstance(document, new FileOutputStream("PDFMetaSubjectKeywordsCreatorAuthorCreationDateProducer.pdf")); document.addSubject("the subject"); document.addKeywords("key words"); document.addCreator("this is the creator"); document.addAuthor("author"); document.addCreationDate(); document.addProducer(); document.open(); document.add(new Paragraph("Hello World")); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:Main.java
public static void main(String[] args) { Path dirToDelete = Paths.get("DIR"); FileVisitor<Path> visitor = getFileVisitor(); try {/*w w w .j ava2 s .co m*/ Files.walkFileTree(dirToDelete, visitor); } catch (IOException e) { System.out.println(e.getMessage()); } }
From source file:CreatingAnchorForRTF.java
public static void main(String[] args) { Document document = new Document(); try {//from ww w .j a v a2 s . co m RtfWriter2 rtf = RtfWriter2.getInstance(document, new FileOutputStream("CreatingAnchorForRTF.rtf")); document.open(); document.add(new Paragraph("Some text")); Anchor pdfRef = new Anchor("http://www.java2s.com"); pdfRef.setReference("http://www.java2s.com"); Anchor rtfRef = new Anchor("http://www.java2s.com/aFile.htm"); rtfRef.setReference("http://www.java2s.com/aFile.htm"); document.add(pdfRef); document.add(Chunk.NEWLINE); document.add(rtfRef); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:SettingPageSizeB3B4B5.java
public static void main(String[] args) { Document document = new Document(); try {/*from w ww . j a va 2 s. c o m*/ PdfWriter.getInstance(document, new FileOutputStream("SettingPageSizeB3B4B5.pdf")); document.open(); document.add(new Paragraph("First Page.")); document.setPageSize(PageSize.B3); document.newPage(); document.add(new Paragraph("This PageSize is B3.")); document.setPageSize(PageSize.B4); document.newPage(); document.add(new Paragraph("This PageSize is B4.")); document.setPageSize(PageSize.B5); document.newPage(); document.add(new Paragraph("This PageSize is B5.")); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }