]> saetta.ns0.it Git - reptool/libreptool/commitdiff
Added RptRotation and "rotation" attribute.
authorAndrea Zagli <azagli@libero.it>
Thu, 10 May 2007 11:25:00 +0000 (11:25 +0000)
committerAndrea Zagli <azagli@libero.it>
Thu, 10 May 2007 11:25:00 +0000 (11:25 +0000)
Integration with GtkPrint.
Version 0.0.4

git-svn-id: svn+ssh://saetta.homelinux.org/svn/libreptool/trunk@17 3191ed1d-3fce-41bb-ab4a-0cebc0943b59

17 files changed:
ChangeLog
config.h.in
configure.ac
docs/reference/Makefile.am
docs/reference/libreptool-sections.txt
docs/reference/tmpl/rptcommon.sgml
docs/reference/tmpl/rptobjectimage.sgml
docs/reference/tmpl/rptobjectline.sgml
docs/reference/tmpl/rptobjecttext.sgml
docs/reference/tmpl/rptprint.sgml
src/rptcommon.c
src/rptcommon.h
src/rptprint.c
src/rptprint.h
tests/test_rptprint.c
tests/test_rptreport.c
tests/test_rptreport_creation.c

index 1c5817e3e96c547a335af9bd6c094302b49f9602..bb6cd24858791d1edea16b4b940fd2feadd6e9d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,22 @@
+2007-05-10 Andrea Zagli <azagli@inwind.it>
+
+       * src/rptprint.c: some code adjustments
+
+2007-05-07 Andrea Zagli <azagli@inwind.it>
+
+       * src/rptprint.c: integration with GtkPrint
+
 2007-05-06 Andrea Zagli <azagli@inwind.it>
 
        * src/rptobjecttext.c:
        * src/rptobjectline.c:
        * src/rptobjectimage.c:
        * src/rptobjectrect.c: added attribute "rotation"
+       * configure.ac: some adjustments
+       * src/rptprint.h:
+       * src/rptprint.c: changed prototype of rpt_print_new_from_xml() and
+       rpt_print_new_from_file(); added rpt_print_set_output_type(),
+       rpt_print_set_output_filename() and respective properties
 
 2007-05-05 Andrea Zagli <azagli@inwind.it>
 
