FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour EasyReport Print To PDF File Without Dialog window ?
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: EasyReport Print To PDF File Without Dialog window ?
Posted: Tue May 28, 2019 05:37 PM
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oWnd
   local cText, hBmp

   cText    := "To generate QR code and save it to hard-disk," + CRLF + ;
               "there is no need to write such lengthy code. This one line code is enough" + CRLF + ;
               "FW_SaveImage( FW_BarCodeBmp( cText, 'QR', nWidth, nHeight ), cBmpFile )"

   hBmp     := FW_BarCodeBmp( cText, "QR", 256, 256 )
   FW_SaveImage( hBmp, "QRTEST.BMP" )
   DeleteObject( hBmp )

   DEFINE WINDOW oWnd
   ACTIVATE WINDOW oWnd CENTERED ;
      ON PAINT oWnd:DrawImage( "QRTEST.BMP" )

return nil


Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: EasyReport Print To PDF File Without Dialog window ?
Posted: Wed May 29, 2019 06:29 AM
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?


We checked this and found that it is failing when there is a file with the same name is already existing on the hard disk.
So, first delete the file and then create the pdf like this:
Code (fw): Select all Collapse
   FERASE( "report1.pdf" )
   PRINT oPrn FILE "report1.pdf"

From FWH1905, you need not yourself delete the existing file. FWH library will do this before creating the new PDF.
Can you please test and confirm?
Regards



G. N. Rao.

Hyderabad, India
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Re: EasyReport Print To PDF File Without Dialog window ?
Posted: Wed May 29, 2019 05:19 PM
nageswaragunupudi wrote:
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oWnd
   local cText, hBmp

   cText    := "To generate QR code and save it to hard-disk," + CRLF + ;
               "there is no need to write such lengthy code. This one line code is enough" + CRLF + ;
               "FW_SaveImage( FW_BarCodeBmp( cText, 'QR', nWidth, nHeight ), cBmpFile )"

   hBmp     := FW_BarCodeBmp( cText, "QR", 256, 256 )
   FW_SaveImage( hBmp, "QRTEST.BMP" )
   DeleteObject( hBmp )

   DEFINE WINDOW oWnd
   ACTIVATE WINDOW oWnd CENTERED ;
      ON PAINT oWnd:DrawImage( "QRTEST.BMP" )

return nil
 




Mr. Nages, good afternoon,

Regarding the issue of generating the QR code directly to the disk with the instructions that I indicated, I have problems when the qr code contains a long text and I create a code with thick edges and does not allow the reading of the content.

I attach an image.


Code (fw): Select all Collapse
    ruta := Pub:DIRLOCAL+Pub:CODEMP+"\REP\"+Retorna_Caracter(cons_para_pruebas)+".png"

    cText    := "To generate QR code and save it to hard-disk," + CRLF + ;
               "there is no need to write such lengthy code. This one line code is enough" + CRLF + ;
               "FW_SaveImage( FW_BarCodeBmp( cText, 'QR', nWidth, nHeight ), cBmpFile )"
    hBmp     := FW_BarCodeBmp( cText, "QR", 400 , 400 )
    FW_SaveImage( hBmp, ruta )
    DeleteObject( hBmp )


Thank you for answer
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Re: EasyReport Print To PDF File Without Dialog window ?
Posted: Wed May 29, 2019 05:42 PM
nageswaragunupudi wrote:
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?


We checked this and found that it is failing when there is a file with the same name is already existing on the hard disk.
So, first delete the file and then create the pdf like this:
Code (fw): Select all Collapse
   FERASE( "report1.pdf" )
   PRINT oPrn FILE "report1.pdf"

From FWH1905, you need not yourself delete the existing file. FWH library will do this before creating the new PDF.
Can you please test and confirm?



Regarding the issue of creating a copy of the preview to pdf, it did not work either, I can not reproduce at what moment it fails and at what moment it works, create several files and I do not find a standard in the failure.

I attach an image
x = bad
o = good


The only thing that is standard error, is in the content of the pdf file, all reach line 107.

Attached image and pdfs



BAD PDF
http://demo.livingo.co/images/993005139.pdf
http://demo.livingo.co/images/993005140.pdf
http://demo.livingo.co/images/993005141.pdf

GOOD PDF

http://demo.livingo.co/images/993005144.pdf

Thank you very much for the help
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Re: EasyReport Print To PDF File Without Dialog window ?
Posted: Thu May 30, 2019 05:10 PM

up

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

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Re: EasyReport Print To PDF File Without Dialog window ?
Posted: Sat Jun 08, 2019 05:56 PM

arriba +

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

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]

Continue the discussion