create a pdf
- Silvio.Falconi
- Posts: 7133
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
create a pdf
I want to print the contents of a window in a pdf
how should i do?
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
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
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: create a pdf
Code: Select all | Expand
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
G. N. Rao.
Hyderabad, India
- Silvio.Falconi
- Posts: 7133
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: create a pdf
nageswaragunupudi wrote:Code: Select all | Expand
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](https://i.postimg.cc/NMdTqQ1n/fffffffffffffffffffffffff.png)
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
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
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: create a pdf
The function must have saved test.jpg before creating test.pdf. Check the quality of test.jpg
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Silvio.Falconi
- Posts: 7133
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: create a pdf
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
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
- Silvio.Falconi
- Posts: 7133
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: create a pdf
Nages,
the function give me a white page pdf today!!!! ( while test.jpg is created)
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
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
- Silvio.Falconi
- Posts: 7133
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: create a pdf
Nages,
the function create a jpg but when it create a pdf insert a blurred image in the pdf sheet
the image created
![Image](https://i.postimg.cc/dtG3xC8d/beach.jpg)
the image on pdf
![Image](https://i.postimg.cc/ZKLZNx8f/gg.png)
How I can resolve it ?
the function create a jpg but when it create a pdf insert a blurred image in the pdf sheet
Code: Select all | Expand
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](https://i.postimg.cc/dtG3xC8d/beach.jpg)
the image on pdf
![Image](https://i.postimg.cc/ZKLZNx8f/gg.png)
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
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
Re: create a pdf
On Fivewin there is a function FWJPGTOPDF that write basic PDF with the jpg, can you try
edit: it comes stretched.
Code: Select all | Expand
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.
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: create a pdf
Code: Select all | Expand
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
G. N. Rao.
Hyderabad, India
Re: create a pdf
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
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: create a pdf
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
REQUEST FWHARU
and anywhere in the program
Code: Select all | Expand
TPrinter():lUseHaruPDF := .t.
With these two changes, the same function I posted will give better results.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India