Printing From Gm
#1
Posted 25 May 2009 - 09:36 PM
basically when user presses PRINT button, GM takes a snapshot of the screen ( a section of it) it SHOULD then print it (LANDSCAPE) directly from the program.
At present after the screenshot is taken my GM program then exports the bmp to an external paint package for printing (using execute_shell()), which is not very professional.
help appreciated.
#2
Posted 25 May 2009 - 11:25 PM
#3
Posted 26 May 2009 - 03:37 PM
#4
Posted 26 May 2009 - 03:39 PM
You already have it installed; go on, look.links
#5
Posted 26 May 2009 - 04:04 PM
#6
Posted 26 May 2009 - 05:07 PM
Pretty safe to assume he does have pro.need a way or a dll to print a file direclty from gm
#7
Posted 26 May 2009 - 05:30 PM
#8
Posted 28 May 2009 - 07:27 PM
#9
Posted 29 May 2009 - 04:58 PM
#10
Posted 30 May 2009 - 09:12 AM
However, this system requires MS Word/Office to be installed on target system.
Here's some demo modified code:
unit OleTest;
function Main:String;
var Word: OleVariant;
begin
Word:=CreateOleObject('Word.Application'); // Create OLE object (sorta like opening MS Word)
Word.Documents.Add; // add new empty document (like clicking "New" in MS Word)
Word.Selection.TypeText('Hello World from '); // type text
Word.Selection.BoldRun; // toggle bold to on
Word.Selection.TypeText('GMRA'); // type text
Word.Selection.BoldRun; // toggle bold to off
Word.Selection.TypeText(' typing into '); // type text
Word.Selection.BoldRun; // toggle bold to on
Word.Selection.TypeText('MSWord'); // type text
Word.Selection.BoldRun; // toggle bold to off
Word.Selection.TypeText('!'); // type text
// up till now it should have written "Hello WOrld from GMRA typing into MSWord!" (yes with the bold parts
Word.PrintOut(0,0,'1','','1','1'); // Print first page
// Word.PrintOut(0,0,'0',''); // Print ALL pages
end;
end.All the important stuff is between begin and end;http://support.micro...rd OLE Printing
The OLE stuff is identical to what Visual Basic uses. So to find more stuff about these commands, open MS Word, click "Help", click "Contents" and click "visual basic reference". All stuff should be there.
For ease of use, here's the particular printing command:
PrintOut(Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)Background [True/False] when false, waits until priting completes (sychronous). when true, continues.
Append [True/False] appens current document to saved one (not needed, leave false)
Range [number] the number of pages to print
OutputFileName [string] not needed
From [number] the starting page (value is inclusive)
To [number] the ending page (value is inclusive)
NB: OLE's TRUE or FALSE is 1 and 0 respectively!!
NB: Unlike GM's, each argument is optional! Know when you have to fill them out or not.
Good luck!
Kind regards,
Christian Sciberras.
Edited by uuf6429, 30 May 2009 - 10:31 AM.
#11
Posted 17 June 2012 - 06:22 AM
need a way or a dll to print a file direclty from gm, so when you press print it then brings up the a print preview and allows you to set printer settings before pressing ok as in a normal paint package.
basically when user presses PRINT button, GM takes a snapshot of the screen ( a section of it) it SHOULD then print it (LANDSCAPE) directly from the program.
At present after the screenshot is taken my GM program then exports the bmp to an external paint package for printing (using execute_shell()), which is not very professional.
help appreciated.
It's Easy
Just put this code on any event that will print the screen
pr_begin_document() pr_set_font_size(32); pr_print_screen_stretch(0,0,3200,3900) pr_end_document()
To print a specific text,try this code
pr_begin_document() pr_set_font_size(32); pr_print_text(x,y,"Specific Text") pr_end_document()
try this code too(It will ask you to write a text before you print it.The text you have written will be printed)
pr_begin_document()
pr_set_font_size(32);
pr_print_text(x,y,get_string("Write the text you want to be printed",""))
pr_end_document()"pr_end_document" is the most important thing here because it does the printing process
Edited by Yevez, 17 June 2012 - 06:27 AM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











