Alaska Software Inc. - vpe & xbase
Username: Password:
AuthorTopic: vpe & xbase
Max Z.vpe & xbase
on Tue, 15 Nov 2011 19:30:37 +0100
anyone use vpe print engine ?

is it possible to print a report without show printer dialog, hiding preview 
?
Pablo BotellaRe: vpe & xbase
on Wed, 16 Nov 2011 15:28:43 +0100
> is it possible to print a report without show printer dialog, hiding preview 
> ?
in the paid versions ( std,enh,pro) yes. on the free-comunity version not allowed to print directly

I was published a free wrapper for the version 4 on my web site http://news.xbwin.com/newsgroups.php?art_group=xfree.resources&article_id=11 , 

Also was developed this summer a class for the latest version adding full support for multithread and callbacks, try the free wrapper first and if you need the complete stuff send me a private email ( pb at xbwin dot com ). I was charged 300 EUR to for this wrapper so this will be the price.

Regards,
Pablo Botella
Max Z.Re: vpe & xbase
on Thu, 17 Nov 2011 17:51:34 +0100
i'm testing the free wrapper wrote by Terry Wolfe and an old vpe version.
Which is the xbase code to perform print without showing any window preview 
?

If i use :
    VpePreviewDocSP(hDocument, -1,,,, VPE_SHOW_HIDE )
    VpePrintDoc(hDocument, false )

nothing appear and nothing is printing; it seems there isn't a waiting 
routine to allow the print.






"Pablo Botella" <pb_no_spam_@_remove_all_betwen_underscores_xbwin.com> ha 
scritto nel messaggio 
news:2c7e2ec0$502da8a6$1764a@news.alaska-software.com...
>> is it possible to print a report without show printer dialog, hiding 
>> preview
>> ?
> in the paid versions ( std,enh,pro) yes. on the free-comunity version not 
> allowed to print directly
>
> I was published a free wrapper for the version 4 on my web site 
> http://news.xbwin.com/newsgroups.php?art_group=xfree.resources&article_id=11 ,
>
> Also was developed this summer a class for the latest version adding full 
> support for multithread and callbacks, try the free wrapper first and if 
> you need the complete stuff send me a private email ( pb at xbwin dot 
> com ). I was charged 300 EUR to for this wrapper so this will be the 
> price.
>
> Regards,
> Pablo Botella
>
Osvaldo Ramirez Re: vpe & xbase
on Thu, 17 Nov 2011 10:53:10 -0700
#include "Xbp.ch"
#include "Xbpdev.ch"

#include "Gra.ch"
#include "Font.ch"
#include "ot4xb.ch"
#include "common.ch"
#include "VpeThin.ch"

#define COLOR_BLACK      GraMakeRGBColor({0,     0,   0})
#define COLOR_DKGRAY     GraMakeRGBColor({128, 128, 128})
#define COLOR_GRAY       GraMakeRGBColor({192, 192, 192})
#define COLOR_LTGRAY     GraMakeRGBColor({230, 230, 230})
#define COLOR_WHITE      GraMakeRGBColor({255, 255, 255})
#define COLOR_DKRED      GraMakeRGBColor({128,   0,   0})
#define COLOR_RED        GraMakeRGBColor({192,   0,   0})
#define COLOR_LTRED      GraMakeRGBColor({255,   0,   0})
#define COLOR_DKORANGE   GraMakeRGBColor({255,  64,   0})
#define COLOR_ORANGE     GraMakeRGBColor({255, 128,   0})
#define COLOR_LTORANGE   GraMakeRGBColor({255, 192,   0})
#define COLOR_DKYELLOW   GraMakeRGBColor({224, 224,   0})
#define COLOR_YELLOW     GraMakeRGBColor({242, 242,   0})
#define COLOR_LTYELLOW   GraMakeRGBColor({255, 255,   0})
#define COLOR_DKGREEN    GraMakeRGBColor({0,   128,   0})
#define COLOR_GREEN      GraMakeRGBColor({0,   192,   0})
#define COLOR_LTGREEN    GraMakeRGBColor({0,   255,   0})
#define COLOR_HIGREEN    GraMakeRGBColor({0,   255, 128})
#define COLOR_BLUEGREEN  GraMakeRGBColor({0,   128, 128})
#define COLOR_OLIVE      GraMakeRGBColor({128, 128,   0})
#define COLOR_BROWN      GraMakeRGBColor({128,  80,   0})
#define COLOR_DKBLUE     GraMakeRGBColor({0,     0, 128})
#define COLOR_BLUE       GraMakeRGBColor({0,     0, 255})
#define COLOR_LTBLUE     GraMakeRGBColor({0,   128, 255})
#define COLOR_LTLTBLUE   GraMakeRGBColor({0,   160, 255})
#define COLOR_HIBLUE     GraMakeRGBColor({0,   192, 255})
#define COLOR_CYAN       GraMakeRGBColor({0,   255, 255})
#define COLOR_DKPURPLE   GraMakeRGBColor({128,   0, 128})
#define COLOR_PURPLE     GraMakeRGBColor({192,   0, 192})
#define COLOR_MAGENTA    GraMakeRGBColor({255,   0, 255})

