Page 1 of 1

Print .rmg file to pdf

Posted: Wed Jun 01, 2022 6:06 pm
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

Re: Print .rmg file to pdf

Posted: Wed Jun 01, 2022 10:12 pm
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

Re: Print .rmg file to pdf

Posted: Thu Jun 02, 2022 3:30 pm
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.

Re: Print .rmg file to pdf

Posted: Thu Jun 02, 2022 8:11 pm
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

Re: Print .rmg file to pdf

Posted: Thu Jun 02, 2022 10:06 pm
by franco
Thanks Andy works perfect, just what I needed and so simple.
Franco