Jump to content


Photo

Printing From Gm


  • Please log in to reply
10 replies to this topic

#1 DefuzionGames

DefuzionGames

    GMC Member

  • GMC Member
  • 1417 posts
  • Version:Unknown

Posted 25 May 2009 - 09:36 PM

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.
  • 0

#2 PickleMan

PickleMan

    Programmer

  • New Member
  • 995 posts
  • Version:Unknown

Posted 25 May 2009 - 11:25 PM

Use the GM Printing extenstion...
  • 0

#3 DefuzionGames

DefuzionGames

    GMC Member

  • GMC Member
  • 1417 posts
  • Version:Unknown

Posted 26 May 2009 - 03:37 PM

links
  • 0

#4 score_under

score_under

    Least kawaii

  • GMC Member
  • 1319 posts

Posted 26 May 2009 - 03:39 PM

links

You already have it installed; go on, look.
  • 0

#5 MetroidMan347

MetroidMan347

    GMC Member

  • GMC Member
  • 827 posts
  • Version:GM:Studio

Posted 26 May 2009 - 04:04 PM

ya have pro right?
  • 0

#6 score_under

score_under

    Least kawaii

  • GMC Member
  • 1319 posts

Posted 26 May 2009 - 05:07 PM

need a way or a dll to print a file direclty from gm

Pretty safe to assume he does have pro.
  • 0

#7 MetroidMan347

MetroidMan347

    GMC Member

  • GMC Member
  • 827 posts
  • Version:GM:Studio

Posted 26 May 2009 - 05:30 PM

riiiiiiiiiiiiiiiiight
  • 0

#8 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 28 May 2009 - 07:27 PM

In any case, you could use GMRA to generate such a file in Word (transparently, without it showing up) and telling Word to Print it.
  • 0

#9 DefuzionGames

DefuzionGames

    GMC Member

  • GMC Member
  • 1417 posts
  • Version:Unknown

Posted 29 May 2009 - 04:58 PM

i would be interest to know how exactly to do that. i.e what dll to use, what command set, parameters id need to use. you seem to know your stuff...
  • 0

#10 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 30 May 2009 - 09:12 AM

There's a demo for opening up MS Word and writing into it, get GMRA and open "WordOLETest.pas" in DelphiEditor.exe (or DelphiEditorIDE.exe) and click "run" (green arrow).
However, this system requires MS Word/Office to be installed on target system.

Here's some demo modified code:
PRE
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.

  • 0

#11 Yevez

Yevez

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM8

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users