create a pdf

create a pdf

Postby Silvio.Falconi » Wed Apr 21, 2021 9:07 am

I want to print the contents of a window in a pdf

how should i do?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6796
Joined: Thu Oct 18, 2012 7:17 pm

Re: create a pdf

Postby nageswaragunupudi » Wed Apr 21, 2021 5:05 pm

Code: Select all  Expand view
function WndToPdf( oWnd, cPdf )

   local cJpg  := cFileSetExt( cPdf, "jpg" )
   local oPrn

   oWnd:SaveAsImage( cJpg, 100 )

   PRINT oPrn PREVIEW FILE cPdf
   PAGE
   @ 1,1 PRINT TO oPrn IMAGE cJpg
   ENDPAGE
   ENDPRINT

return nil
 
Regards

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

Re: create a pdf

Postby Silvio.Falconi » Fri Apr 23, 2021 10:25 am

nageswaragunupudi wrote:
Code: Select all  Expand view
function WndToPdf( oWnd, cPdf )

   local cJpg  := cFileSetExt( cPdf, "jpg" )
   local oPrn

   oWnd:SaveAsImage( cJpg, 100 )

   PRINT oPrn PREVIEW FILE cPdf
   PAGE
   @ 1,1 PRINT TO oPrn IMAGE cJpg
   ENDPAGE
   ENDPRINT

return nil
 


Nages,


Now I made a test WndToPdf( oApp():oSpiaggia, "test.pdf" )

and I have a pdf with the image is blurred that is not clear

Image

any solution ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6796
Joined: Thu Oct 18, 2012 7:17 pm

Re: create a pdf

Postby nageswaragunupudi » Fri Apr 23, 2021 10:59 am

The function must have saved test.jpg before creating test.pdf. Check the quality of test.jpg
Regards

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

Re: create a pdf

Postby Silvio.Falconi » Fri Apr 23, 2021 11:29 am

nageswaragunupudi wrote:The function must have saved test.jpg before creating test.pdf. Check the quality of test.jpg

good quality I sent you now
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6796
Joined: Thu Oct 18, 2012 7:17 pm

Re: create a pdf

Postby Silvio.Falconi » Sat Apr 24, 2021 11:52 am

Nages,
the function give me a white page pdf today!!!! ( while test.jpg is created)
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6796
Joined: Thu Oct 18, 2012 7:17 pm

Re: create a pdf

Postby Silvio.Falconi » Thu Apr 29, 2021 10:07 am

Nages,
the function create a jpg but when it create a pdf insert a blurred image in the pdf sheet

Code: Select all  Expand view
function WndToPdf( oWnd, cPdf )

   local cJpg  := cFileSetExt( cPdf, "jpg" )
   local oPrn

   oWnd:SaveAsImage( cJpg, 100 )

   PRINT oPrn PREVIEW FILE cPdf
   PAGE
   @ 1,1 PRINT TO oPrn IMAGE cJpg
   ENDPAGE
   ENDPRINT

return nil

the image created
Image

the image on pdf
Image
How I can resolve it ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6796
Joined: Thu Oct 18, 2012 7:17 pm

Re: create a pdf

Postby AntoninoP » Fri Apr 30, 2021 4:47 am

On Fivewin there is a function FWJPGTOPDF that write basic PDF with the jpg, can you try
Code: Select all  Expand view
procedure WndToPdf( oWnd, cPdf )

   local cJpg  := cFileSetExt( cPdf, "jpg" )
   local oPrn

   oWnd:SaveAsImage( cJpg, 100 )

   FwJpgToPdf(cJpg, cPdf)

return


edit: it comes stretched.
Last edited by AntoninoP on Fri Apr 30, 2021 4:56 am, edited 1 time in total.
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: create a pdf

Postby nageswaragunupudi » Fri Apr 30, 2021 4:51 am

Code: Select all  Expand view
FwJpgToPdf(cJpg, cPdf)

I did not propose this because of the problems in resizing the image.
This works well if the proportions of the image fit into the paper size.
Regards

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

Re: create a pdf

Postby AntoninoP » Fri Apr 30, 2021 4:57 am

I see, the problem is that calls PGJPEG1 with the size of the page, instead of with the size of image... it is should be quick fix... maybe with the new lib haru interface, is possible create a pdf without change the quality of jpg
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: create a pdf

Postby nageswaragunupudi » Fri Apr 30, 2021 5:06 am

AntoninoP wrote:I see, the problem is that calls PGJPEG1 with the size of the page, instead of with the size of image... it is should be quick fix... maybe with the new lib haru interface, is possible create a pdf without change the quality of jpg


The proposed function, if used with haru, will produce better results.

Add this at the beginning the program
Code: Select all  Expand view

REQUEST FWHARU
 

and anywhere in the program
Code: Select all  Expand view

TPrinter():lUseHaruPDF := .t.
 


With these two changes, the same function I posted will give better results.
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 12 guests