index 0e1824b55d0da10aa5571e6d7bb5388a7acc96ba..51006da69d11a50c6226afa10ea98621cec87213 100644 (file)
@@ -1,26 +1,73 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for `alloca.c' support on those systems.
+   */
+#undef CRAY_STACKSEG_END
+
+/* Define to 1 if using `alloca.c'. */
+#undef C_ALLOCA
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
+#undef HAVE_ALLOCA_H
+
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the <libintl.h> header file. */
+#undef HAVE_LIBINTL_H
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+   to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+   and to 0 otherwise. */
+#undef HAVE_REALLOC
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#undef HAVE_STDDEF_H
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
 /* Define to 1 if you have the <stdlib.h> header file. */
 #undef HAVE_STDLIB_H
 
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the `strftime' function. */
+#undef HAVE_STRFTIME
+
 /* Define to 1 if you have the <strings.h> header file. */
 #undef HAVE_STRINGS_H
 
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
+/* Define to 1 if you have the `strstr' function. */
+#undef HAVE_STRSTR
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at runtime.
+       STACK_DIRECTION > 0 => grows toward higher addresses
+       STACK_DIRECTION < 0 => grows toward lower addresses
+       STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
 /* Version number of package */
 #undef VERSION
 
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+   `char[]'. */
+#undef YYTEXT_POINTER
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT32_T
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT8_T
+
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
+
+/* Define to the type of a signed integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int16_t
+
+/* Define to the type of a signed integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int32_t
+
+/* Define to the type of a signed integer type of width exactly 8 bits if such
+   a type exists and the standard includes do not define it. */
+#undef int8_t
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define to rpl_realloc if the replacement function should be used. */
+#undef realloc
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint16_t
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint32_t
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint8_t
index cfa0c3deb4ce204754f5abe7135d0bca908bc939..0eaf68a3a55cf5b6967eba31992e6a7067b5367b 100644 (file)
@@ -13,27 +13,46 @@ AC_LIBTOOL_WIN32_DLL
 AC_CANONICAL_SYSTEM
 
 # Checks for programs.
+AC_PROG_CXX
 AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_LEX
 AC_PROG_LIBTOOL
 GTK_DOC_CHECK
 
 # Checks for libraries.
-PKG_CHECK_MODULES([REPTOOL], [glib-2.0 >= 2.6.0
-                              gobject-2.0 >= 2.6.0
+PKG_CHECK_MODULES([REPTOOL], [gtk+-2.0 >= 2.10.0
                               libxml-2.0 >= 2.6.0
-                              libgda >= 1.2.3
-                              cairo >= 1.0.0
-                              pangocairo >= 1.12])
+                              libgda >= 1.2.3])
 
 AC_SUBST(REPTOOL_CFLAGS)
 AC_SUBST(REPTOOL_LIBS)
 
 # Checks for header files.
+AC_FUNC_ALLOCA
+AC_HEADER_STDC
+AC_CHECK_HEADERS([inttypes.h libintl.h malloc.h stddef.h stdlib.h string.h unistd.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
+AC_TYPE_INT16_T
+AC_TYPE_INT32_T
+AC_TYPE_INT8_T
+AC_TYPE_SIZE_T
+AC_STRUCT_TM
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT8_T
 
 # Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_FUNC_STRFTIME
+AC_FUNC_STRTOD
+AC_CHECK_FUNCS([memset strcasecmp strstr strtol])
 
 AC_CONFIG_FILES([
   libreptool.pc
index 4ff0afdd2bb3d92bf5d4ce25e4e2edc9a446ee34..6b794d541e75d79534949cb369e04fddc0ace30c 100644 (file)
@@ -47,7 +47,7 @@ CFILE_GLOB=$(top_srcdir)/src/*.c
 
 # Header files to ignore when scanning.
 # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
-IGNORE_HFILES=
+IGNORE_HFILES=lexycal.yy.h parser.tab.h
 
 # Images to copy into HTML directory.
 # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
index 788a1df0cc362f1f87f891f399b07eaab4968e0d..939799c199d8d8127f1fa1bc43f9d3f6c7b26dcc 100644 (file)
@@ -22,6 +22,9 @@ RptPrint
 RptPrintOutputType
 rpt_print_new_from_xml
 rpt_print_new_from_file
+rpt_print_print
+rpt_print_set_output_filename
+rpt_print_set_output_type
 <SUBSECTION Standard>
 TYPE_RPT_PRINT
 RPT_PRINT
@@ -156,6 +159,7 @@ rpt_obj_ellipse_get_type
 RptColor
 RptPoint
 RptSize
+RptRotation
 RptFont
 RptBorder
 eRptHAlign
@@ -166,6 +170,8 @@ rpt_common_get_position
 rpt_common_set_position
 rpt_common_get_size
 rpt_common_set_size
+rpt_common_get_rotation
+rpt_common_set_rotation
 rpt_common_get_font
 rpt_common_set_font
 rpt_common_get_border
index 4b5d20bf4de5e06e003a8c3df2a20835ce2a5d2e..a1aee981f60283a2807ec70ea7ec2c01ebf1b3c5 100644 (file)
@@ -43,6 +43,13 @@ Usefull functions and struct.
 @width: 
 @height: 
 
+<!-- ##### STRUCT RptRotation ##### -->
+<para>
+
+</para>
+
+@angle: 
+
 <!-- ##### STRUCT RptFont ##### -->
 <para>
 
@@ -146,6 +153,24 @@ Usefull functions and struct.
 @size: 
 
 
+<!-- ##### FUNCTION rpt_common_get_rotation ##### -->
+<para>
+
+</para>
+
+@xnode: 
+@Returns: 
+
+
+<!-- ##### FUNCTION rpt_common_set_rotation ##### -->
+<para>
+
+</para>
+
+@xnode: 
+@rotation: 
+
+
 <!-- ##### FUNCTION rpt_common_get_font ##### -->
 <para>
 
index 027bdbffd78aa32fbc4570e1eaf7fdeae0d34083..7164c09583f927064bbd5a317f1fb8445c4f494d 100644 (file)
@@ -33,6 +33,11 @@ An image object.
 
 </para>
 
+<!-- ##### ARG RptObjImage:rotation ##### -->
+<para>
+
+</para>
+
 <!-- ##### ARG RptObjImage:size ##### -->
 <para>
 
index 333db8676e884594ee21b57437b54d558cc0ceb4..b786ddee4170d5a08f996b6725e0ccf6244f4e13 100644 (file)
@@ -23,6 +23,11 @@ A line object.
 </para>
 
 
+<!-- ##### ARG RptObjLine:rotation ##### -->
+<para>
+
+</para>
+
 <!-- ##### ARG RptObjLine:size ##### -->
 <para>
 
index 616a8d624dd22002003ef21caeeee79191ee336b..080dfe83f61f13f859ec793d321ff9e282569ed2 100644 (file)
@@ -63,6 +63,11 @@ A textual object.
 
 </para>
 
+<!-- ##### ARG RptObjText:rotation ##### -->
+<para>
+
+</para>
+
 <!-- ##### ARG RptObjText:size ##### -->
 <para>
 
index f5f88022597540aaea0603f76fc7a8c34856d100..4bed7b4611eda28b36842ada40c5193a991425d7 100644 (file)
@@ -23,6 +23,16 @@ Produces the report/print.
 </para>
 
 
+<!-- ##### ARG RptPrint:output-filename ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG RptPrint:output-type ##### -->
+<para>
+
+</para>
+
 <!-- ##### ENUM RptPrintOutputType ##### -->
 <para>
 
@@ -32,6 +42,7 @@ Produces the report/print.
 @RPTP_OUTPUT_PDF: 
 @RPTP_OUTPUT_PS: 
 @RPTP_OUTPUT_SVG: 
+@RPTP_OUTPUT_GTK: 
 
 <!-- ##### FUNCTION rpt_print_new_from_xml ##### -->
 <para>
@@ -39,8 +50,6 @@ Produces the report/print.
 </para>
 
 @xdoc: 
-@output_type: 
-@out_filename: 
 @Returns: 
 
 
@@ -50,8 +59,32 @@ Produces the report/print.
 </para>
 
 @filename: 
-@output_type: 
-@out_filename: 
 @Returns: 
 
 
+<!-- ##### FUNCTION rpt_print_print ##### -->
+<para>
+
+</para>
+
+@rpt_print: 
+
+
+<!-- ##### FUNCTION rpt_print_set_output_filename ##### -->
+<para>
+
+</para>
+
+@rpt_print: 
+@output_filename: 
+
+
+<!-- ##### FUNCTION rpt_print_set_output_type ##### -->
+<para>
+
+</para>
+
+@rpt_print: 
+@output_type: 
+
+
index 34e9eaf4bdeda4c72c396646fae9d03314fd1f82..f1e31b32a10aa3801632b7cd89746b6ceef4df73 100644 (file)
@@ -29,6 +29,8 @@ static gchar *rpt_common_style_to_string (const GArray *style);
  * rpt_common_get_position:
  * @xnode: an #xmlNode.
  *
+ * Returns: an #RptPoint struct that represent the object's position specified
+ * on @xnode.
  */
 RptPoint
 *rpt_common_get_position (xmlNode *xnode)
@@ -70,6 +72,8 @@ rpt_common_set_position (xmlNode *xnode, const RptPoint *position)
  * rpt_common_get_size:
  * @xnode: an #xmlNode.
  *
+ * Returns: an #RptSize struct that represent the object's size specified
+ * on @xnode.
  */
 RptSize
 *rpt_common_get_size (xmlNode *xnode)
@@ -110,6 +114,8 @@ rpt_common_set_size (xmlNode *xnode, const RptSize *size)
  * rpt_common_get_rotation:
  * @xnode: an #xmlNode.
  *
+ * Returns: an #RptRotation struct that represent the object's rotation
+ * specified on @xnode.
  */
 RptRotation
 *rpt_common_get_rotation (xmlNode *xnode)
@@ -146,6 +152,8 @@ rpt_common_set_rotation (xmlNode *xnode, const RptRotation *rotation)
  * rpt_common_get_font:
  * @xnode: an #xmlNode.
  *
+ * Returns: an #RptFont struct that represent the object's font
+ * specified on @xnode.
  */
 RptFont
 *rpt_common_get_font (xmlNode *xnode)
@@ -281,6 +289,8 @@ rpt_common_set_font (xmlNode *xnode, const RptFont *font)
  * rpt_common_get_border:
  * @xnode: an #xmlNode.
  *
+ * Returns: an #RptBorder struct that represent the object's border
+ * specified on @xnode.
  */
 RptBorder
 *rpt_common_get_border (xmlNode *xnode)
@@ -448,6 +458,8 @@ rpt_common_set_border (xmlNode *xnode, const RptBorder *border)
  * rpt_common_get_align:
  * @xnode: an #xmlNode.
  *
+ * Returns: an #RptAlign struct that represent the object's alignment
+ * specified on @xnode.
  */
 RptAlign
 *rpt_common_get_align (xmlNode *xnode)
@@ -541,6 +553,8 @@ rpt_common_set_align (xmlNode *xnode, const RptAlign *align)
  * rpt_common_get_stroke:
  * @xnode: an #xmlNode.
  *
+ * Returns: an #RptStroke struct that represent the object's stroke
+ * specified on @xnode.
  */
 RptStroke
 *rpt_common_get_stroke (xmlNode *xnode)
index ccda9189646d11613ac7fad8e834c66d868bf502..c3e4f03a8995b7bb732726b0505e6ec245375535 100644 (file)
@@ -86,6 +86,21 @@ struct _RptFont
 };
 typedef struct _RptFont RptFont;
 
+/**
+ * RptBorder:
+ * @top_width:
+ * @right_width:
+ * @bottom_width:
+ * @left_width:
+ * @top_color: an #RptColor
+ * @right_color: an #RptColor
+ * @bottom_color: an #RptColor
+ * @left_color: an #RptColor
+ * @top_style: a #GArray of #gdouble values representing dashes sequence
+ * @right_style: a #GArray of #gdouble values representing dashes sequence
+ * @bottom_style: a #GArray of #gdouble values representing dashes sequence
+ * @left_style: a #GArray of #gdouble values representing dashes sequence
+ */
 struct _RptBorder
 {
        gdouble top_width;
@@ -125,6 +140,12 @@ struct _RptAlign
 };
 typedef struct _RptAlign RptAlign;
 
+/**
+ * RptStroke:
+ * @width:
+ * @color: an #RptColor
+ * @style: a #GArray of #gdouble values representing dashes sequence
+ */
 struct _RptStroke
 {
        gdouble width;
index 490f4a991edde5bc798d21d8751e943c9445ad6c..a25b014b166a350daaef4ec631992f6a9e2323ca 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <locale.h>
 
+#include <gtk/gtk.h>
 #include <cairo.h>
 #include <cairo-pdf.h>
 #include <cairo-ps.h>
 #include <cairo-svg.h>
 #include <pango/pangocairo.h>
 #include <pango/pango-attributes.h>
+#include <libxml/xpath.h>
 
 #include "rptprint.h"
 #include "rptcommon.h"
 
 enum
 {
-       PROP_0
+       PROP_0,
+       PROP_OUTPUT_TYPE,
+       PROP_OUTPUT_FILENAME
 };
 
 static void rpt_print_class_init (RptPrintClass *klass);
@@ -47,6 +52,9 @@ static void rpt_print_get_property (GObject *object,
                                     GValue *value,
                                     GParamSpec *pspec);
 
+static void rpt_print_get_xml_page_attributes (RptPrint *rpt_print,
+                                               xmlNode *xml_page);
+
 static void rpt_print_page (RptPrint *rpt_print,
                             xmlNode *xnode);
 static void rpt_print_text_xml (RptPrint *rpt_print,
@@ -75,6 +83,20 @@ static gchar *rpt_print_new_numbered_filename (const gchar *filename, int number
 static void rpt_print_rotate (RptPrint *rpt_print, const RptPoint *position, const RptSize *size, gdouble angle);
 
 
+static void rpt_print_gtk_begin_print (GtkPrintOperation *operation, 
+                                       GtkPrintContext *context,
+                                       gpointer user_data);
+static void rpt_print_gtk_request_page_setup (GtkPrintOperation *operation,
+                                              GtkPrintContext *context,
+                                              gint page_nr,
+                                              GtkPageSetup *setup,
+                                              gpointer user_data);
+static void rpt_print_gtk_draw_page (GtkPrintOperation *operation,
+                                     GtkPrintContext *context,
+                                     gint page_nr,
+                                     gpointer user_data);
+
+
 #define RPT_PRINT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_RPT_PRINT, RptPrintPrivate))
 
 typedef struct _RptPrintPrivate RptPrintPrivate;
@@ -87,8 +109,16 @@ struct _RptPrintPrivate
                gdouble margin_bottom;
                gdouble margin_left;
 
+               xmlDoc *xdoc;
+
+               RptPrintOutputType output_type;
+               gchar *output_filename;
+
+               xmlNodeSet *pages;
+
                cairo_surface_t *surface;
                cairo_t *cr;
+               GtkPrintContext *gtk_print_context;
        };
 
 GType
@@ -128,27 +158,40 @@ rpt_print_class_init (RptPrintClass *klass)
 
        object_class->set_property = rpt_print_set_property;
        object_class->get_property = rpt_print_get_property;
+
+       g_object_class_install_property (object_class, PROP_OUTPUT_TYPE,
+                                        g_param_spec_int ("output-type",
+                                                          "Output Type",
+                                                          "The output type.",
+                                                          RPTP_OUTPUT_PNG, RPTP_OUTPUT_GTK, RPTP_OUTPUT_PDF,
+                                                          G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+       g_object_class_install_property (object_class, PROP_OUTPUT_FILENAME,
+                                        g_param_spec_string ("output-filename",
+                                                             "Output File Name",
+                                                             "The output file's name.",
+                                                             "",
+                                                             G_PARAM_READWRITE));
 }
 
 static void
 rpt_print_init (RptPrint *rpt_print)
 {
+       RptPrintPrivate *priv = RPT_PRINT_GET_PRIVATE (rpt_print);
+
+       priv->output_filename = g_strdup ("");
 }
 
 /**
  * rpt_print_new_from_xml:
  * @xdoc: an #xmlDoc.
- * @output_type:
- * @out_filename:
  *
  * Creates a new #RptPrint object.
  *
  * Returns: the newly created #RptPrint object.
  */
 RptPrint
-*rpt_print_new_from_xml (xmlDoc *xdoc, RptPrintOutputType output_type, const gchar *out_filename)
+*rpt_print_new_from_xml (xmlDoc *xdoc)
 {
-       gchar *prop;
        RptPrint *rpt_print = NULL;
 
        xmlNode *cur = xmlDocGetRootElement (xdoc);
@@ -156,198 +199,287 @@ RptPrint
                {
                        if (strcmp (cur->name, "reptool_report") == 0)
                                {
-                                       FILE *fout;
                                        RptPrintPrivate *priv;
 
-                                       gint npage = 0;
-
                                        rpt_print = RPT_PRINT (g_object_new (rpt_print_get_type (), NULL));
 
                                        priv = RPT_PRINT_GET_PRIVATE (rpt_print);
 
-                                       if (output_type != RPTP_OUTPUT_PNG && output_type != RPTP_OUTPUT_SVG)
+                                       priv->xdoc = xdoc;
+                               }
+                       else
+                               {
+                                       /* TO DO */
+                                       g_warning ("Not a valid RepTool print report format");
+                               }
+               }
+
+       return rpt_print;
+}
+
+/**
+ * rpt_print_new_from_file:
+ * @filename: the path of the xml file to load.
+ *
+ * Creates a new #RptPrint object.
+ *
+ * Returns: the newly created #RptPrint object.
+ */
+RptPrint
+*rpt_print_new_from_file (const gchar *filename)
+{
+       RptPrint *rpt_print = NULL;
+
+       xmlDoc *xdoc = xmlParseFile (filename);
+       if (xdoc != NULL)
+               {
+                       rpt_print = rpt_print_new_from_xml (xdoc);
+               }
+
+       return rpt_print;
+}
+
+/**
+ * rpt_print_set_output_type:
+ * @rpt_print: an #RptPrint object.
+ * @output_type:
+ *
+ */
+void
+rpt_print_set_output_type (RptPrint *rpt_print, RptPrintOutputType output_type)
+{
+       RptPrintPrivate *priv = RPT_PRINT_GET_PRIVATE (rpt_print);
+
+       priv->output_type = output_type;
+}
+
+/**
+ * rpt_print_set_output_filename:
+ * @rpt_print: an #RptPrint object.
+ * @out_filename:
+ *
+ */
+void
+rpt_print_set_output_filename (RptPrint *rpt_print, const gchar *output_filename)
+{
+       RptPrintPrivate *priv = RPT_PRINT_GET_PRIVATE (rpt_print);
+
+       priv->output_filename = g_strdup (output_filename);
+}
+
+/**
+ * rpt_print_print:
+ * @rpt_print: an #RptPrint object.
+ *
+ */
+void
+rpt_print_print (RptPrint *rpt_print)
+{
+       xmlXPathContextPtr xpcontext;
+       xmlXPathObjectPtr xpresult;
+       xmlNodeSetPtr xnodeset;
+
+       FILE *fout;
+       gchar *prop;
+       gint npage = 0;
+
+       RptPrintPrivate *priv = RPT_PRINT_GET_PRIVATE (rpt_print);
+
+       xmlNode *cur = xmlDocGetRootElement (priv->xdoc);
+       if (cur == NULL)
+               {
+                       /* TO DO */
+                       g_warning ("Xml isn't a valid reptool print definition.");
+                       return;
+               }
+       else
+               {
+                       if (xmlStrcmp (cur->name, (const xmlChar *)"reptool_report") != 0)
+                               {
+                                       /* TO DO */
+                                       g_warning ("Xml isn't a valid reptool print definition.");
+                                       return;
+                               }
+               }
+
+       /* find number of pages */
+       xpcontext = xmlXPathNewContext (priv->xdoc);
+
+       xpcontext->node = xmlDocGetRootElement (priv->xdoc);
+       xpresult = xmlXPathEvalExpression ((const xmlChar *)"child::page", xpcontext);
+       if (!xmlXPathNodeSetIsEmpty (xpresult->nodesetval))
+               {
+                       xnodeset = xpresult->nodesetval;
+                       priv->pages = xnodeset;
+               }
+       else
+               {
+                       /* TO DO */
+                       g_warning ("No pages found in xml.");
+                       return;
+               }
+
+       if (priv->output_type == RPTP_OUTPUT_GTK)
+               {
+                       gchar *locale_old;
+                       gchar *locale_num;
+                       GtkPrintOperation *operation;
+
+                       locale_old = setlocale (LC_ALL, NULL);
+                       gtk_init (0, NULL);
+
+                       operation = gtk_print_operation_new ();
+                       g_signal_connect (G_OBJECT (operation), "begin-print",
+                                         G_CALLBACK (rpt_print_gtk_begin_print), (gpointer)rpt_print);
+                       g_signal_connect (G_OBJECT (operation), "request-page-setup",
+                                         G_CALLBACK (rpt_print_gtk_request_page_setup), (gpointer)rpt_print);
+                       g_signal_connect (G_OBJECT (operation), "draw-page",
+                                         G_CALLBACK (rpt_print_gtk_draw_page), (gpointer)rpt_print);
+
+                       locale_num = setlocale (LC_NUMERIC, "C");
+                       gtk_print_operation_run (operation, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, NULL, NULL);
+                       setlocale (LC_NUMERIC, locale_num);
+                       setlocale (LC_ALL, locale_old);
+               }
+       else
+               {
+                       if (strcmp (g_strstrip (priv->output_filename), "") == 0)
+                               {
+                                       switch (priv->output_type)
                                                {
-                                                       fout = fopen (out_filename, "w");
-                                                       if (fout == NULL)
-                                                               {
-                                                                       /* TO DO */
-                                                                       return NULL;
-                                                               }
+                                                       case RPTP_OUTPUT_PNG:
+                                                               priv->output_filename = g_strdup ("reptool.png");
+                                                               break;
+                                                       case RPTP_OUTPUT_PDF:
+                                                               priv->output_filename = g_strdup ("reptool.pdf");
+                                                               break;
+                                                       case RPTP_OUTPUT_PS:
+                                                               priv->output_filename = g_strdup ("reptool.ps");
+                                                               break;
+                                                       case RPTP_OUTPUT_SVG:
+                                                               priv->output_filename = g_strdup ("reptool.svg");
+                                                               break;
+                                               }
+                               }
+                       if (priv->output_type != RPTP_OUTPUT_PNG && priv->output_type != RPTP_OUTPUT_SVG)
+                               {
+                                       fout = fopen (priv->output_filename, "w");
+                                       if (fout == NULL)
+                                               {
+                                                       /* TO DO */
+                                                       return;
                                                }
+                               }
 
-                                       cur = cur->children;
-                                       while (cur != NULL)
+                       for (npage = 0; npage < priv->pages->nodeNr; npage++)
+                               {
+                                       cur = priv->pages->nodeTab[npage];
+                                       if (strcmp (cur->name, "page") == 0)
                                                {
-                                                       if (strcmp (cur->name, "page") == 0)
+                                                       rpt_print_get_xml_page_attributes (rpt_print, cur);
+                                                       if (priv->width != 0 && priv->height != 0)
                                                                {
-                                                                       npage++;
-
-                                                                       prop = xmlGetProp (cur, (const xmlChar *)"width");
-                                                                       if (prop != NULL)
-                                                                               {
-                                                                                       priv->width = strtod (prop, NULL);
-                                                                               }
-                                                                       prop = xmlGetProp (cur, (const xmlChar *)"height");
-                                                                       if (prop != NULL)
-                                                                               {
-                                                                                       priv->height = strtod (prop, NULL);
-                                                                               }
-                                                                       prop = xmlGetProp (cur, (const xmlChar *)"margin-top");
-                                                                       if (prop != NULL)
+                                                                       if (priv->output_type == RPTP_OUTPUT_PNG)
                                                                                {
-                                                                                       priv->margin_top = strtod (prop, NULL);
+                                                                                       priv->surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int)priv->width, (int)priv->height);
                                                                                }
-                                                                       prop = xmlGetProp (cur, (const xmlChar *)"margin-right");
-                                                                       if (prop != NULL)
+                                                                       else if (priv->output_type == RPTP_OUTPUT_PDF && npage == 0)
                                                                                {
-                                                                                       priv->margin_right = strtod (prop, NULL);
+                                                                                       priv->surface = cairo_pdf_surface_create (priv->output_filename, priv->width, priv->height);
                                                                                }
-                                                                       prop = xmlGetProp (cur, (const xmlChar *)"margin-bottom");
-                                                                       if (prop != NULL)
+                                                                       else if (priv->output_type == RPTP_OUTPUT_PS && npage == 0)
                                                                                {
-                                                                                       priv->margin_bottom = strtod (prop, NULL);
+                                                                                       priv->surface = cairo_ps_surface_create (priv->output_filename, priv->width, priv->height);
                                                                                }
-                                                                       prop = xmlGetProp (cur, (const xmlChar *)"margin-left");
-                                                                       if (prop != NULL)
+                                                                       else if (priv->output_type == RPTP_OUTPUT_SVG)
                                                                                {
-                                                                                       priv->margin_left = strtod (prop, NULL);
-                                                                               }
-
-                                                                       if (priv->width != 0 && priv->height != 0)
-                                                                               {
-                                                                                       if (output_type == RPTP_OUTPUT_PNG)
+                                                                                       gchar *new_out_filename = rpt_print_new_numbered_filename (priv->output_filename, npage + 1);
+                                                                                       fout = fopen (new_out_filename, "w");
+                                                                                       if (fout == NULL)
                                                                                                {
-                                                                                                       priv->surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int)priv->width, (int)priv->height);
+                                                                                                       /* TO DO */
+                                                                                                       return;
                                                                                                }
-                                                                                       else if (output_type == RPTP_OUTPUT_PDF && npage == 1)
+               
+                                                                                       priv->surface = cairo_svg_surface_create (new_out_filename, priv->width, priv->height);
+                                                                               }
+               
+                                                                       if (cairo_surface_status (priv->surface) == CAIRO_STATUS_SUCCESS)
+                                                                               {
+                                                                                       if (priv->output_type == RPTP_OUTPUT_PNG || priv->output_type == RPTP_OUTPUT_SVG)
                                                                                                {
-                                                                                                       priv->surface = cairo_pdf_surface_create (out_filename, priv->width, priv->height);
+                                                                                                       priv->cr = cairo_create (priv->surface);
                                                                                                }
-                                                                                       else if (output_type == RPTP_OUTPUT_PS && npage == 1)
+                                                                                       else if (npage == 0)
                                                                                                {
-                                                                                                       priv->surface = cairo_ps_surface_create (out_filename, priv->width, priv->height);
+                                                                                                       priv->cr = cairo_create (priv->surface);
                                                                                                }
-                                                                                       else if (output_type == RPTP_OUTPUT_SVG)
+               
+                                                                                       if (priv->output_type != RPTP_OUTPUT_PNG && priv->output_type != RPTP_OUTPUT_SVG && npage == 0)
                                                                                                {
-                                                                                                       gchar *new_out_filename = rpt_print_new_numbered_filename (out_filename, npage);
-                                                                                                       fout = fopen (new_out_filename, "w");
-                                                                                                       if (fout == NULL)
-                                                                                                               {
-                                                                                                                       /* TO DO */
-                                                                                                                       return NULL;
-                                                                                                               }
-
-                                                                                                       priv->surface = cairo_svg_surface_create (new_out_filename, priv->width, priv->height);
+                                                                                                       cairo_surface_destroy (priv->surface);
                                                                                                }
-
-                                                                                       if (cairo_surface_status (priv->surface) == CAIRO_STATUS_SUCCESS)
+               
+                                                                                       if (cairo_status (priv->cr) == CAIRO_STATUS_SUCCESS)
                                                                                                {
-                                                                                                       if (output_type == RPTP_OUTPUT_PNG || output_type == RPTP_OUTPUT_SVG)
+                                                                                                       rpt_print_page (rpt_print, cur);
+               
+                                                                                                       if (priv->output_type == RPTP_OUTPUT_PNG)
                                                                                                                {
-                                                                                                                       priv->cr = cairo_create (priv->surface);
+                                                                                                                       gchar *new_out_filename = rpt_print_new_numbered_filename (priv->output_filename, npage + 1);
+                                                                                                               
+                                                                                                                       cairo_surface_write_to_png (priv->surface,
+                                                                                                                                                                               new_out_filename);
+                                                                                                                       cairo_surface_destroy (priv->surface);
+                                                                                                                       cairo_destroy (priv->cr);
                                                                                                                }
-                                                                                                       else if (npage == 1)
+                                                                                                       else
                                                                                                                {
-                                                                                                                       priv->cr = cairo_create (priv->surface);
+                                                                                                                       cairo_show_page (priv->cr);
                                                                                                                }
-
-                                                                                                       if (output_type != RPTP_OUTPUT_PNG && output_type != RPTP_OUTPUT_SVG && npage == 1)
+               
+                                                                                                       if (priv->output_type == RPTP_OUTPUT_SVG)
                                                                                                                {
                                                                                                                        cairo_surface_destroy (priv->surface);
+                                                                                                                       cairo_destroy (priv->cr);
+                                                                                                                       fclose (fout);
                                                                                                                }
-
-                                                                                                       if (cairo_status (priv->cr) == CAIRO_STATUS_SUCCESS)
-                                                                                                               {
-                                                                                                                       rpt_print_page (rpt_print, cur);
-
-                                                                                                                       if (output_type == RPTP_OUTPUT_PNG)
-                                                                                                                               {
-                                                                                                                                       gchar *new_out_filename = rpt_print_new_numbered_filename (out_filename, npage);
-                                                                                                                               
-                                                                                                                                       cairo_surface_write_to_png (priv->surface,
-                                                                                                                                                                   new_out_filename);
-                                                                                                                                       cairo_surface_destroy (priv->surface);
-                                                                                                                                       cairo_destroy (priv->cr);
-                                                                                                                               }
-                                                                                                                       else
-                                                                                                                               {
-                                                                                                                                       cairo_show_page (priv->cr);
-                                                                                                                               }
-
-                                                                                                                       if (output_type == RPTP_OUTPUT_SVG)
-                                                                                                                               {
-                                                                                                                                       cairo_surface_destroy (priv->surface);
-                                                                                                                                       cairo_destroy (priv->cr);
-                                                                                                                                       fclose (fout);
-                                                                                                                               }
-                                                                                                               }
-                                                                                                       else
-                                                                                                               {
-                                                                                                                       /* TO DO */
-                                                                                                                       g_warning ("cairo status not sucess: %d", cairo_status (priv->cr));
-                                                                                                               }                                                                                               
                                                                                                }
                                                                                        else
                                                                                                {
                                                                                                        /* TO DO */
-                                                                                                       g_warning ("cairo surface status not sucess");
-                                                                                               }
+                                                                                                       g_warning ("Cairo status not sucess: %d", cairo_status (priv->cr));
+                                                                                               }                                                                                               
                                                                                }
                                                                        else
                                                                                {
                                                                                        /* TO DO */
-                                                                                       g_warning ("page width or height cannot be zero");
+                                                                                       g_warning ("Cairo surface status not sucess");
                                                                                }
                                                                }
                                                        else
                                                                {
                                                                        /* TO DO */
+                                                                       g_warning ("Page width or height cannot be zero");
                                                                }
-
-                                                       cur = cur->next;
-                                               }
-
-                                       if (priv->cr != NULL)
-                                               {
-                                                       cairo_destroy (priv->cr);
                                                }
-                                       if (output_type != RPTP_OUTPUT_PNG && output_type != RPTP_OUTPUT_SVG)
+                                       else
                                                {
-                                                       fclose (fout);
+                                                       /* TO DO */
                                                }
+               
+                                       cur = cur->next;
                                }
-                       else
+               
+                       if (priv->cr != NULL)
                                {
-                                       /* TO DO */
-                                       g_warning ("Not a valid reptool print report format");
+                                       cairo_destroy (priv->cr);
+                               }
+                       if (priv->output_type != RPTP_OUTPUT_PNG && priv->output_type != RPTP_OUTPUT_SVG)
+                               {
+                                       fclose (fout);
                                }
                }
-
-       return rpt_print;
-}
-
-/**
- * rpt_print_new_from_file:
- * @filename: the path of the xml file to load.
- * @output_type:
- * @out_filename:
- *
- * Creates a new #RptPrint object.
- *
- * Returns: the newly created #RptPrint object.
- */
-RptPrint
-*rpt_print_new_from_file (const gchar *filename, RptPrintOutputType output_type, const gchar *out_filename)
-{
-       RptPrint *rpt_print = NULL;
-
-       xmlDoc *xdoc = xmlParseFile (filename);
-       if (xdoc != NULL)
-               {
-                       rpt_print = rpt_print_new_from_xml (xdoc, output_type, out_filename);
-               }
-
-       return rpt_print;
 }
 
 static void
@@ -359,6 +491,14 @@ rpt_print_set_property (GObject *object, guint property_id, const GValue *value,
 
        switch (property_id)
                {
+                       case PROP_OUTPUT_TYPE:
+                               rpt_print_set_output_type (rpt_print, g_value_get_int (value));
+                               break;
+
+                       case PROP_OUTPUT_FILENAME:
+                               rpt_print_set_output_filename (rpt_print, g_value_get_string (value));
+                               break;
+
                        default:
                                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                                break;
@@ -374,12 +514,59 @@ rpt_print_get_property (GObject *object, guint property_id, GValue *value, GPara
 
        switch (property_id)
                {
+                       case PROP_OUTPUT_TYPE:
+                               g_value_set_int (value, priv->output_type);
+                               break;
+
+                       case PROP_OUTPUT_FILENAME:
+                               g_value_set_string (value, priv->output_filename);
+                               break;
+
                        default:
                                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                                break;
                }
 }
 
+static void
+rpt_print_get_xml_page_attributes (RptPrint *rpt_print, xmlNode *xml_page)
+{
+       gchar *prop;
+
+       RptPrintPrivate *priv = RPT_PRINT_GET_PRIVATE (rpt_print);
+
+       prop = xmlGetProp (xml_page, (const xmlChar *)"width");
+       if (prop != NULL)
+               {
+                       priv->width = strtod (prop, NULL);
+               }
+       prop = xmlGetProp (xml_page, (const xmlChar *)"height");
+       if (prop != NULL)
+               {
+                       priv->height = strtod (prop, NULL);
+               }
+       prop = xmlGetProp (xml_page, (const xmlChar *)"margin-top");
+       if (prop != NULL)
+               {
+                       priv->margin_top = strtod (prop, NULL);
+               }
+       prop = xmlGetProp (xml_page, (const xmlChar *)"margin-right");
+       if (prop != NULL)
+               {
+                       priv->margin_right = strtod (prop, NULL);
+               }
+       prop = xmlGetProp (xml_page, (const xmlChar *)"margin-bottom");
+       if (prop != NULL)
+               {
+                       priv->margin_bottom = strtod (prop, NULL);
+               }
+       prop = xmlGetProp (xml_page, (const xmlChar *)"margin-left");
+       if (prop != NULL)
+               {
+                       priv->margin_left = strtod (prop, NULL);
+               }
+}
+
 static void
 rpt_print_page (RptPrint *rpt_print, xmlNode *xnode)
 {
@@ -487,7 +674,14 @@ rpt_print_text_xml (RptPrint *rpt_print, xmlNode *xnode)
                }
 
        /* creating pango layout */
-       playout = pango_cairo_create_layout (priv->cr);
+       /*if (priv->output_type == RPTP_OUTPUT_GTK)
+               {
+                       playout = gtk_print_context_create_pango_layout (priv->gtk_print_context);
+               }
+       else
+               {*/
+                       playout = pango_cairo_create_layout (priv->cr);
+               /*}*/
        if (size != NULL)
                {
                        pango_layout_set_width (playout, (size->width - padding_left - padding_right) * PANGO_SCALE);
@@ -984,3 +1178,64 @@ rpt_print_rotate (RptPrint *rpt_print, const RptPoint *position, const RptSize *
        cairo_rotate (priv->cr, angle * G_PI / 180.);
        cairo_translate (priv->cr, -tx, -ty);
 }
+static void
+rpt_print_gtk_begin_print (GtkPrintOperation *operation, 
+                           GtkPrintContext *context,
+                           gpointer user_data)
+{
+       RptPrint *rpt_print = (RptPrint *)user_data;
+
+       RptPrintPrivate *priv = RPT_PRINT_GET_PRIVATE (rpt_print);
+
+       GtkPageSetup *page_set = gtk_page_setup_new ();
+       gtk_page_setup_set_top_margin (page_set, 0.0, GTK_UNIT_POINTS);
+       gtk_page_setup_set_bottom_margin (page_set, 0.0, GTK_UNIT_POINTS);
+       gtk_page_setup_set_left_margin (page_set, 0.0, GTK_UNIT_POINTS);
+       gtk_page_setup_set_right_margin (page_set, 0.0, GTK_UNIT_POINTS);
+
+       gtk_print_operation_set_default_page_setup (operation, page_set);
+       gtk_print_operation_set_unit (operation, GTK_UNIT_POINTS);
+       gtk_print_operation_set_n_pages (operation, priv->pages->nodeNr);
+}
+
+static void
+rpt_print_gtk_request_page_setup (GtkPrintOperation *operation,
+                                  GtkPrintContext *context,
+                                  gint page_nr,
+                                  GtkPageSetup *setup,
+                                  gpointer user_data)
+{
+       GtkPaperSize *paper_size;
+
+       RptPrint *rpt_print = (RptPrint *)user_data;
+
+       RptPrintPrivate *priv = RPT_PRINT_GET_PRIVATE (rpt_print);
+
+       rpt_print_get_xml_page_attributes (rpt_print, priv->pages->nodeTab[page_nr]);
+       paper_size = gtk_paper_size_new_custom ("reptool",
+                                               "RepTool",
+                                               priv->width,
+                                               priv->height,
+                                               GTK_UNIT_POINTS);
+
+       gtk_page_setup_set_paper_size (setup, paper_size);
+}
+
+static void
+rpt_print_gtk_draw_page (GtkPrintOperation *operation,
+                         GtkPrintContext *context,
+                         gint page_nr,
+                         gpointer user_data)
+{
+       RptPrint *rpt_print = (RptPrint *)user_data;
+
+       RptPrintPrivate *priv = RPT_PRINT_GET_PRIVATE (rpt_print);
+
+       priv->cr = gtk_print_context_get_cairo_context (context);
+       priv->gtk_print_context = context;
+
+       if (priv->width != 0 && priv->height != 0)
+               {
+                       rpt_print_page (rpt_print, priv->pages->nodeTab[page_nr]);
+               }
+}
index 028106aa9fc5b43b6ed733e632f6ec4082ff9688..53ac36172b30503f9c2d0f9cebeb204fccf7572d 100644 (file)
@@ -56,11 +56,17 @@ typedef enum
        RPTP_OUTPUT_PNG,
        RPTP_OUTPUT_PDF,
        RPTP_OUTPUT_PS,
-       RPTP_OUTPUT_SVG
+       RPTP_OUTPUT_SVG,
+       RPTP_OUTPUT_GTK
 } RptPrintOutputType;
 
-RptPrint *rpt_print_new_from_xml (xmlDoc *xdoc, RptPrintOutputType output_type, const gchar *out_filename);
-RptPrint *rpt_print_new_from_file (const gchar *filename, RptPrintOutputType output_type, const gchar *out_filename);
+RptPrint *rpt_print_new_from_xml (xmlDoc *xdoc);
+RptPrint *rpt_print_new_from_file (const gchar *filename);
+
+void rpt_print_set_output_type (RptPrint *rpt_print, RptPrintOutputType output_type);
+void rpt_print_set_output_filename (RptPrint *rpt_print, const gchar *output_filename);
+
+void rpt_print_print (RptPrint *rpt_print);
 
 
 G_END_DECLS
index bc4c945f9051d78472de4fad2881d2f5486c0e06..4f8d264e3ac9ab26b86ccd3c98b01f06405cc1a2 100644 (file)
@@ -25,10 +25,13 @@ main (int argc, char **argv)
 
        g_type_init ();
 
-       rptp = rpt_print_new_from_file (argv[1], RPTP_OUTPUT_PNG, "test.png");
+       rptp = rpt_print_new_from_file (argv[1]);
 
        if (rptp != NULL)
                {
+                       rpt_print_set_output_type (rptp, RPTP_OUTPUT_PNG);
+                       rpt_print_set_output_filename (rptp, "test.png");
+                       rpt_print_print (rptp);
                }
 
        return 0;
index f5e9d71ca0c9c22a0a2080bf53a9b4646df014c9..59409b10af1ae2e1c0e33fe7b6488a9abf93b360 100644 (file)
@@ -64,7 +64,13 @@ main (int argc, char **argv)
                        xmlDoc *rptprint = rpt_report_get_xml_rptprint (rptr);
                        xmlSaveFormatFile ("test_report.rptr", rptprint, 2);
                
-                       rpt_print_new_from_xml (rptprint, RPTP_OUTPUT_PDF, "test.pdf");
+                       rptp = rpt_print_new_from_xml (rptprint);
+                       if (rptp != NULL)
+                               {
+                                       rpt_print_set_output_type (rptp, RPTP_OUTPUT_PDF);
+                                       rpt_print_set_output_filename (rptp, "test.pdf");
+                                       rpt_print_print (rptp);
+                               }
                }
 
        return 0;
index 0e0652c6e384a4b4f51653c3d1593824a915cce8..e526b5f8b43499911f3fcd048356a9ea4d503cc8 100644 (file)
@@ -22,6 +22,7 @@ int
 main (int argc, char **argv)
 {
        RptReport *rptr;
+       RptPrint *rptp;
        RptObject *obj;
        RptPoint point;
        RptSize size;
@@ -105,7 +106,13 @@ main (int argc, char **argv)
                        xmlDoc *rptprint = rpt_report_get_xml_rptprint (rptr);
                        xmlSaveFormatFile ("test_report.rptr", rptprint, 2);
                
-                       rpt_print_new_from_xml (rptprint, RPTP_OUTPUT_PDF, "test.pdf");
+                       rptp = rpt_print_new_from_xml (rptprint);
+                       if (rptp != NULL)
+                               {
+                                       rpt_print_set_output_type (rptp, RPTP_OUTPUT_PDF);
+                                       rpt_print_set_output_filename (rptp, "test.pdf");
+                                       rpt_print_print (rptp);
+                               }
                }
 
        return 0;