EasyReport Print To PDF File Without Dialog window ?

User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: EasyReport Print To PDF File Without Dialog window ?

Post by nageswaragunupudi »

Code: Select all

#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: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: EasyReport Print To PDF File Without Dialog window ?

Post by nageswaragunupudi »

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

   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
leandro
Posts: 958
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia
Contact:

Re: EasyReport Print To PDF File Without Dialog window ?

Post by leandro »

nageswaragunupudi wrote:

Code: Select all

#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

    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 ALFONSO
SISTEMAS LYMA - BASE
Bogotá (Colombia)
[ FWH 19.09 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613) ] [ Embarcadero C++ 7.30 for Win32 ]
User avatar
leandro
Posts: 958
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia
Contact:

Re: EasyReport Print To PDF File Without Dialog window ?

Post by leandro »

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

   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 ALFONSO
SISTEMAS LYMA - BASE
Bogotá (Colombia)
[ FWH 19.09 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613) ] [ Embarcadero C++ 7.30 for Win32 ]
User avatar
leandro
Posts: 958
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia
Contact:

Re: EasyReport Print To PDF File Without Dialog window ?

Post by leandro »

up
Saludos
LEANDRO ALFONSO
SISTEMAS LYMA - BASE
Bogotá (Colombia)
[ FWH 19.09 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613) ] [ Embarcadero C++ 7.30 for Win32 ]
User avatar
leandro
Posts: 958
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia
Contact:

Re: EasyReport Print To PDF File Without Dialog window ?

Post by leandro »

arriba +
Saludos
LEANDRO ALFONSO
SISTEMAS LYMA - BASE
Bogotá (Colombia)
[ FWH 19.09 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613) ] [ Embarcadero C++ 7.30 for Win32 ]
Post Reply