com.caucho.quercus.lib.pdf
Class PDF

java.lang.Object
  extended by com.caucho.quercus.lib.pdf.PDF

public class PDF
extends java.lang.Object

pdf object oriented API facade


Constructor Summary
PDF(Env env)
           
 
Method Summary
 int add_page_to_outline(java.lang.String title)
           
 int add_page_to_outline(java.lang.String title, double pos, int parentId)
           
 int add_page_to_outline(java.lang.String title, int parentId)
           
 boolean arc(double x1, double y1, double r, double a, double b)
          Creates a counterclockwise arg
 boolean arcn(double x1, double y1, double r, double a, double b)
          Creates a clockwise arc
 boolean begin_document(java.lang.String fileName, java.lang.String optList)
           
 boolean begin_page_ext(double width, double height, java.lang.String opt)
           
 boolean begin_page(double width, double height)
           
 int charCount(double width, PDFFont font, double size)
           
 boolean circle(double x1, double y1, double r)
          Creates a circle
 boolean clip()
          Appends the current path to the clipping path.
 boolean close()
           
 boolean closepath_fill_stroke()
          Closes the path strokes
 boolean closepath_stroke()
          Closes the path strokes
 boolean closepath()
          Closes the path
 boolean concat(double a, double b, double c, double d, double e, double f)
          Concatenates the matrix
 boolean continue_text(java.lang.String text)
          Displays text
 boolean curveto_b(double x1, double y1, double x2, double y2)
          Draws a bezier curve
 boolean curveto_e(double x1, double y1, double x2, double y2)
          Draws a bezier curve
 boolean curveto(double x1, double y1, double x2, double y2, double x3, double y3)
          Draws a bezier curve
 boolean delete()
           
 boolean end_document(java.lang.String optList)
           
 boolean end_page_ext(java.lang.String optlist)
           
 boolean end_page()
           
 boolean endpath()
          Ends the path
 boolean fill_stroke()
          Fills
 boolean fill()
          Fills
 PDFEmbeddedFile fit_embedded_file(Path path, double x, double y, double width, double height)
          open image
 boolean fit_image(PDFImage img, double x, double y, java.lang.String opt)
           
 Value get_buffer(Env env)
          Returns the result as a string.
 java.lang.String get_errmsg()
          Returns the error message.
 int get_errnum()
          Returns the error number.
 java.lang.String get_parameter(java.lang.String name, double modifier)
          Returns the value for a parameter.
 double get_value(java.lang.String name, double modifier)
          Returns the value for a parameter.
 boolean initgraphics(Env env)
           
 boolean lineto(double x, double y)
          Sets the graphics position.
 PDFFont load_font(java.lang.String name, java.lang.String encoding, java.lang.String opt)
          Loads a font for later use.
 PDFImage load_image(java.lang.String type, Path file, java.lang.String optlist)
          open image
 boolean moveto(double x, double y)
          Sets the graphics position.
 PDFImage open_image_file(java.lang.String type, Path file, java.lang.String stringParam, int intParam)
          open image
 boolean rect(double x, double y, double width, double height)
          Creates a rectangle
 boolean restore()
          Restores the graphics state.
 boolean rotate(double pDeg)
          rotates the coordinates
 boolean save()
          Saves the graphics state.
 boolean scale(double sx, double sy)
          scales the coordinates
 boolean set_info(java.lang.String key, java.lang.String value)
           
 boolean set_parameter(java.lang.String key, java.lang.String value)
           
 boolean set_text_pos(double x, double y)
          Sets the text position.
 boolean set_value(java.lang.String key, double value)
           
 boolean setcolor(java.lang.String fstype, java.lang.String colorspace, double c1, double c2, double c3, double c4)
          Sets the color
 boolean setdash(double b, double w)
          Sets the dashing
 boolean setdashpattern(Env env, java.lang.String optlist)
          Sets the dashing
 boolean setflat(Env env, double flatness)
          Sets the flatness
 boolean setfont(PDFFont font, double size)
          Sets the current font
 boolean setgray_fill(double g)
          Sets the color to a grayscale
 boolean setgray_stroke(double g)
          Sets the color to a grayscale
 boolean setgray(double g)
          Sets the color to a grayscale
 boolean setlinecap(Env env, int cap)
          Sets the linecap style
 boolean setlinejoin(Env env, int linejoin)
          Sets the linejoin style
 boolean setlinewidth(double w)
          Sets the line width
 boolean setmatrix(Env env, double a, double b, double c, double d, double e, double f)
          Sets the matrix style
 boolean setmiterlimit(Env env, double v)
          Sets the miter limit
 boolean setrgbcolor_fill(double r, double g, double b)
          Sets the fill color to a rgb
 boolean setrgbcolor_stroke(double r, double g, double b)
          Sets the color to a rgb
 boolean setrgbcolor(double r, double g, double b)
          Sets the color to a rgb
 boolean shading_pattern(Env env, int shading, java.lang.String optlist)
          Sets the shading pattern
 int shading(Env env, java.lang.String type, double x1, double y1, double x2, double y2, double c1, double c2, double c3, double c4, java.lang.String optlist)
          Define a blend
 boolean shfill(Env env, int shading)
          Fill with a shading object.
 boolean show_boxed(java.lang.String text, double x, double y, double width, double height, java.lang.String mode, java.lang.String feature)
          Displays text
 boolean show_xy(java.lang.String text, double x, double y)
          Displays text
 boolean show(java.lang.String text)
          Displays text
 boolean skew(double aDeg, double bDeg)
          Skews the coordinates
 double stringwidth(java.lang.String string, PDFFont font, double size)
          Returns the length of a string for a font.
 boolean stroke()
          Draws the graph
 java.lang.String toString()
           
 boolean translate(double tx, double ty)
          translates the coordinates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PDF