PROCEDURE MAIN
* Begin
   local i
   local cPDFFile , lPreview := .T.

   cPdfFile :=  "c:\temp\test"

   oP := ClassPDF():New( cPDFFile )
   oP:Create( VPAPER_LETTER )

   if ! oP:lInitErr
     oP:StartDoc( cPdfFile )
       for i := 1 to 25
         oP:prLn( i , 10 , "Hola, mundo!"+strzero( i , 4 , 0 ))
       next
     oP:EndDoc( lPreview )
   endif
   oP:Destroy()

return


CLASS ClassPDF

EXPORTED:

   VAR    oPS
   VAR    lInitErr
   VAR    hDoc
   VAR    cPDFFile

   METHOD Init,create
   METHOD destroy
   METHOD endDoc
   METHOD startDoc

   METHOD PrLn   Similar to TopDown


ENDCLASS

METHOD ClassPDF:StartDoc(cJobName)
RETURN nil

METHOD ClassPDF:Init(cPrinterName)
* Begin

   ::cPDFFile    :=  cPrinterName
   ::hDoc        :=  VpeOpenDoc( 0 , cPrinterName , 0 )
   ::lInitErr := .F.
   VpeSetAuthor(   ::hDoc , "Osvaldo Ramirez")
   VpeSetTitle(    ::hDoc , substr(cPrinterName,rat("\",cPrinterName)+1))
   VpeSetSubject(  ::hDoc , substr(cPrinterName,rat( "\" ,cPrinterName )+1))
   VpeSetKeywords( ::hDoc , "Todos los derechos reservados de Osvaldo 
Ramirez")
   VpeSetCreator(  ::hDoc , "Jobb-iSoft Company")

   if ::hDoc = 0
      ::lInitErr := .T.
   endif

RETURN self

 Ahorita solo uso hoja tipoe letter, hay que trabajar en otras medidas
METHOD ClassPDF:Create(nSize)
* begin

   VpeSetPageFormat(::hDoc , nSize)
   VpeSetPictureEmbedInDoc(::hDoc,1)
   VpeSetPictureKeepAspect(::hDoc,1)
   /*
   VpeSet( ::hDoc , VLEFTMARGIN   , 1 )
   VpeSet( ::hDoc , VTOPMARGIN    , 1 )
   VpeSet( ::hDoc , VRIGHTMARGIN  ,19 )
   VpeSet( ::hDoc , VBOTTOMMARGIN ,27 )
   */

RETURN nil

METHOD ClassPDF:destroy()

   ::hDoc      := NIL
   ::cPDFFile  := NIL


RETURN nil

METHOD ClassPDF:EndDoc( lPreview )

   default lPreview to .T.
    Genere el archivo
   VpeWriteDoc( ::hDoc , ::cPDFFile + ".pdf" )
   if lPreview
      VpePreviewDoc( ::hDoc, 0, VPE_SHOW_MAXIMIZED)
   endif
   VpeCloseDoc( ::hDoc )

RETURN nil

/*
METHOD ClassPDF:newpage()
    VpePageBreak( ::hDoc )
    ::nPage ++
RETURN nil
*/

METHOD ClassPDF:PrLn(nRow,nCol,cText)
* Begin
      VpeWrite( ::hDoc , nCol  , nRow , nCol + (len(cText) * .25) , nRow 
+ (25 * .25) ,cText )
RETURN nil


HTH
Osvaldo Ramirez
Pablo BotellaRe: vpe & xbase
on Thu, 17 Nov 2011 21:50:04 +0100
Hi,

> i'm testing the free wrapper wrote by Terry Wolfe and an old vpe version.
> Which is the xbase code to perform print without showing any window preview 
> ?

This wrapper for VPE 3 was working very well on Xbase++ up to 1.82
You can continue using this wrapper with 1.9 except the preview that require a standard windows msgloop running in the same thread.
About VpePrintDoc() at least ( since VPE ver 4 that was the first I was used) was disabled in the comunity-free editions of VPE 

I recommend you to test my free vpethin.ch wrapper http://news.xbwin.com/newsgroups.php?art_group=xfree.resources&article_id=11 
as the simple way.

But if still need to use the VPEv3 with the Terry Wolf's wrapper the workaroound will be something like this

function MyPrintFunction( aDataToPrint )
 don't use database functions here
 don't use Xbase GUI functions here
 use vpe functions here and get the required data from the aDataToPrint parameter
return NIL

the next line will be executed in the Xbase++ GUI thread
delegated_eval( {||  MyPrintFunction( aDataToPrint ) ) 

link with ot4xb.lib to use delegated_eval()


Regards,
Pablo Botella