1 29 30 package com.caucho.xtpdoc; 31 32 import com.caucho.config.Config; 33 import com.caucho.vfs.Path; 34 import com.caucho.vfs.Vfs; 35 36 import java.io.IOException ; 37 import java.io.OutputStreamWriter ; 38 import java.io.PrintWriter ; 39 40 public class Printer { 41 public static void main(String []args) 42 { 43 Config config = new Config(); 44 45 if (args.length == 0) { 46 System.out.println("usage: " + Printer.class.getName() + " <book.xml>"); 47 System.exit(1); 48 } 49 50 Path xtpFile = Vfs.lookup(args[0]); 51 Book book = new Book(); 52 53 try { 54 config.configure(book, xtpFile); 55 56 OutputStreamWriter osw = new OutputStreamWriter (System.out); 57 PrintWriter out = new PrintWriter (osw); 58 59 book.writeLaTeX(out); 60 61 osw.close(); 62 out.close(); 63 } catch (IOException e) { 64 System.err.println("Error writing HTML: " + e); 65 } catch (Exception e) { 66 System.err.println("Error configuring document: " + e); 67 68 e.printStackTrace(); 69 } 70 } 71 } 72 | Popular Tags |