public PDF(Env env)
Method Detail

begin_document

public boolean begin_document(java.lang.String fileName,
                              java.lang.String optList)
                       throws java.io.IOException
Throws:
java.io.IOException

begin_page

public boolean begin_page(double width,
                          double height)
                   throws java.io.IOException
Throws:
java.io.IOException

begin_page_ext

public boolean begin_page_ext(double width,
                              double height,
                              java.lang.String opt)
                       throws java.io.IOException
Throws:
java.io.IOException

add_page_to_outline

public int add_page_to_outline(java.lang.String title)

add_page_to_outline

public int add_page_to_outline(java.lang.String title,
                               int parentId)

add_page_to_outline

public int add_page_to_outline(java.lang.String title,
                               double pos,
                               int parentId)

set_info

public boolean set_info(java.lang.String key,
                        java.lang.String value)

set_parameter

public boolean set_parameter(java.lang.String key,
                             java.lang.String value)

set_value

public boolean set_value(java.lang.String key,
                         double value)

get_buffer

public Value get_buffer(Env env)
Returns the result as a string.


get_errmsg

public java.lang.String get_errmsg()
Returns the error message.


get_errnum

public int get_errnum()
Returns the error number.


get_parameter

public java.lang.String get_parameter(java.lang.String name,
                                      double modifier)
Returns the value for a parameter.


get_value

public double get_value(java.lang.String name,
                        double modifier)
Returns the value for a parameter.


initgraphics

public boolean initgraphics(Env env)

load_font

public PDFFont load_font(java.lang.String name,
                         java.lang.String encoding,
                         java.lang.String opt)
                  throws java.io.IOException
Loads a font for later use.

Parameters:
name - the font name, e.g. Helvetica
encoding - the font encoding, e.g. winansi
opt - any options
Throws:
java.io.IOException

setdash

public boolean setdash(double b,
                       double w)
Sets the dashing

Parameters:
b - black length
w - which length

setdashpattern

public boolean setdashpattern(Env env,
                              java.lang.String optlist)
Sets the dashing


setflat

public boolean setflat(Env env,
                       double flatness)
Sets the flatness


setlinecap

public boolean setlinecap(Env env,
                          int cap)
Sets the linecap style


setlinejoin

public boolean setlinejoin(Env env,
                           int linejoin)
Sets the linejoin style


setfont

public boolean setfont(PDFFont font,
                       double size)
                throws java.io.IOException
Sets the current font

Parameters:
name - the font name, e.g. Helvetica
encoding - the font encoding, e.g. winansi
opt - any options
Throws:
java.io.IOException

setmatrix

public boolean setmatrix(Env env,
                         double a,
                         double b,
                         double c,
                         double d,
                         double e,
                         double f)
Sets the matrix style


setmiterlimit

public boolean setmiterlimit(Env env,
                             double v)
Sets the miter limit


shading_pattern

public boolean shading_pattern(Env env,
                               int shading,
                               java.lang.String optlist)
Sets the shading pattern


shading

public int shading(Env env,
                   java.lang.String type,
                   double x1,
                   double y1,
                   double x2,
                   double y2,
                   double c1,
                   double c2,
                   double c3,
                   double c4,
                   java.lang.String optlist)
Define a blend


shfill

public boolean shfill(Env env,
                      int shading)
Fill with a shading object.


stringwidth

public double stringwidth(java.lang.String string,
                          PDFFont font,
                          double size)
Returns the length of a string for a font.


charCount

public int charCount(double width,
                     PDFFont font,
                     double size)

set_text_pos

public boolean set_text_pos(double x,
                            double y)
Sets the text position.


fill

public boolean fill()
Fills


