EasyReport Print To PDF File Without Dialog window ?

Re: EasyReport Print To PDF File Without Dialog window ?

Postby nageswaragunupudi » Tue May 28, 2019 5:37 pm

Code: Select all  Expand view
#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
 


Image
Regards

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

Re: EasyReport Print To PDF File Without Dialog window ?

Postby nageswaragunupudi » Wed May 29, 2019 6: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: Select all  Expand view
  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
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: EasyReport Print To PDF File Without Dialog window ?

Postby leandro » Wed May 29, 2019 5:19 pm

nageswaragunupudi wrote:
Code: Select all  Expand view
#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
 


Image


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.

Image
Code: Select all  Expand view
    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

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

Re: EasyReport Print To PDF File Without Dialog window ?

Postby leandro » Wed May 29, 2019 5: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: Select all  Expand view
  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
Image

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

Attached image and pdfs

Image

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

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

Re: EasyReport Print To PDF File Without Dialog window ?

Postby leandro » Thu May 30, 2019 5:10 pm

up
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: 1672
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: EasyReport Print To PDF File Without Dialog window ?

Postby leandro » Sat Jun 08, 2019 5:56 pm

arriba +
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: 1672
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

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