Export interface

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Export interface

 

vpxPrint can export a full report or a single page to a graphic file.  This function can be called from within your application or from the preview window.

The large variety of available formats: TIF, JPG, WMF, EMF, TGA, BMP, PNG, AFI, VST, PCX, PCC, DCX, XLS, XLSX, PPT, PPTX, PPS, PPSX

In TIF format, export is multi-pages.

 

You can create image files from scratch, see below.

 

You can choose the TIF compression format with the <TIF> tag:

<TIF>

<TIF=compression format>  

COMPRESSION FORMAT:

NONE

GROUP3_1D

GROUP3_2D

GROUP4

JPEG

PACKBITS

ZLIB

 

·                    default….. GROUP4

 

To be compatible with CCITT FAX compression level 4, you must specify a black and white (BW) parameter. See below.

The JPEG allows the storing of true color images.

When exporting in TIF format and BW colors, the resulting file can be sent over a large variety of FAX interfaces.

 

Syntax:

 

<EXPORT>

<EXPORT=filename[,color] [,WIDTH=nnn]>  

Color:

BW                  Black and white

GRAY16          16 levels of gray

GRAY256        256 levels of gray

COLOR16        16 colors

COLOR256      256 colors

          default….. 65000 colors

 

WIDTH=nnn is used to define the size of the export image in pixels.

Filename must include a valid file extension as described above.

 

<EXPORT=Excel_Filename>

Exports the report to an Excel file. The file is not opened.

Valid suffix are xls and xlsx.

 

<EXPORT=Powerpoint_Filename>

Exports the report to a Powerpoint file.

Valid suffix are ppt, pptx, pps and ppsx.

Powerpoint must be installed.

The properties of the file can be specified with the tag.

 

Examples:

<EXPORT=myFile.tif,BW >

<EXPORT=c:\temp\invoice.EMF,GRAY256>        

<EXPORT=myFile.xls>

 

<PPT:Theme=civic>

<EXPORT=C:/temp/demo.ppsx>

 

 

Technical notes:

When exporting to a file, except with the TIF format, graphical images store only one page.

If the file format is different from TIF, vpxPrint adds a counter at the end of file name.

         <EXPORT=file.jpg>

Generates file0001.jpg, file0002.jpg, file0003.jpg…

Starting with version 10.25g, the new naming convention of output files is as follows:

if there is only one page, no sequence number is appended to the file name, the exact name is used

if more than one page:

1.if "#" characters are present in the file name, they are replaced by the page number with the same format.

Example:

<EXPORT=c:/temp/file###_2019.jpg>

will generate "file001_2019.jpg", "file002_2019.jpg", "file003_2019.jpg"...

2. If no "#" character in the file name, file0001.jpg, file0002.jpg, file0003.jpg… are generated as before

 

 

         <EXPORT=myfile.tif,BW>

Generates a unique tif file "myfile.tif".

 

Due to limits in image formats, some combinations are not valid. For example jpg files must be saved with true colors.

TIF export can create multiple TIF files in a single run.
Each time that an <EXPORT> tag is encountered with a TIF name different from the previous one, a new TIF file is created. It will include all the pages from the current page to the next <EXPORT> or the end of the file.

in the same report, you can have multiple output files:

oimage file (bmp, jpg, tif,png etc.)

oone or more PDF files (<PDF-OUTPUT>)

oan Excel file

oa PowerPoint file

 

 

invoice_folder24 Create an image with vpxPrint

 
The <EXPORT> tag allows creating image files, like .jpg or a lot of different other formats.

 

These files are images of the pages, that means that the images will be the same size as the printer canvas.

In vpxPrint, the tag is used to define the size of the work area. But as it relates to a printer, the setting can be rejected by the printer driver.

It's often the case with real printers, they have limit in size, they use their own margins…

 

The "Microsoft XPS Document writer" is a standard Microsoft driver with no margins and a great flexibility in size. The <FORMAT=CUSTOM,xxx,yyy> will then allow to adjust the canvas to the expected image size.

 

If this driver does not exist on your PC, install it from the Windows "add a new printer" panel.

 

Example:

Creating a jpg file of 25 x 25mm that contains a QRCode of 25x25mm:

 

In the xpr file below:

<PRINTER=Microsoft XPS Document>" directs the ouput to the Microsoft driver,

<FORMAT=CUSTOM,250,250>                  sets the page format to 25x25mm (dimensions are in 10th of millimeters)

 

Sample program:

{xprint.i}

 

DEF STREAM O.

 

DEF VAR xFile   AS CHAR NO-UNDO.

xFile = SESSION:TEMP-DIRECTORY + "Qrcode.xpr".

 

OUTPUT STREAM O TO VALUE(xFile) PAGED PAGE-SIZE 70.

 

PUT STREAM O CONTROL                                        

     "<PRINTER=Microsoft XPS Document>"  /* this printer has no margins and allows */

     "<FORMAT=CUSTOM,250,250>"           /* a flexible "CUSTOM" format             */                        

     "<EXPORT=c:/temp/Qrcode.jpg"

              /*   you can resize the image file, see below (if needed) */

              /* ",WIDTH=150"                                    */

                                   ">"

     "<PREVIEW>"        /* If no preview, delete this line

                           =============================*/

     "<PRINT=NO>"

     /* ================================================================*/                  

        "<UNITS=mm>"

        "<#1>"            /* start position upper left corner           */

        "<AT=+25,+25>"    /* end point 25mm lower and 25mm to the right */

                                                                           

        "<BARCODE#1,TYPE=QRCODE,VALUE="

                        "https://www.4gl.fr"          /* your value here */

        ">"

      /* ================================================================*/                  

      /*                Want to send the image file?                     */

      /* ================================================================*/

            "<MAILNOFILE>"                   /* do no attach any report     */

            "<SENDMAIL=NO-DIALOG>"           /* adjust to your need         */

            "<MAILSUBJECT=The QRCode file>"

            "<MAILTO=johnDoe@company.com CC=me@company.xxx>"

            "<MAILBODY="    escapeHTML("<html>Hello John,<br><br>"

                                                  + "Here is the requested file.<BR><BR>"

                                                  + "Best regards."

                                                  + "</html>"

                                                  )

                                  ">"                   /* end of <MAILBODY>             */

            "<MAILATTACH=QrCode.jpg>"    /* QrCode0001.jpg if version < 10.25g*/

            .                            /* end of tags                       */

     

OUTPUT STREAM O CLOSE.

RUN printFile( xFile ).

 

{          Version < 10.25g

          ============

/*      The file Qrcode0001.jpg" is created, you can rename it

       ======================================================

               ("0001" means 'page 1')

*/

 

OS-DELETE "c:/temp/Qrcode.jpg".

OS-RENAME "c:/temp/Qrcode0001.jpg"   "c:/temp/Qrcode.jpg".

}

 

/*      Delete the xpr file

       =================*/

OS-DELETE VALUE(xFile).