EasyReport Print To PDF File Without Dialog window ?

EasyReport Print To PDF File Without Dialog window ?

Postby shri_fwh » Fri Mar 22, 2019 5:57 am

Dear All ,

How to either Print or Generate PDF File to particular folder location without EasyReport Dialog Box. What is COMMAND for that ? Please guide me.


Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: EasyReport Print To PDF File Without Dialog window ?

Postby Otto » Fri Mar 22, 2019 10:48 pm

Hello Shridhar,
if I print PDF files I always print to a pdf-printer. So I never tried build in pdf support.
I change the buttonbar from preview to show only the necessary buttons.
I think it should be possible also with build in function. We need FWSavePreviewToPDF in vrd.prg.
I will look into this on this weekend.
Best regards
Otto

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6319
Joined: Fri Oct 07, 2005 7:07 pm

Re: EasyReport Print To PDF File Without Dialog window ?

Postby shri_fwh » Sat Mar 23, 2019 3:16 pm

Dear Otto ,

In my old (Clipper) application I do print Invoice directly to the printer without any preview.

So EASYREPORT command should be below :

1) Directly to the Default OR Given Name printer

EASYREPORT oVRD NAME "Inv.vrd" TO PRINTER DEFAULT | HP-PRINTER1
PRINTAREA 1 ...
oVRD:End()

2) Directly to the FILE either one of the type PDF , WORD, TEXT

EASYREPORT oVRD NAME "Inv.vrd" TO FILE "C:\APP\OUTPUT\invoice.pdf" TYPE PDF | WORD | TEXT
PRINTAREA 1 ...
oVRD:End()

Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: EasyReport Print To PDF File Without Dialog window ?

Postby Otto » Sat Mar 23, 2019 5:21 pm

Dear Shridhar,
yes you can du that. What is not working - as fare as I know - is PDF. But you can print to a PDF printer.
I send you how to set up EASYREPORT.
Best regards
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6319
Joined: Fri Oct 07, 2005 7:07 pm

Re: EasyReport Print To PDF File Without Dialog window ?

Postby Otto » Sat Mar 23, 2019 5:39 pm

Dear Shridhar,
Code: Select all  Expand view
cDruckerName := "HP-PRINTER1"
lPreview := .F.
EASYREPORT oVRD NAME ".\xVrd\RGA5.vrd"  PREVIEW lPreview TO cDruckerName PRINTDIALOG IIF( lPreview, .F., .F. )



I found out that some printer driver make problems (WLAN ECR printers) if these are not the default printer.
Therefore I change before printing cDruckerName to default printer. I use this code.

Code: Select all  Expand view
//Standarddrucker umstellen vor man das EASYREPORT object erstellt  
coldprinter := StandardDruckerUmstellen( cDruckerName )
EASYREPORT ::oVRD NAME ".\xVrdSchmal\rg.vrd"  PREVIEW lPreview TO cDruckerName PRINTDIALOG IIF( lPreview, .F., .F. )

//nach dem Zerstören des Easyreport objects wieder zurücksetzen
::oVRD:End()
change2default_printer( coldprinter )


local coldprinter  := ""
local cDruckerName := ""
*----------------------------------------------------------

//GetDefaultPrinter() statt Fineprint

cDruckerName := GetPvProfString( "DRUCKER", "Standard"    ,"FinePrint", ".\INI\WINHOTEL.INI" )
coldprinter := StandardDruckerUmstellen( cDruckerName )

change2default_printer( coldprinter )



//coldprinter := StandardDruckerUmstellen( cDruckerName )
function StandardDruckerUmstellen( cDruckerName )
   local coldprinter := prnGetName()            // default printer
   *----------------------------------------------------------

   if len( ALLTRIM( cDruckerName ) )  > 0
      WriteProfString( "windows", "device", cDruckerName ) // change to new printer
      SetPrintDefault( cDruckerName )
      PrinterInit()
      SysRefresh()  

   endif          

return( coldprinter )
//------------------------------------------------------------------------------------------//

function  change2default_printer( coldprinter )

   WriteProfString( "windows", "device",coldprinter) // default printer
   SetPrintDefault(coldprinter)
   PrinterInit()
   SysRefresh()
return nil
//------------------------------------------------------------------------------------------//  
 

Best regards
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6319
Joined: Fri Oct 07, 2005 7:07 pm