closepath

public boolean closepath()
Closes the path


clip

public boolean clip()
Appends the current path to the clipping path.


closepath_stroke

public boolean closepath_stroke()
Closes the path strokes


closepath_fill_stroke

public boolean closepath_fill_stroke()
Closes the path strokes


fill_stroke

public boolean fill_stroke()
Fills


endpath

public boolean endpath()
Ends the path


curveto

public boolean curveto(double x1,
                       double y1,
                       double x2,
                       double y2,
                       double x3,
                       double y3)
Draws a bezier curve


curveto_b

public boolean curveto_b(double x1,
                         double y1,
                         double x2,
                         double y2)
Draws a bezier curve


curveto_e

public boolean curveto_e(double x1,
                         double y1,
                         double x2,
                         double y2)
Draws a bezier curve


arc

public boolean arc(double x1,
                   double y1,
                   double r,
                   double a,
                   double b)
Creates a counterclockwise arg


arcn

public boolean arcn(double x1,
                    double y1,
                    double r,
                    double a,
                    double b)
Creates a clockwise arc


circle

public boolean circle(double x1,
                      double y1,
                      double r)
Creates a circle


lineto

public boolean lineto(double x,
                      double y)
Sets the graphics position.


moveto

public boolean moveto(double x,
                      double y)
Sets the graphics position.


rect

public boolean rect(double x,
                    double y,
                    double width,
                    double height)
Creates a rectangle


setgray_stroke

public boolean setgray_stroke(double g)
Sets the color to a grayscale


setgray_fill

public boolean setgray_fill(double g)
Sets the color to a grayscale


setgray

public boolean setgray(double g)
Sets the color to a grayscale


setrgbcolor_stroke

public boolean setrgbcolor_stroke(double r,
                                  double g,
                                  double b)
Sets the color to a rgb


setrgbcolor_fill

public boolean setrgbcolor_fill(double r,
                                double g,
                                double b)
Sets the fill color to a rgb


setrgbcolor

public boolean setrgbcolor(double r,
                           double g,
                           double b)
Sets the color to a rgb


setcolor

public boolean setcolor(java.lang.String fstype,
                        java.lang.String colorspace,
                        double c1,
                        double c2,
                        double c3,
                        double c4)
Sets the color


setlinewidth

public boolean setlinewidth(double w)
Sets the line width


concat

public boolean concat(double a,
                      double b,
                      double c,
                      double d,
                      double e,
                      double f)
Concatenates the matrix


open_image_file

public PDFImage open_image_file(java.lang.String type,
                                Path file,
                                java.lang.String stringParam,
                                int intParam)
                         throws java.io.IOException
open image

Throws:
java.io.IOException

load_image

public PDFImage load_image(java.lang.String type,
                           Path file,
                           java.lang.String optlist)
                    throws java.io.IOException
open image

Throws:
java.io.IOException

fit_image

public boolean fit_image(PDFImage img,
                         double x,
                         double y,
                         java.lang.String opt)

fit_embedded_file

public PDFEmbeddedFile fit_embedded_file(Path path,
                                         double x,
                                         double y,
                                         double width,
                                         double height)
                                  throws java.io.IOException
open image

Throws:
java.io.IOException

skew

public boolean skew(double aDeg,
                    double bDeg)
Skews the coordinates

Parameters:
a - degrees to skew the x axis
b - degrees to skew the y axis

scale

public boolean scale(double sx,
                     double sy)
scales the coordinates

Parameters:
sx - amount to scale the x axis
sy - amount to scale the y axis

translate

public boolean translate(double tx,
                         double ty)
translates the coordinates

Parameters:
tx - amount to translate the x axis
ty - amount to translate the y axis

rotate

public boolean rotate(double pDeg)
rotates the coordinates

Parameters:
p - amount to rotate

save

public boolean save()
Saves the graphics state.


restore

public boolean restore()
Restores the graphics state.


show

public boolean show(java.lang.String text)
Displays text


show_boxed

public boolean show_boxed(java.lang.String text,
                          double x,
                          double y,
                          double width,
                          double height,
                          java.lang.String mode,
                          java.lang.String feature)
Displays text


show_xy

public boolean show_xy(java.lang.String text,
                       double x,
                       double y)
Displays text


stroke

public boolean stroke()
Draws the graph


continue_text

public boolean continue_text(java.lang.String text)
Displays text


end_page

public boolean end_page()

end_page_ext

public boolean end_page_ext(java.lang.String optlist)

end_document

public boolean end_document(java.lang.String optList)
                     throws java.io.IOException
Throws:
java.io.IOException

close

public boolean close()
              throws java.io.IOException
Throws:
java.io.IOException

delete

public boolean delete()
               throws java.io.IOException
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object