Learning to print

Moderator: Rathinagiri

User avatar
RussBaker
Posts: 51
Joined: Wed Jul 22, 2015 9:44 am

Learning to print

Post by RussBaker »

I've gone through the 10steps tutorial. i think i have good handle on printing.

Is there a place to find detailed documentation on the print options? How to use them?

I have used the demo to send to preview. It works well. However, can I change some defaults?

eg:

Change default printer from preview?
Change toolbar on top of preview
-- Not allow save to
-- Change to text options instead of icons.
Set zoom during preview?

Send to PDF?

I love how simple printing actually is. It's basically printing to row,col and that's simple. Also the ability to print graphics is nice, although I'd like to see some documentation on this.

--Russ
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Learning to print

Post by Rathinagiri »

1. You can't change the default printer from preview. Because, printer has to be selected before preview.
2. Unfortunately, no by default. But the toolbar can be changed by re-coding HMG.
3. Again Nope :(
4. And lastly YES. You can send to PDF. It is better if you decide and send directly to PDF using the following statement.

Code: Select all

SELECT PRINTER PDF <cPDFFile> ;
	[ <lOrientation 	: ORIENTATION>		<nOrientation> ] ;
	[ <lPaperSize		: PAPERSIZE>		<nPaperSize> ] ;
	[ <lPaperLength 	: PAPERLENGTH>		<nPaperLength> ] ;
	[ <lPaperWidth		: PAPERWIDTH>		<nPaperWidth> ] ;
   [ <lLog            : LOG> ] ;
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
RussBaker
Posts: 51
Joined: Wed Jul 22, 2015 9:44 am

Re: Learning to print

Post by RussBaker »

I tried changing to
SELECT PRINTER PDF "myfile.pdf"

and gave me a compiler error.
Do you have some sample code?

If this works, it could be fantastic. I could create a PDF and open the PDF in default reader that will allow to select any printer.

Rathinagiri wrote: 4. And lastly YES. You can send to PDF. It is better if you decide and send directly to PDF using the following statement.

Code: Select all

SELECT PRINTER PDF <cPDFFile> ;
	[ <lOrientation 	: ORIENTATION>		<nOrientation> ] ;
	[ <lPaperSize		: PAPERSIZE>		<nPaperSize> ] ;
	[ <lPaperLength 	: PAPERLENGTH>		<nPaperLength> ] ;
	[ <lPaperWidth		: PAPERWIDTH>		<nPaperWidth> ] ;
   [ <lLog            : LOG> ] ;
User avatar
dragancesu
Posts: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Learning to print

Post by dragancesu »

When creating the report is well option save as pdf, I think the simplest way is installation program type pdf printer, like Cutepdf, Foxit reader or similar and just print
User avatar
RussBaker
Posts: 51
Joined: Wed Jul 22, 2015 9:44 am

Re: Learning to print

Post by RussBaker »

Another question.

In preview the option to save is available.
When I save to PDF it names the file HMG_MiniPrint_0001.pdf

Is there a way to change the default name from HMG_MiniPrint?
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Learning to print

Post by andyglezl »

Puedes ver... / You can see...
-----------------------------------------

\HMG\3.4\SAMPLES\HPDF\Demo1\Demo.prg
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Learning to print

Post by mustafa »

Hola RussBaker
mira haber si pueden servir estos samples.

viewtopic.php?f=40&t=3597&p=33756&hilit ... afa#p33756
Project_HPDFPRINT.zip

viewtopic.php?f=24&t=4246&p=40469&hilit ... afa#p40469
Factura_HPDPRINT.zip


saludos
*------------------------------------------------------------------------*
Hi Russ Baker
look there if they can serve these samples.

viewtopic.php?f=40&t=3597&p=33756&hilit ... afa#p33756
Project_HPDFPRINT.zip

viewtopic.php?f=24&t=4246&p=40469&hilit ... afa#p40469
Factura_HPDPRINT.zip

Greetings
Mustafa
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Learning to print

Post by mol »

I;m refreshing this topic, because I want to use code:

Code: Select all

SELECT PRINTER PDF <cPDFFile> 
but, I don't kno how to add features to .pdf file like this:

Code: Select all

SET HPDFDOC ENCODING TO "CP1250"
		//SET HPDFDOC PERMISSION TO READ
		//SET HPDFDOC PERMISSION TO PRINT
		SET HPDFINFO AUTHOR TO aMagazyny[max(nNrMag + 1,1), DEFMAG_Wystawiacz]
		SET HPDFINFO CREATOR TO "Faktury - MOL Systemy Komputerowe"
		SET HPDFINFO TITLE TO cNazwaDokumentu
		SET HPDFINFO SUBJECT TO cNazwaDokumentu
		SET HPDFINFO KEYWORDS TO cNazwaDokumentu
		SET HPDFINFO DATECREATED TO date()
		SET HPDFINFO DATEMODIFIED TO date()
		SET HPDFINFO DATECREATED TO date() TIME time()
		SET HPDFINFO DATEMODIFIED TO date() TIME time()
?
Everything works OK with properties of PDF.
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Learning to print

Post by mol »

Integrating printing subsystem with pdf generation works very fine.
But, I've found few problems:
1. When I want to print to pdf numbers, I need to convert them to strings. Can sb. approve it?
2. Functions GetPrintableHorizontalOffset(), GetPrintableVerticalOffset(), GetPrintableAreaWidth(), GetPrintableAreaHeight() return 0 while pdf generation. Is it possible to modify them to return values depending from selected paper size?

Regards, Marek
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: Learning to print

Post by EduardoLuis »

Hi Mol:

I've implemented on all my developes, that any print out creates a PDF.-
You are right, numbers must be previously converted to str, but instead of considering an issue, it's really a benefit, because you can perform numeric output as you want creating the apropiate function.-
For example, in some cases my clients want negative notation this way: ( 15.175,98 ); others prefer -15.175,98.-
HMGHPDF asumes internal printer definition (for example printable area, offset, etc.)
You only need to define page orientation and paper size (A4, Letter, Legal, etc.)
About orientation you only need to indicate when print output is landscape, for example:

SELECT HPDFDOC 'INFORME.pdf' TO lSuccess orientation HPDF_ORIENT_LANDSCAPE papersize HPDF_PAPER_A4
SET HPDFDOC COMPRESS ALL
* SET HPDFDOC PAGEMODE TO OUTLINE (recomender when PDF is more than 2 pages)
SET HPDFINFO AUTHOR TO 'MXFormSoft'
SET HPDFINFO CREATOR TO 'FORMUNOT 3.01.05'
SET HPDFINFO TITLE TO 'RPI Formulario'
SET HPDFINFO SUBJECT TO 'X25346444'
SET HPDFINFO KEYWORDS TO '05'
SET HPDFINFO DATECREATED TO date() TIME time()
if lSuccess

SET HPDFDOC ENCODING TO "CP1252"
START HPDFDOC

SELECT ASIENTOS

START HPDFPAGE

........ Your definitions (for example)
@ 55 + vertic , 267 + horiz HPDFPRINT rectangle to 72.2 + vertic , 290 + horiz penwidth .1 color { 128, 128, 128 }

@ 58.7 + vertic , 23 + horiz HPDFPRINT ALLTRIM(STR(ASIENTOS->ASNRO)) FONT 'Helvetica-Bold' SIZE 8 RIGHT
@ 58.7 + vertic , 24.5 + horiz HPDFPRINT ASIENTOS->ASFECHA FONT 'Helvetica-Bold' SIZE 8
@ 58.7 + vertic , 40 + horiz HPDFPRINT ASIENTOS->ASDETALIQ1 FONT 'Helvetica-Bold' SIZE 8
END HPDFPAGE

END HPDFDOC

As you can notice, HMHPDF gives you the chance improve the most complex print output definitions.-
The first develope is the most difficult, the second and so on are bread and butter.-
If you need another help, feel free to ask
With regards
Eduardo
Post Reply