Re: EasyReport Print To PDF File Without Dialog window ?

Postby shri_fwh » Mon Mar 25, 2019 4:38 am

Dear Otto ,

Thanks for this information... ! I will check with the Printer as I have HP Printer and will update on this.

But Also we need to print option to the directly PDF File with File Name.


Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: EasyReport Print To PDF File Without Dialog window ?

Postby nageswaragunupudi » Mon Apr 08, 2019 2:11 am

Provided in the next release of FWH

Code: Select all  Expand view

EASYREPORT <oRep> NAME <cRepFileName> [PREVIEW .t.] FILE <cPdfFileName>
 


This directly creates the pdffile with the output. If PREVIEW is set to .t., the pdffile, after creation is displayed.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: EasyReport Print To PDF File Without Dialog window ?

Postby shri_fwh » Mon Apr 08, 2019 4:25 am

Dear Sir ,

Many Thanks for this new feature.

Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: EasyReport Print To PDF File Without Dialog window ?

Postby leandro » Fri May 10, 2019 10:49 pm

Mr Nages

good afternoon

First of all I want to thank you for all the contributions you make to the community.

On the other hand I wanted to know if the functionality to send directly to pdf without going through the preview is already available with fwh1905.

On the other hand, I need to place a QR barcode. I have seen that with the PRINT class it is already working. But I wanted to know if I can do it with EASY REPORT.

Beforehand thank you very much.

Translation by google


****************************************
Mr Nages.

buenas tardes

Primero que todo quiero darle gracias por todos los aportes que realiza a la comunidad.

Por otro lado queria saber si la funcionalidad para enviar directamente a pdf sin pasar por la previsualizacion ya está disponible con fwh1905.

Por otro lado, requiero colocar un código de barras QR. he visto que con la clase PRINT ya está trabajando. Pero quería saber si lo puedo hacer con EASY REPORT.

De antemano muchas gracias.
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1669
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: EasyReport Print To PDF File Without Dialog window ?

Postby nageswaragunupudi » Sun May 12, 2019 2:20 pm

On the other hand I wanted to know if the functionality to send directly to pdf without going through the preview is already available with fwh1905.


Yes, it is working from FWH1903.

On the other hand, I need to place a QR barcode. I have seen that with the PRINT class it is already working. But I wanted to know if I can do it with EASY REPORT.


Create a bar code in the designer like any other barcode and set the barcode type to 17. You may not see qrcode in the designer but you will see in print preview and in the actual print.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: EasyReport Print To PDF File Without Dialog window ?

Postby leandro » Tue May 14, 2019 2:08 pm

Mr. Nages

Thank you very much, I will do the tests and comment.
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1669
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: EasyReport Print To PDF File Without Dialog window ?

Postby leandro » Tue May 14, 2019 3:09 pm

Mr. Nages

good morning

Normally when I create a report in easy report that contains barcode I do it in the following way:

Code: Select all  Expand view

*****************************************
*IMPRESION DE REPORTE
*****************************************
PROC pFactura()
local oReport,Pagina:=nLinea := 1
local vTCRCua:=0,vTCRVal:=0
local vTCan:=vTHoj:=vTSub:=vTota:=0

uFec:=dtoc(date())
uTim:=subs(time(),1,8)

EASYREPORT oVRD NAME "C:\HYMINVEN\HYMMA\REP\FACTURAC.vrd" PREVIEW (.T.) //OF oDlg2

  IF oVRD:lDialogCancel = .T.
    RETURN( .F. )
  ENDIF

  PRINTAREA 1 OF oVRD
  PRINTAREA 2 OF oVRD
  PRINTAREA 6 OF oVRD;
  ITEMIDS {601};
  ITEMVALUES { "Value Code"}
     

END EASYREPORT oVRD

return nil

 


The ER itself is responsible for creating the bar code and drawing it at the time of printing.

As you told me, I changed the type of bar code to 17 "matrix 2 of check digit", but it did not work either.

I do not know the syntax to send the value of the QR code to easy report. I imagine something like this:

Code: Select all  Expand view

  PRINTAREA 6 OF oVRD;
  ITEMIDS {601};
  ITEMVALUES { oVRD:SayBarCode( "Value Code", { 20,20,-20,-20 })}
 


Lo probe asi pero obviamente me dice que el metodo SayBarCode no existe.
Code: Select all  Expand view
Message not found: VRD:SAYBARCODE


