Print .rmg file to pdf

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
franco
Posts: 921
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Print .rmg file to pdf

Post by franco »

I am trying to send a rmg report directly to a pdf file and can not get to work.

Code: Select all

#include "hmg.ch"
#include "hmg_hpdf.ch"

declare window Main

Function main_button_1_action
Local mna := getcurrentfolder()+"TRYPDF.PDF"

select printer pdf mna
	Use Test

	LOAD REPORT Test

** original works ***	EXECUTE REPORT Test PREVIEW SELECTPRINTER
        EXECUTE REPORT Test   PRINTERMNA             // THIS DOES NOT WORK
	Use

Return Nil
Thanks in advance
All The Best,
Franco
Canada
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Print .rmg file to pdf

Post by andyglezl »

franco wrote: Wed Jun 01, 2022 6:06 pm I am trying to send a rmg report directly to a pdf file and can not get to work.

Code: Select all

#include "hmg.ch"
#include "hmg_hpdf.ch"

declare window Main

Function main_button_1_action
Local mna := getcurrentfolder()+"TRYPDF.PDF"

select printer pdf mna
	Use Test

	LOAD REPORT Test

** original works ***	EXECUTE REPORT Test PREVIEW SELECTPRINTER
        EXECUTE REPORT Test   PRINTERMNA             // THIS DOES NOT WORK
	Use

Return Nil
Thanks in advance

REPORT EXECUTION

Function:
ExecuteReport ( <cReportName> , <lPrintPreview> , <lSelectPrinter> , [ <cOutputFile> ] )

Command:
EXECUTE REPORT <ReportName> [ PREVIEW ] [ PRINTERSELECT ] [ FILE <cFile> ] // cFile = mna



PDF Output:

- If <cOutputFile> with 'pdf' extension is specified, a PDF file with report
content will be generated. <lPrintPreview> and <lSelectPrinter> parameters
will be ignored).



- The following limitations applies when report is redirected to a PDF file:
- Only .jpg image files are allowed.

- When 'Underline' property is .t., color property is ignored (assumed black) for expressions.

- The following fonts are supported (all other are assumed as 'Times'):
- Times - Helvetica - Courier
Andrés González López
Desde Guadalajara, Jalisco. México.
franco
Posts: 921
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Print .rmg file to pdf

Post by franco »

Can not get to work. I may not quite understand your suggestions.
Could you add the correct code to my sample,
Thanks Franco.
All The Best,
Franco
Canada
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Print .rmg file to pdf

Post by andyglezl »

En teoría, así debería de funcionar...
*------------------------------------------------------
In theory, this is how it should work...

Code: Select all

#include "hmg.ch"
#include "hmg_hpdf.ch"

Function MAIN
:
:
@ <nRow> ,<nCol> BUTTON <ControlName> CAPTION <cCaption> ......     ACTION    main_button_1_action()
:
:
Return

Function main_button_1_action
Local mna := getcurrentfolder()+"TRYPDF.PDF"

	Use Test
	LOAD REPORT Test
        EXECUTE REPORT Test  FILE mna
	Use

Return Nil
Andrés González López
Desde Guadalajara, Jalisco. México.
franco
Posts: 921
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Print .rmg file to pdf

Post by franco »

Thanks Andy works perfect, just what I needed and so simple.
Franco
All The Best,
Franco
Canada
Post Reply