Page 2 of 2

Re: EasyReport Print To PDF File Without Dialog window ?

PostPosted: Tue May 28, 2019 5:37 pm
by nageswaragunupudi
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

Re: EasyReport Print To PDF File Without Dialog window ?

PostPosted: Wed May 29, 2019 6:29 am
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  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?

Re: EasyReport Print To PDF File Without Dialog window ?

PostPosted: Wed May 29, 2019 5:19 pm
by leandro
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

Re: EasyReport Print To PDF File Without Dialog window ?

PostPosted: Wed May 29, 2019 5:42 pm
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  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

Re: EasyReport Print To PDF File Without Dialog window ?

PostPosted: Thu May 30, 2019 5:10 pm
by leandro
up

Re: EasyReport Print To PDF File Without Dialog window ?

PostPosted: Sat Jun 08, 2019 5:56 pm
by leandro
arriba +