KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > quercus > lib > pdf > PDFModule


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.quercus.lib.pdf;
31
32 import com.caucho.quercus.QuercusModuleException;
33 import com.caucho.quercus.annotation.NotNull;
34 import com.caucho.quercus.annotation.Optional;
35 import com.caucho.quercus.env.BooleanValue;
36 import com.caucho.quercus.env.Env;
37 import com.caucho.quercus.env.Value;
38 import com.caucho.quercus.module.AbstractQuercusModule;
39 import com.caucho.util.L10N;
40 import com.caucho.vfs.Path;
41
42 import java.io.IOException JavaDoc;
43 import java.util.logging.Logger JavaDoc;
44
45 /**
46  * PHP PDF routines.
47  */

48 public class PDFModule extends AbstractQuercusModule {
49   private static final L10N L = new L10N(PDFModule.class);
50
51   private static final Logger JavaDoc log =
52     Logger.getLogger(PDFModule.class.getName());
53
54   /**
55    * Returns true for the mysql extension.
56    */

57   public String JavaDoc []getLoadedExtensions()
58   {
59     return new String JavaDoc[] { "pdf" };
60   }
61
62   /**
63    * Activates a created element.
64    */

65   public static boolean pdf_activate_item(Env env,
66                       @NotNull PDF pdf,
67                       int id)
68   {
69     env.stub("pdf_activate_item");
70
71     return false;
72   }
73
74   /**
75    * Adds an annotation
76    */

77   public static boolean pdf_add_annotation(Env env,
78                       @NotNull PDF pdf)
79   {
80     env.stub("pdf_add_annotation");
81
82     return false;
83   }
84
85   /**
86    * Adds an bookmarkannotation
87    */

88   public static boolean pdf_add_bookmark(Env env,
89                      @NotNull PDF pdf)
90   {
91     env.stub("pdf_add_bookmark");
92
93     return false;
94   }
95
96   /**
97    * Adds an launchlink
98    */

99   public static boolean pdf_add_launchlink(Env env,
100                        @NotNull PDF pdf,
101                        double llx,
102                        double lly,
103                        double urx,
104                        double ury,
105                        String JavaDoc filename)
106   {
107     env.stub("pdf_add_launchlink");
108
109     return false;
110   }
111
112   /**
113    * Adds a locallink
114    */

115   public static boolean pdf_add_locallink(Env env,
116                       @NotNull PDF pdf,
117                       double llx,
118                       double lly,
119                       double urx,
120                       double ury,
121                       int page,
122                       String JavaDoc dest)
123   {
124     env.stub("pdf_add_locallink");
125
126     return false;
127   }
128
129   /**
130    * Creates a named destination
131    */

132   public static boolean pdf_add_nameddest(Env env,
133                       @NotNull PDF pdf,
134                       String JavaDoc name,
135                       @Optional String JavaDoc optlist)
136   {
137     env.stub("pdf_add_nameddest");
138
139     return false;
140   }
141
142   /**
143    * Creates an annotation
144    */

145   public static boolean pdf_add_note(Env env,
146                      @NotNull PDF pdf,
147                      double llx,
148                      double lly,
149                      double urx,
150                      double ury,
151                      String JavaDoc contents,
152                      String JavaDoc title,
153                      String JavaDoc icon,
154                      int open)
155   {
156     env.stub("pdf_add_note");
157
158     return false;
159   }
160
161   /**
162    * Creates an outline
163    */

164   public static boolean pdf_add_outline(Env env,
165                     @NotNull PDF pdf,
166                     String JavaDoc name,
167                     @Optional String JavaDoc optlist)
168   {
169     env.stub("pdf_add_outline");
170
171     return false;
172   }
173
174   /**
175    * Creates a file link annotation
176    */

177   public static boolean pdf_add_pdflink(Env env,
178                     @NotNull PDF pdf,
179                     double llx,
180                     double lly,
181                     double urx,
182                     double ury,
183                     String JavaDoc filename,
184                     int page,
185                     String JavaDoc dest)
186   {
187     env.stub("pdf_add_pdflink");
188
189     return false;
190   }
191
192   /**
193    * Adds a thumbnail
194    */

195   public static boolean pdf_add_thumbnail(Env env,
196                       @NotNull PDF pdf,
197                       @NotNull PDFImage image)
198   {
199     env.stub("pdf_add_thumbnail");
200
201     return false;
202   }
203
204   /**
205    * Adds a web link
206    */

207   public static boolean pdf_add_weblink(Env env,
208                     @NotNull PDF pdf,
209                     double llx,
210                     double lly,
211                     double urx,
212                     double ury,
213                     String JavaDoc url)
214   {
215     env.stub("pdf_add_weblink");
216
217     return false;
218   }
219
220   /**
221    * Creates a counterclockwise arc
222    */

223   public static boolean pdf_arc(@NotNull PDF pdf,
224                 double x1, double y1,
225                 double r, double a, double b)
226   {
227     if (pdf == null)
228       return false;
229       
230     return pdf.arc(x1, y1, r, a, b);
231   }
232
233   /**
234    * Creates a clockwise arc
235    */

236   public static boolean pdf_arcn(@NotNull PDF pdf,
237                 double x1, double y1,
238                 double r, double a, double b)
239   {
240     if (pdf == null)
241       return false;
242     
243     return pdf.arcn(x1, y1, r, a, b);
244   }
245
246   /**
247    * Adds a file attachment
248    */

249   public static boolean pdf_attach_file(Env env,
250                     @NotNull PDF pdf,
251                     double llx,
252                     double lly,
253                     double urx,
254                     double ury,
255                     String JavaDoc filename,
256                     String JavaDoc description,
257                     String JavaDoc author,
258                     String JavaDoc mimetype,
259                     String JavaDoc icon)
260   {
261     env.stub("pdf_attach_file");
262     
263     return false;
264   }
265
266   /**
267    * Starts the document.
268    */

269   public static boolean pdf_begin_document(@NotNull PDF pdf,
270                        @Optional String JavaDoc fileName,
271                        @Optional String JavaDoc optList)
272   {
273     try {
274       if (pdf == null)
275     return false;
276     
277       return pdf.begin_document(fileName, optList);
278     } catch (IOException JavaDoc e) {
279       throw new QuercusModuleException(e);
280     }
281   }
282
283   /**
284    * Starts a font definition
285    */

286   public static boolean pdf_begin_font(Env env,
287                        @NotNull PDF pdf,
288                        String JavaDoc fileName,
289                        double a,
290                        double b,
291                        double c,
292                        double d,
293                        double e,
294                        double f,
295                        @Optional String JavaDoc optList)
296   {
297     env.stub("pdf_begin_font");
298     
299     return false;
300   }
301
302   /**
303    * Starts a glyph definition
304    */

305   public static boolean pdf_begin_glyph(Env env,
306                     @NotNull PDF pdf,
307                     String JavaDoc glyphname,
308                     double wx,
309                     double llx,
310                     double lly,
311                     double urx,
312                     double ury)
313   {
314     env.stub("pdf_begin_glyph");
315     
316     return false;
317   }
318
319   /**
320    * Starts a structure element
321    */

322   public static boolean pdf_begin_item(Env env,
323                        @NotNull PDF pdf,
324                        String JavaDoc tag,
325                        String JavaDoc optlist)
326   {
327     env.stub("pdf_begin_item");
328     
329     return false;
330   }
331
332   /**
333    * Starts a pdf layer
334    */

335   public static boolean pdf_begin_layer(Env env,
336                     @NotNull PDF pdf,
337                     int layer)
338   {
339     env.stub("pdf_begin_layer");
340     
341     return false;
342   }
343
344   /**
345    * Starts the page.
346    */

347   public static boolean pdf_begin_page_ext(@NotNull PDF pdf,
348                        double w, double h,
349                        @Optional String JavaDoc optlist)
350   {
351     try {
352       if (pdf == null)
353     return false;
354     
355       return pdf.begin_page_ext(w, h, optlist);
356     } catch (IOException JavaDoc e) {
357       throw new QuercusModuleException(e);
358     }
359   }
360
361   /**
362    * Starts the page.
363    */

364   public static boolean pdf_begin_page(@NotNull PDF pdf,
365                        double w, double h)
366   {
367     try {
368       if (pdf == null)
369     return false;
370     
371       return pdf.begin_page(w, h);
372     } catch (IOException JavaDoc e) {
373       throw new QuercusModuleException(e);
374     }
375   }
376
377   /**
378    * Starts a pattern
379    */

380   public static boolean pdf_begin_pattern(Env env,
381                       @NotNull PDF pdf,
382                       double w,
383                       double h,
384                       double xStep,
385                       double yStep,
386                       int paintType)
387   {
388     env.stub("pdf_begin_pattern");
389     
390     return false;
391   }
392
393   /**
394    * Starts a template
395    */

396   public static boolean pdf_begin_template(Env env,
397                       @NotNull PDF pdf,
398                       double w,
399                       double h)
400   {
401     env.stub("pdf_begin_template");
402     
403     return false;
404   }
405
406   /**
407    * Draws a circle
408    */

409   public static boolean pdf_circle(@NotNull PDF pdf,
410                    double x,
411                    double y,
412                    double r)
413   {
414     if (pdf == null)
415       return false;
416     
417     return pdf.circle(x, y, r);
418   }
419
420   /**
421    * Clips the path.
422    */

423   public static boolean pdf_clip(@NotNull PDF pdf)
424   {
425     if (pdf == null)
426       return false;
427     
428     return pdf.clip();
429   }
430
431   /**
432    * Closes an image
433    */

434   public static boolean pdf_close_image(Env env,
435                     @NotNull PDF pdf,
436                     PDFImage image)
437   {
438     env.stub("pdf_close_image");
439     
440     return false;
441   }
442
443   /**
444    * Closes a page
445    */

446   public static boolean pdf_close_pdi_page(Env env,
447                        @NotNull PDF pdf,
448                        int page)
449   {
450     env.stub("pdf_close_pdi_page");
451     
452     return false;
453   }
454
455   /**
456    * Closes a document
457    */

458   public static boolean pdf_close_pdi(Env env,
459                       @NotNull PDF pdf,
460                       int doc)
461   {
462     env.stub("pdf_close_pdi");
463     
464     return false;
465   }
466
467   /**
468    * Closes the pdf document.
469    */

470   public static boolean pdf_close(@NotNull PDF pdf)
471   {
472     try {
473       if (pdf == null)
474     return false;
475     
476       return pdf.close();
477     } catch (IOException JavaDoc e) {
478       throw new QuercusModuleException(e);
479     }
480   }
481
482   /**
483    * Closes the path, fill, and stroke it.
484    */

485   public static boolean pdf_closepath_fill_stroke(@NotNull PDF pdf)
486   {
487     if (pdf == null)
488       return false;
489     
490     return pdf.closepath_fill_stroke();
491   }
492
493   /**
494    * Closes the path and stroke it.
495    */

496   public static boolean pdf_closepath_stroke(@NotNull PDF pdf)
497   {
498     if (pdf == null)
499       return false;
500     
501     return pdf.closepath_stroke();
502   }
503
504   /**
505    * Closes the path.
506    */

507   public static boolean pdf_closepath(@NotNull PDF pdf)
508   {
509     if (pdf == null)
510       return false;
511     
512     return pdf.closepath();
513   }
514
515   /**
516    * Concatenates a transformation matrix
517    */

518   public static boolean pdf_concat(@NotNull PDF pdf,
519                    double a,
520                    double b,
521                    double c,
522                    double d,
523                    double e,
524                    double f)
525   {
526     if (pdf == null)
527       return false;
528     
529     return pdf.concat(a, b,c, d, e, f);
530   }
531
532   /**
533    * Continues text at the next line.
534    */

535   public static boolean pdf_continue_text(@NotNull PDF pdf,
536                       String JavaDoc text)
537   {
538     if (pdf == null)
539       return false;
540     
541     return pdf.continue_text(text);
542   }
543
544   /**
545    * Creates an action.
546    */

547   public static boolean pdf_create_action(Env env,
548                       @NotNull PDF pdf,
549                       String JavaDoc type,
550                       @Optional String JavaDoc optList)
551   {
552     env.stub("pdf_create_action");
553     
554     return false;
555   }
556
557   /**
558    * Creates a rectangular annotation
559    */

560   public static boolean pdf_create_annotation(Env env,
561                           @NotNull PDF pdf,
562                           double llx,
563                           double lly,
564                           double urx,
565                           double ury,
566                           String JavaDoc type,
567                           @Optional String JavaDoc optList)
568   {
569     env.stub("pdf_create_annotation");
570     
571     return false;
572   }
573
574   /**
575    * Creates a bookmark
576    */

577   public static boolean pdf_create_bookmark(Env env,
578                         @NotNull PDF pdf,
579                         String JavaDoc text,
580                         @Optional String JavaDoc optList)
581   {
582     env.stub("pdf_create_bookmark");
583     
584     return false;
585   }
586
587   /**
588    * Creates a form field.
589    */

590   public static boolean pdf_create_field(Env env,
591                      @NotNull PDF pdf,
592                      double llx,
593                      double lly,
594                      double urx,
595                      double ury,
596                      String JavaDoc name,
597                      String JavaDoc type,
598                      @Optional String JavaDoc optList)
599   {
600     env.stub("pdf_create_field");
601     
602     return false;
603   }
604
605   /**
606    * Creates a form field group.
607    */

608   public static boolean pdf_create_fieldgroup(Env env,
609                           @NotNull PDF pdf,
610                           String JavaDoc name,
611                           @Optional String JavaDoc optList)
612   {
613     env.stub("pdf_create_fieldgroup");
614     
615     return false;
616   }
617
618   /**
619    * Creates a graphics state
620    */

621   public static boolean pdf_create_gstate(Env env,
622                       @NotNull PDF pdf,
623                       @Optional String JavaDoc optList)
624   {
625     env.stub("pdf_create_gstate");
626     
627     return false;
628   }
629
630   /**
631    * Creates a virtual file
632    */

633   public static boolean pdf_create_pvf(Env env,
634                        @NotNull PDF pdf,
635                        String JavaDoc filename,
636                        String JavaDoc data,
637                        @Optional String JavaDoc optList)
638   {
639     env.stub("pdf_create_pvf");
640     
641     return false;
642   }
643
644   /**
645    * Creates a textflow object
646    */

647   public static boolean pdf_create_textflow(Env env,
648                         @NotNull PDF pdf,
649                         String JavaDoc text,
650                         @Optional String JavaDoc optList)
651   {
652     env.stub("pdf_create_textflow");
653     
654     return false;
655   }
656
657   /**
658    * Draws a bezier curve
659    */

660   public static boolean pdf_curveto(@NotNull PDF pdf,
661                     double x1,
662                     double y1,
663                     double x2,
664                     double y2,
665                     double x3,
666                     double y3)
667   {
668     if (pdf == null)
669       return false;
670     
671     return pdf.curveto(x1, y1, x2, y2, x3, y3);
672   }
673
674   /**
675    * Creates a layer
676    */

677   public static boolean pdf_define_layer(Env env,
678                      @NotNull PDF pdf,
679                      String JavaDoc name,
680                      @Optional String JavaDoc optList)
681   {
682     env.stub("pdf_define_layer");
683     
684     return false;
685   }
686
687   /**
688    * Delete a virtual file
689    */

690   public static boolean pdf_delete_pvf(Env env,
691                        @NotNull PDF pdf,
692                        String JavaDoc name)
693   {
694     env.stub("pdf_delete_pvf");
695     
696     return false;
697   }
698
699   /**
700    * Delete a textflow object
701    */

702   public static boolean pdf_delete_textflow(Env env,
703                         @NotNull PDF pdf,
704                         int textflow)
705   {
706     env.stub("pdf_delete_textflow");
707     
708     return false;
709   }
710
711   /**
712    * Delete the pdf object.
713    */

714   public static boolean pdf_delete(@NotNull PDF pdf)
715   {
716     try {
717       if (pdf == null)
718     return false;
719     
720       return pdf.delete();
721     } catch (IOException JavaDoc e) {
722       throw new QuercusModuleException(e);
723     }
724   }
725
726   /**
727    * Adds a glyph to a custom encoding.
728    */

729   public static boolean pdf_encoding_set_char(Env env,
730                           @NotNull PDF pdf,
731                           String JavaDoc encoding,
732                           int slow,
733                           String JavaDoc glyphname,
734                           int uv)
735   {
736     env.stub("pdf_encoding_set_char");
737
738     return false;
739   }
740
741   /**
742    * Completes the document.
743    */

744   public static boolean pdf_end_document(@NotNull PDF pdf,
745                      @Optional String JavaDoc optlist)
746   {
747     try {
748       if (pdf == null)
749     return false;
750     
751       return pdf.end_document(optlist);
752     } catch (IOException JavaDoc e) {
753       throw new QuercusModuleException(e);
754     }
755   }
756
757   /**
758    * Completes a font definition
759    */

760   public static boolean pdf_end_font(Env env,
761                      @NotNull PDF pdf)
762   {
763     env.stub("pdf_end_font");
764     
765     return false;
766   }
767
768   /**
769    * Completes a glyph definition
770    */

771   public static boolean pdf_end_glyph(Env env,
772                      @NotNull PDF pdf)
773   {
774     env.stub("pdf_end_glyph");
775     
776     return false;
777   }
778
779   /**
780    * Completes a structure element.
781    */

782   public static boolean pdf_end_item(Env env,
783                      @NotNull PDF pdf,
784                      int id)
785   {
786     env.stub("pdf_end_item");
787     
788     return false;
789   }
790
791   /**
792    * Completes a layer
793    */

794   public static boolean pdf_end_layer(Env env,
795                       @NotNull PDF pdf)
796   {
797     env.stub("pdf_end_layer");
798     
799     return false;
800   }
801
802   /**
803    * Completes a page
804    */

805   public static boolean pdf_end_page_ext(@NotNull PDF pdf,
806                      @Optional String JavaDoc optlist)
807   {
808     if (pdf == null)
809       return false;
810     
811     return pdf.end_page_ext(optlist);
812   }
813
814   /**
815    * Completes a page
816    */

817   public static boolean pdf_end_page(@NotNull PDF pdf)
818   {
819     if (pdf == null)
820       return false;
821     
822     return pdf.end_page();
823   }
824
825   /**
826    * Completes a pattern
827    */

828   public static boolean pdf_end_pattern(Env env,
829                     @NotNull PDF pdf)
830   {
831     env.stub("pdf_end_pattern");
832
833     return false;
834   }
835
836   /**
837    * Completes a template
838    */

839   public static boolean pdf_end_template(Env env,
840                      @NotNull PDF pdf)
841   {
842     env.stub("pdf_end_template");
843
844     return false;
845   }
846
847   /**
848    * End the current path.
849    */

850   public static boolean pdf_end_path(@NotNull PDF pdf)
851   {
852     if (pdf == null)
853       return false;
854     
855     return pdf.endpath();
856   }
857
858   /**
859    * Fill the image with data.
860    */

861   public static boolean pdf_fill_imageblock(Env env,
862                         @NotNull PDF pdf,
863                         int page,
864                         String JavaDoc blockname,
865                         int image,
866                         @Optional String JavaDoc optlist)
867   {
868     env.stub("pdf_fill_imageblock");
869     
870     return false;
871   }
872
873   /**
874    * Fill the pdfblock with data.
875    */

876   public static boolean pdf_fill_pdfblock(Env env,
877                       @NotNull PDF pdf,
878                       int page,
879                       String JavaDoc blockname,
880                       int contents,
881                         @Optional String JavaDoc optlist)
882   {
883     env.stub("pdf_fill_pdfblock");
884     
885     return false;
886   }
887
888   /**
889    * Fill and stroke the path.
890    */

891   public static boolean pdf_fill_stroke(@NotNull PDF pdf)
892   {
893     if (pdf == null)
894       return false;
895     
896     return pdf.fill_stroke();
897   }
898
899   /**
900    * Fill the text with data.
901    */

902   public static boolean pdf_fill_textblock(Env env,
903                        @NotNull PDF pdf,
904                        int page,
905                        String JavaDoc block,
906                        String JavaDoc text,
907                        @Optional String JavaDoc optlist)
908   {
909     env.stub("pdf_fill_textblock");
910
911     return false;
912   }
913
914   /**
915    * Fill the path.
916    */

917   public static boolean pdf_fill(@NotNull PDF pdf)
918   {
919     if (pdf == null)
920       return false;
921     
922     return pdf.fill();
923   }
924
925   /**
926    * Loads a font.
927    */

928   public static boolean pdf_findfont(Env env,
929                      @NotNull PDF pdf,
930                      String JavaDoc fontname,
931                      String JavaDoc encoding,
932                      int embed)
933   {
934     env.stub("pdf_findfont");
935     
936     return false;
937   }
938
939   /**
940    * Place an image
941    */

942   public static boolean pdf_fit_image(@NotNull PDF pdf,
943                       @NotNull PDFImage image,
944                       double x,
945                       double y,
946                       @Optional String JavaDoc optlist)
947   {
948     if (pdf == null)
949       return false;
950     
951     return pdf.fit_image(image, x, y, optlist);
952   }
953
954   /**
955    * Place an embedded pdf
956    */

957   public static boolean pdf_fit_pdi_page(Env env,
958                      @NotNull PDF pdf,
959                      int page,
960                      double x,
961                      double y,
962                      @Optional String JavaDoc optlist)
963   {
964     env.stub("pdf_fit_pdi_page");
965
966     return false;
967   }
968
969   /**
970    * Place a textflow object
971    */

972   public static boolean pdf_fit_textflow(Env env,
973                      @NotNull PDF pdf,
974                      int textflow,
975                      double llx,
976                      double lly,
977                      double urx,
978                      double ury,
979                      @Optional String JavaDoc optlist)
980   {
981     env.stub("pdf_fit_textflow");
982
983     return false;
984   }
985
986   /**
987    * Place a line of text.
988    */

989   public static boolean pdf_fit_textline(Env env,
990                      @NotNull PDF pdf,
991                      String JavaDoc text,
992                      double x,
993                      double y,
994                      @Optional String JavaDoc optlist)
995   {
996     env.stub("pdf_fit_textline");
997
998     return false;
999   }
1000
1001  /**
1002   * Returns the name of the last failing function.
1003   */

1004  public static String JavaDoc pdf_get_apiname(Env env,
1005                    @NotNull PDF pdf)
1006  {
1007    env.stub("pdf_get_apiname");
1008
1009    return "";
1010  }
1011
1012  /**
1013   * Returns the buffer with the data.
1014   */

1015  public static Value pdf_get_buffer(Env env,
1016                     @NotNull PDF pdf)
1017  {
1018    if (pdf == null)
1019      return BooleanValue.FALSE;
1020    
1021    return pdf.get_buffer();
1022  }
1023
1024  /**
1025   * Returns the last error message
1026   */

1027  public static String JavaDoc pdf_get_errmsg(PDF pdf)
1028  {
1029    if (pdf != null)
1030      return pdf.get_errmsg();
1031    else
1032      return "";
1033  }
1034
1035  /**
1036   * Returns the last error number
1037   */

1038  public static int pdf_get_errnum(PDF pdf)
1039  {
1040    if (pdf != null)
1041      return pdf.get_errnum();
1042    else
1043      return 0;
1044  }
1045
1046  /**
1047   * Returns the height of an image.
1048   */

1049  public static double pdf_get_image_height(@NotNull PDFImage image)
1050  {
1051    if (image != null)
1052      return image.get_height();
1053    else
1054      return 0;
1055  }
1056
1057  /**
1058   * Returns the width of an image.
1059   */

1060  public static double pdf_get_image_width(@NotNull PDFImage image)
1061  {
1062    if (image != null)
1063      return image.get_width();
1064    else
1065      return 0;
1066  }
1067  
1068  /**
1069   * Returns the result as a string.
1070   */

1071  public static Value pdf_get_buffer(@NotNull PDF pdf)
1072  {
1073    if (pdf != null)
1074      return pdf.get_buffer();
1075    else
1076      return BooleanValue.FALSE;
1077  }
1078  
1079  /**
1080   * Returns the named parameter.
1081   */

1082  public static String JavaDoc pdf_get_parameter(@NotNull PDF pdf,
1083                    String JavaDoc key,
1084                    @Optional double modifier)
1085  {
1086    if (pdf != null)
1087      return pdf.get_parameter(key, modifier);
1088    else
1089      return "";
1090  }
1091  
1092  /**
1093   * Returns the named pdi parameter.
1094   */

1095  public static String JavaDoc pdf_get_pdi_parameter(Env env,
1096                         @NotNull PDF pdf,
1097                         String JavaDoc key,
1098                         int doc,
1099                         int page,
1100                         int reserved)
1101  {
1102    env.stub("pdf_get_pdi_parameter");
1103    
1104    return "";
1105  }
1106  
1107  /**
1108   * Returns the named pdi value.
1109   */

1110  public static double pdf_get_pdi_value(Env env,
1111                         @NotNull PDF pdf,
1112                         String JavaDoc key,
1113                         int doc,
1114                         int page,
1115                         int reserved)
1116  {
1117    env.stub("pdf_get_pdi_value");
1118    
1119    return 0;
1120  }
1121  
1122  /**
1123   * Returns the named parameter.
1124   */

1125  public static double pdf_get_value(@NotNull PDF pdf,
1126                     String JavaDoc key,
1127                     @Optional double modifier)
1128  {
1129    if (pdf != null)
1130      return pdf.get_value(key, modifier);
1131    else
1132      return 0;
1133  }
1134  
1135  /**
1136   * Returns the textflow state
1137   */

1138  public static double pdf_info_textflow(Env env,
1139                     @NotNull PDF pdf,
1140                     int textflow,
1141                     String JavaDoc key)
1142  {
1143    env.stub("pdf_info_textflow");
1144
1145    return 0;
1146  }
1147  
1148  /**
1149   * Resets the graphic state
1150   */

1151  public static boolean pdf_initgraphics(Env env,
1152                     @NotNull PDF pdf)
1153  {
1154    if (pdf != null)
1155      return pdf.initgraphics(env);
1156    else
1157      return false;
1158  }
1159  
1160  /**
1161   * Draw a line from the current position.
1162   */

1163  public static boolean pdf_lineto(@NotNull PDF pdf,
1164                   double x,
1165                   double y)
1166  {
1167    if (pdf == null)
1168      return false;
1169    
1170    return pdf.lineto(x, y);
1171  }
1172  
1173  /**
1174   * Search for a font.
1175   */

1176  public static PDFFont pdf_load_font(@NotNull PDF pdf,
1177                      String JavaDoc fontname,
1178                      String JavaDoc encoding,
1179                      @Optional String JavaDoc optlist)
1180  {
1181    try {
1182      if (pdf == null)
1183    return null;
1184    
1185      return pdf.load_font(fontname, encoding, optlist);
1186    } catch (IOException JavaDoc e) {
1187      throw new QuercusModuleException(e);
1188    }
1189  }
1190  
1191  /**
1192   * Search for an icc profile
1193   */

1194  public static boolean pdf_load_iccprofile(Env env,
1195                        @NotNull PDF pdf,
1196                        String JavaDoc profileName,
1197                        @Optional String JavaDoc optlist)
1198  {
1199    env.stub("pdf_load_iccprofile");
1200
1201    return false;
1202  }
1203  
1204  /**
1205   * Loads an image
1206   */

1207  public static PDFImage pdf_load_image(@NotNull PDF pdf,
1208                    String JavaDoc imageType,
1209                    Path path,
1210                    @Optional String JavaDoc optlist)
1211  {
1212    try {
1213      if (pdf == null)
1214    return null;
1215    
1216      return pdf.load_image(imageType, path, optlist);
1217    } catch (IOException JavaDoc e) {
1218      throw new QuercusModuleException(e);
1219    }
1220  }
1221  
1222  /**
1223   * Finds a spot color
1224   */

1225  public static boolean pdf_makespotcolor(Env env,
1226                      @NotNull PDF pdf,
1227                      String JavaDoc spotname)
1228  {
1229    env.stub("pdf_makespotcolor");
1230
1231    return false;
1232  }
1233  
1234  /**
1235   * Sets the current graphics point.
1236   */

1237  public static boolean pdf_moveto(@NotNull PDF pdf,
1238                   double x,
1239                   double y)
1240  {
1241    if (pdf == null)
1242      return false;
1243    
1244    return pdf.moveto(x, y);
1245  }
1246
1247  /**
1248   * Creates a new PDF object.
1249   */

1250  public static PDF pdf_new(Env env)
1251  {
1252    return new PDF(env);
1253  }
1254
1255  /**
1256   * Opens a file.
1257   */

1258  public static boolean pdf_open_file(@NotNull PDF pdf,
1259                      String JavaDoc filename)
1260  {
1261    return pdf_begin_document(pdf, filename, "");
1262  }
1263
1264  /**
1265   * Opens an image.
1266   */

1267  public static PDFImage pdf_open_image_file(@NotNull PDF pdf,
1268                         String JavaDoc imagetype,
1269                         Path filename,
1270                         String JavaDoc stringparam,
1271                         int intparam)
1272  {
1273    return pdf_load_image(pdf, imagetype, filename, "");
1274  }
1275
1276  /**
1277   * Opens an image.
1278   */

1279  public static boolean pdf_open_image_data(Env env,
1280                         @NotNull PDF pdf,
1281                         String JavaDoc imagetype,
1282                         String JavaDoc source,
1283                         String JavaDoc data,
1284                         long length,
1285                         long width,
1286                         long height,
1287                         int components,
1288                         int bpc,
1289                         String JavaDoc params)
1290  {
1291    env.stub("pdf_open_image_data");
1292    
1293    return false;
1294  }
1295
1296  /**
1297   * Opens an embedded page.
1298   */

1299  public static boolean pdf_open_pdi_page(Env env,
1300                      @NotNull PDF pdf,
1301                      int doc,
1302                      int pagenumber,
1303                      @Optional String JavaDoc optlist)
1304  {
1305    env.stub("pdf_open_pdi_page");
1306
1307    return false;
1308  }
1309
1310  /**
1311   * Opens an embedded document
1312   */

1313  public static boolean pdf_open_pdi(Env env,
1314                     @NotNull PDF pdf,
1315                     String JavaDoc filename,
1316                     @Optional String JavaDoc optlist)
1317  {
1318    env.stub("pdf_open_pdi");
1319
1320    return false;
1321  }
1322
1323  /**
1324   * Place an image.
1325   */

1326  public static boolean pdf_place_image(@NotNull PDF pdf,
1327                    PDFImage image,
1328                    double x,
1329                    double y,
1330                    double scale)
1331  {
1332    return pdf_fit_image(pdf, image, x, y, "");
1333  }
1334
1335  /**
1336   * Place an embedded page.
1337   */

1338  public static boolean pdf_place_pdi_page(Env env,
1339                       @NotNull PDF pdf,
1340                       int page,
1341                       double x,
1342                       double y,
1343                       double scaleX,
1344                       double scaleY)
1345  {
1346    return pdf_fit_pdi_page(env, pdf, page, x, y, "");
1347  }
1348
1349  /**
1350   * Process an imported PDF document.
1351   */

1352  public static boolean pdf_process_pdi(Env env,
1353                    @NotNull PDF pdf,
1354                    int doc,
1355                    int page,
1356                    @Optional String JavaDoc optlist)
1357  {
1358    env.stub("pdf_process_pdi");
1359    
1360    return false;
1361  }
1362  
1363  /**
1364   * Creates a rectangle
1365   */

1366  public static boolean pdf_rect(@NotNull PDF pdf,
1367                 double x, double y,
1368                 double width, double height)
1369  {
1370    if (pdf == null)
1371      return false;
1372    
1373    return pdf.rect(x, y, width, height);
1374  }
1375
1376  /**
1377   * Restores the graphics state.
1378   */

1379  public static boolean pdf_restore(@NotNull PDF pdf)
1380  {
1381    if (pdf == null)
1382      return false;
1383    
1384    return pdf.restore();
1385  }
1386
1387  /**
1388   * Rotate the coordinates.
1389   */

1390  public static boolean pdf_rotate(@NotNull PDF pdf,
1391                   double phi)
1392  {
1393    if (pdf == null)
1394      return false;
1395    
1396    return pdf.rotate(phi);
1397  }
1398
1399  /**
1400   * Save the graphics state.
1401   */

1402  public static boolean pdf_save(@NotNull PDF pdf)
1403  {
1404    if (pdf == null)
1405      return false;
1406    
1407    return pdf.save();
1408  }
1409
1410  /**
1411   * Scale the coordinates.
1412   */

1413  public static boolean pdf_scale(@NotNull PDF pdf,
1414                  double scaleX,
1415                  double scaleY)
1416  {
1417    if (pdf == null)
1418      return false;
1419    
1420    return pdf.scale(scaleX, scaleY);
1421  }
1422
1423  /**
1424   * Sets an annotation border color.
1425   */

1426  public static boolean pdf_set_border_color(Env env,
1427                         @NotNull PDF pdf,
1428                         double red,
1429                         double green,
1430                         double blue)
1431  {
1432    env.stub("pdf_set_border_color");
1433    
1434    return false;
1435  }
1436
1437  /**
1438   * Sets an annotation border dash
1439   */

1440  public static boolean pdf_set_border_dash(Env env,
1441                        @NotNull PDF pdf,
1442                        double black,
1443                        double white)
1444  {
1445    env.stub("pdf_set_border_dash");
1446    
1447    return false;
1448  }
1449
1450  /**
1451   * Sets an annotation border style
1452   */

1453  public static boolean pdf_set_border_style(Env env,
1454                        @NotNull PDF pdf,
1455                        String JavaDoc style,
1456                        double width)
1457  {
1458    env.stub("pdf_set_border_style");
1459    
1460    return false;
1461  }
1462
1463  /**
1464   * Activate a graphics state.
1465   */

1466  public static boolean pdf_set_gstate(Env env,
1467                       @NotNull PDF pdf,
1468                       int gstate)
1469  {
1470    env.stub("pdf_set_gstate");
1471    
1472    return false;
1473  }
1474
1475  /**
1476   * Sets document info.
1477   */

1478  public static boolean pdf_set_info(@NotNull PDF pdf,
1479                     String JavaDoc key,
1480                     String JavaDoc value)
1481  {
1482    if (pdf == null)
1483      return false;
1484    
1485    return pdf.set_info(key, value);
1486  }
1487
1488  /**
1489   * Define a relationship between layers.
1490   */

1491  public static boolean pdf_set_layer_dependency(Env env,
1492                         @NotNull PDF pdf,
1493                         String JavaDoc type,
1494                         @Optional String JavaDoc optlist)
1495  {
1496    env.stub("pdf_set_layer_dependency");
1497    
1498    return false;
1499  }
1500
1501  /**
1502   * Sets a string parameter.
1503   */

1504  public static boolean pdf_set_parameter(@NotNull PDF pdf,
1505                      String JavaDoc key,
1506                      String JavaDoc value)
1507  {
1508    if (pdf != null)
1509      return false;
1510    
1511    return pdf.set_parameter(key, value);
1512  }
1513
1514  /**
1515   * Sets the text position
1516   */

1517  public static boolean pdf_set_text_pos(@NotNull PDF pdf,
1518                     double x,
1519                     double y)
1520  {
1521    if (pdf == null)
1522      return false;
1523    
1524    return pdf.set_text_pos(x, y);
1525  }
1526
1527  /**
1528   * Sets a double parameter.
1529   */

1530  public static boolean pdf_set_value(@NotNull PDF pdf,
1531                      String JavaDoc key,
1532                      double value)
1533  {
1534    if (pdf == null)
1535      return false;
1536    
1537    return pdf.set_value(key, value);
1538  }
1539
1540  /**
1541   * Sets the colorspace and color
1542   */

1543  public static boolean pdf_setcolor(@NotNull PDF pdf,
1544                     String JavaDoc type,
1545                     String JavaDoc colorspace,
1546                     double c1,
1547                     @Optional double c2,
1548                     @Optional double c3,
1549                     @Optional double c4)
1550  {
1551    if (pdf == null)
1552      return false;
1553    
1554    return pdf.setcolor(type, colorspace, c1, c2, c3, c4);
1555  }
1556
1557  /**
1558   * Sets the dashing
1559   */

1560  public static boolean pdf_setdash(@NotNull PDF pdf,
1561                    double black,
1562                    double white)
1563  {
1564    if (pdf == null)
1565      return false;
1566    
1567    return pdf.setdash(black, white);
1568  }
1569
1570  /**
1571   * Sets the dash pattern
1572   */

1573  public static boolean pdf_setdashpattern(Env env,
1574                       @NotNull PDF pdf,
1575                       String JavaDoc optlist)
1576  {
1577    if (pdf == null)
1578      return false;
1579    
1580    return pdf.setdashpattern(env, optlist);
1581  }
1582
1583  /**
1584   * Sets the flatness
1585   */

1586  public static boolean pdf_setflat(Env env,
1587                    @NotNull PDF pdf,
1588                    double flatness)
1589  {
1590    if (pdf == null)
1591      return false;
1592    
1593    return pdf.setflat(env, flatness);
1594  }
1595
1596  /**
1597   * Sets the font size
1598   */

1599  public static boolean pdf_setfont(@NotNull PDF pdf,
1600                    @NotNull PDFFont font,
1601                    double size)
1602  {
1603    try {
1604      if (pdf == null)
1605    return false;
1606    
1607      return pdf.setfont(font, size);
1608    } catch (IOException JavaDoc e) {
1609      throw new QuercusModuleException(e);
1610    }
1611  }
1612
1613  /**
1614   * Sets the fill color to gray
1615   */

1616  public static boolean pdf_setgray_fill(@NotNull PDF pdf,
1617                     double g)
1618  {
1619    if (pdf == null)
1620      return false;
1621    
1622    return pdf.setgray_fill(g);
1623  }
1624
1625  /**
1626   * Sets the stroke color to gray
1627   */

1628  public static boolean pdf_setgray_stroke(@NotNull PDF pdf,
1629                       double g)
1630  {
1631    if (pdf == null)
1632      return false;
1633    
1634    return pdf.setgray_stroke(g);
1635  }
1636
1637  /**
1638   * Sets the color to gray
1639   */

1640  public static boolean pdf_setgray(@NotNull PDF pdf,
1641                    double g)
1642  {
1643    if (pdf == null)
1644      return false;
1645    
1646    return pdf.setgray(g);
1647  }
1648
1649  /**
1650   * Sets the linecap param
1651   */

1652  public static boolean pdf_setlinecap(Env env,
1653                       @NotNull PDF pdf,
1654                       int value)
1655  {
1656    if (pdf == null)
1657      return false;
1658    
1659    return pdf.setlinecap(env, value);
1660  }
1661
1662  /**
1663   * Sets the linejoin param
1664   */

1665  public static boolean pdf_setlinejoin(Env env,
1666                    @NotNull PDF pdf,
1667                    int value)
1668  {
1669    if (pdf == null)
1670      return false;
1671    
1672    return pdf.setlinejoin(env, value);
1673  }
1674
1675  /**
1676   * Sets the line width
1677   */

1678  public static boolean pdf_setlinewidth(@NotNull PDF pdf,
1679                     double width)
1680  {
1681    if (pdf == null)
1682      return false;
1683    
1684    return pdf.setlinewidth(width);
1685  }
1686
1687  /**
1688   * Sets the current transformation matrix
1689   */

1690  public static boolean pdf_setmatrix(Env env,
1691                      @NotNull PDF pdf,
1692                      double a,
1693                      double b,
1694                      double c,
1695                      double d,
1696                      double e,
1697                      double f)
1698  {
1699    if (pdf == null)
1700      return false;
1701    
1702    return pdf.setmatrix(env, a, b, c, d, e, f);
1703  }
1704
1705  /**
1706   * Sets the line miter limit.
1707   */

1708  public static boolean pdf_setmiterlimit(Env env,
1709                      @NotNull PDF pdf,
1710                      double value)
1711  {
1712    if (pdf == null)
1713      return false;
1714    
1715    return pdf.setmiterlimit(env, value);
1716  }
1717
1718  /**
1719   * Sets the fill in rgb
1720   */

1721  public static boolean pdf_setrgbcolor_fill(@NotNull PDF pdf,
1722                         double red,
1723                         double green,
1724                         double blue)
1725  {
1726    if (pdf == null)
1727      return false;
1728    
1729    return pdf.setrgbcolor_fill(red, green, blue);
1730  }
1731
1732  /**
1733   * Sets the stroke in rgb
1734   */

1735  public static boolean pdf_setrgbcolor_stroke(@NotNull PDF pdf,
1736                           double red,
1737                           double green,
1738                           double blue)
1739  {
1740    if (pdf == null)
1741      return false;
1742    
1743    return pdf.setrgbcolor_stroke(red, green, blue);
1744  }
1745
1746  /**
1747   * Sets the color in rgb
1748   */

1749  public static boolean pdf_setrgbcolor(@NotNull PDF pdf,
1750                    double red,
1751                    double green,
1752                    double blue)
1753  {
1754    if (pdf == null)
1755      return false;
1756    
1757    return pdf.setrgbcolor(red, green, blue);
1758  }
1759
1760  /**
1761   * Sets the shading pattern
1762   */

1763  public static boolean pdf_shading_pattern(Env env,
1764                        @NotNull PDF pdf,
1765                        int shading,
1766                        @Optional String JavaDoc optlist)
1767  {
1768    if (pdf == null)
1769      return false;
1770    
1771    return pdf.shading_pattern(env, shading, optlist);
1772  }
1773
1774  /**
1775   * Define a blend
1776   */

1777  public static int pdf_shading(Env env,
1778                @NotNull PDF pdf,
1779                String JavaDoc type,
1780                double x1,
1781                double y1,
1782                double x2,
1783                double y2,
1784                double c1,
1785                double c2,
1786                double c3,
1787                double c4,
1788                @Optional String JavaDoc optlist)
1789  {
1790    if (pdf == null)
1791      return 0;
1792    
1793    return pdf.shading(env, type, x1, y1, x2, y2, c1, c2, c3, c4, optlist);
1794  }
1795
1796  /**
1797   * Fill with a shading object.
1798   */

1799  public static boolean pdf_shfill(Env env,
1800                   @NotNull PDF pdf,
1801                   int shading)
1802  {
1803    if (pdf == null)
1804      return false;
1805    
1806    return pdf.shfill(env, shading);
1807  }
1808
1809  /**
1810   * Output text in a box.
1811   */

1812  public static boolean pdf_show_boxed(Env env,
1813                       @NotNull PDF pdf,
1814                       String JavaDoc text,
1815                       double x,
1816                       double y,
1817                       double width,
1818                       double height,
1819                       String JavaDoc mode,
1820                       @Optional String JavaDoc feature)
1821  {
1822    if (pdf == null)
1823      return false;
1824    
1825    return pdf.show_boxed(text, x, y, width, height, mode, feature);
1826  }
1827
1828  /**
1829   * Output text at a location
1830   */

1831  public static boolean pdf_show_xy(Env env,
1832                    @NotNull PDF pdf,
1833                    String JavaDoc text,
1834                    double x,
1835                    double y)
1836  {
1837    if (pdf == null)
1838      return false;
1839    
1840    return pdf.show_xy(text, x, y);
1841  }
1842
1843  /**
1844   * Output text at the current
1845   */

1846  public static boolean pdf_show(Env env,
1847                 @NotNull PDF pdf,
1848                 String JavaDoc text)
1849  {
1850    if (pdf == null)
1851      return false;
1852    
1853    return pdf.show(text);
1854  }
1855
1856  /**
1857   * Skew the coordinate system.
1858   */

1859  public static boolean pdf_skew(@NotNull PDF pdf,
1860                 double alpha,
1861                 double beta)
1862  {
1863    if (pdf == null)
1864      return false;
1865    
1866    return pdf.skew(alpha, beta);
1867  }
1868
1869  /**
1870   * Returns the width of text in the font.
1871   */

1872  public static double pdf_stringwidth(@NotNull PDF pdf,
1873                       String JavaDoc text,
1874                       @NotNull PDFFont font,
1875                       double size)
1876  {
1877    if (pdf == null)
1878      return 0;
1879    
1880    return pdf.stringwidth(text, font, size);
1881  }
1882
1883  /**
1884   * Strokes the path
1885   */

1886  public static boolean pdf_stroke(@NotNull PDF pdf)
1887  {
1888    if (pdf == null)
1889      return false;
1890    
1891    return pdf.stroke();
1892  }
1893
1894  /**
1895   * Suspend the page.
1896   */

1897  public static boolean pdf_suspend_page(Env env,
1898                     @NotNull PDF pdf,
1899                     @Optional String JavaDoc optlist)
1900  {
1901    env.stub("pdf_suspend_page");
1902    
1903    return false;
1904  }
1905
1906  /**
1907   * Sets the coordinate system origin.
1908   */

1909  public static boolean pdf_translate(@NotNull PDF pdf,
1910                      double x,
1911                      double y)
1912  {
1913    if (pdf == null)
1914      return false;
1915    
1916    return pdf.translate(x, y);
1917  }
1918
1919  /**
1920   * Convert from utf16 to utf8
1921   */

1922  public static String JavaDoc pdf_utf16_to_utf8(Env env,
1923                      @NotNull PDF pdf,
1924                      String JavaDoc utf16string)
1925  {
1926    env.stub("pdf_utf16_to_utf8");
1927    
1928    return utf16string;
1929  }
1930
1931  /**
1932   * Convert from utf8 to utf16
1933   */

1934  public static String JavaDoc pdf_utf8_to_utf16(Env env,
1935                     @NotNull PDF pdf,
1936                      String JavaDoc utf8string)
1937  {
1938    env.stub("pdf_utf16_to_utf8");
1939    
1940    return utf8string;
1941  }
1942}
1943
Popular Tags