List of usage examples for java.io FileOutputStream FileOutputStream
public FileOutputStream(FileDescriptor fdObj)
From source file:MainClass.java
License:asdf
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writer2 = PdfWriter.getInstance(document, new FileOutputStream("one_column.pdf")); writer2.setViewerPreferences(PdfWriter.PageLayoutOneColumn); document.open();// ww w. j av a 2 s .com Paragraph hello = new Paragraph("(English:) hello, "); document.add(new Paragraph("asdf")); document.add(hello); document.close(); }
From source file:ImageScalingByPercentPDF.java
public static void main(String[] args) { Document document = new Document(); try {/*from www . java 2 s . c o m*/ PdfWriter.getInstance(document, new FileOutputStream("ImageScalingByPercentPDF.pdf")); document.open(); Image png = Image.getInstance("logo.png"); png.scalePercent(50); document.add(png); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:MainClass.java
License:asdf
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writer5 = PdfWriter.getInstance(document, new FileOutputStream("two_page_left.pdf")); writer5.setPdfVersion(PdfWriter.VERSION_1_5); writer5.setViewerPreferences(PdfWriter.PageLayoutTwoPageLeft); document.open();/*from ww w . j a v a 2 s. c o m*/ Paragraph hello = new Paragraph("(English:) hello, "); document.add(new Paragraph("asdf")); document.add(hello); document.close(); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JarFile jarfile = new JarFile("filename.jar"); Manifest manifest = jarfile.getManifest(); OutputStream fos = new FileOutputStream("manifest"); jarfile.getManifest().write(fos);// w ww . j av a 2s. c o m fos.close(); }
From source file:MainClass.java
License:asdf
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writer6 = PdfWriter.getInstance(document, new FileOutputStream("two_page_right.pdf")); writer6.setPdfVersion(PdfWriter.VERSION_1_5); writer6.setViewerPreferences(PdfWriter.PageLayoutTwoPageRight); document.open();/*from w w w .ja v a2 s . co m*/ Paragraph hello = new Paragraph("(English:) hello, "); document.add(new Paragraph("asdf")); document.add(hello); document.close(); }
From source file:MainClass.java
License:asdf
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writer1 = PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); writer1.setViewerPreferences(PdfWriter.HideMenubar | PdfWriter.CenterWindow); document.addTitle("Hello World"); document.open();//from w ww . j av a 2s. c om Paragraph hello = new Paragraph("(English:) hello, "); document.add(new Paragraph("asdf")); document.add(hello); document.close(); }
From source file:MainClass.java
public static void main(String[] args) { try {/*from w w w .j a v a 2s . c om*/ URL u = new URL("http://www.java2s.com"); OutputStream out = new FileOutputStream("test.htm"); InputStream in = u.openStream(); DTD html = DTD.getDTD("html"); System.out.println(html.getName()); in.close(); out.flush(); out.close(); } catch (Exception e) { System.err.println("Usage: java PageSaver url local_file"); } }
From source file:ImageScalingPercentTwoAxisPDF.java
public static void main(String[] args) { Document document = new Document(); try {/*from w w w . j a v a 2 s .co m*/ PdfWriter.getInstance(document, new FileOutputStream("ImageScalingPercentTwoAxisPDF.pdf")); document.open(); Image png = Image.getInstance("logo.png"); png.scalePercent(100, 50); document.add(png); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:PdfVersion1_2.java
public static void main(String[] args) { Document document = new Document(); try {/*from w ww . j a va2 s . c o m*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("PDFversion1_2.pdf")); writer.setPdfVersion(PdfWriter.VERSION_1_2); document.open(); document.add(new Paragraph("This is a PDF-1.2 document")); } catch (Exception ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:MainClass.java
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("thumb_image.pdf")); writer.setViewerPreferences(PdfWriter.PageModeUseThumbs); document.open();//from www . j a v a 2 s.co m Paragraph hello = new Paragraph("(English:) hello, "); document.add(hello); document.newPage(); document.add(new Paragraph("A")); document.add(hello); document.add(new Paragraph("B")); document.add(hello); document.close(); }