home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 February / PCWorld_2002-02_cd.bin / Software / Vyzkuste / pdflib / pdflib-4.0.1.sit / pdflib-4.0.1 / bind / java / hello.java next >
Encoding:
Java Source  |  2001-07-04  |  915 b   |  44 lines  |  [TEXT/javc]

  1. /* $Id: hello.java,v 1.5.2.1 2001/05/16 12:25:50 york Exp $
  2.  *
  3.  * PDFlib client: hello example in Java
  4.  */
  5.  
  6. import java.io.*;
  7. import com.pdflib.pdflib;
  8.  
  9. public class hello
  10. {
  11.     public static void main (String argv[]) throws
  12.     OutOfMemoryError, IOException, IllegalArgumentException,
  13.     IndexOutOfBoundsException, ClassCastException, ArithmeticException,
  14.     RuntimeException, InternalError, UnknownError
  15.     {
  16.     int font;
  17.     pdflib p;
  18.  
  19.     p = new pdflib();
  20.  
  21.     if (p.open_file("hello.pdf") == -1) {
  22.         System.err.println("Couldn't open PDF file hello.pdf\n");
  23.         System.exit(1);
  24.     }
  25.  
  26.     p.set_info("Creator", "hello.java");
  27.     p.set_info("Author", "Thomas Merz");
  28.     p.set_info("Title", "Hello world (Java)");
  29.  
  30.     p.begin_page(595, 842);
  31.  
  32.     font = p.findfont("Helvetica-Bold", "host", 0);
  33.  
  34.     p.setfont(font, 18);
  35.  
  36.     p.set_text_pos(50, 700);
  37.     p.show("Hello world!");
  38.     p.continue_text("(says Java)");
  39.     p.end_page();
  40.  
  41.     p.close();
  42.     }
  43. }
  44.