Could you please indicate the way to do it?

First of all, Thanks.
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1669
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: EasyReport Print To PDF File Without Dialog window ?

Postby leandro » Tue May 28, 2019 3:16 pm

Good afternoon for all, looking in the forum I found some functions that our friend Cristobal Navararro published, to generate the QR codes to the hard disk. Then as images I add them to the report in ER.

Code: Select all  Expand view

***************
*CREA CODIGO QR
***************
function BarCode(valor)

   local nX       := 18
   local nY       := 18
   local hFont

   local cCode    := valor
   
   DEFINE FONT oFontText NAME "Calibri" SIZE 0, -11
   
   if Empty( hBrush )
      hBrush         := CreateSolidBrush( 0 )
      hZebra         := hb_Zebra_Create_Qrcode( cCode, NIL )
      hb_zebra_draw( hZebra, { | x, y, w, h | nWidth :=  x + w, nHeight := y + h, ;
                               FillRect( dwpri:hDC, { y, x, y + h, x + w }, hBrush ) }, nX, nY, 11, 11 )
      oFontText:Activate( dwpri:hDC )
      DrawText( dwpri:hDC, cCode, { nHeight + 10 , nX - 4, nHeight + 24, nWidth + 4 }, 0 )
      oFontText:DeActivate( dwpri:hDC )
   endif

return nil

******************
*LO GRABA EN DISCO
******************
Function SaveCode(vNomQR)
   local ruta := Pub:DIRLOCAL+Pub:CODEMP+"\REP\"
   local oBmp
   local hGraf
   local hBmp
   local hBrush1  := GdiPlusNewSolidBrush( 255, 255, 255, 255 )
   local hBrush2  := GdiPlusNewSolidBrush( 255, 0, 0, 0 )
   local nombreCodigo := Retorna_Caracter(vNomQR)

   oBmp           := GdiBmp():New()
   hBmp           := GdiPlusBmpFromBrush( nWidth + 18, nHeight + 18, hBrush1 )
   hGraf          := GdiPlusHGraFFromHBmp( hBmp )
   hb_zebra_draw( hZebra, { | x, y, w, h | GdiPlusDrawRect( hGraf, , hBrush2, x, y, w, h ) }, 18, 18, 11, 11 )
   oBmp:hBmp      := hBmp
   GdiPlusDeleteGraphics( hGraf )
   GdiPlusDeleteBrush( hBrush2 )
   GdiPlusDeleteBrush( hBrush1 )
   oBmp:Save( ruta+nombreCodigo+"
.png" )
   oBmp:End()

Return nil

//----------------------------------------------------------------------------//

Testing the code that Mr. Nages told me, I managed to generate a pdf file from the preview to the hard drive, also including the QR code.

Code: Select all  Expand view

EASYREPORT oVRD NAME Pub:DIRLOCAL+Pub:CODEMP+"\REP\factura.vrd" PREVIEW .T. FILE rutaPDF
....
...

END EASYREPORT oVRD
 


The problem that I find now is that it only works well when I enter the system and perform the first preview, send the complete pdf file to the hard disk. But at the moment of generating the second preview whatever it may be, what it generates is a blank page.

I do not know if this is a bug of fw, because it also happens in the preview of the tprint class.

Can someone give me a clue to solve the problem?

translated to english in google
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1669
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: EasyReport Print To PDF File Without Dialog window ?

Postby nageswaragunupudi » Tue May 28, 2019 3:32 pm

The problem that I find now is that it only works well when I enter the system and perform the first preview, send the complete pdf file to the hard disk. But at the moment of generating the second preview whatever it may be, what it generates is a blank page.

I do not know if this is a bug of fw, because it also happens in the preview of the tprint class.


We will look into this and get back to you.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: EasyReport Print To PDF File Without Dialog window ?

Postby nageswaragunupudi » Tue May 28, 2019 4:09 pm

Good afternoon for all, looking in the forum I found some functions that our friend Cristobal Navararro published, to generate the QR codes to the hard disk. Then as images I add them to the report in ER.


To generate QR code and save it to hard-disk, there is no need to write such lengthy code.

This one line code is enough

Code: Select all  Expand view
FW_SaveImage( FW_BarCodeBmp( cText, "QR", nWidth, nHeight ), cBmpFile )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 48 guests