Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Invoke Windows print dialog  (Read 6424 times)
Nuno G.
Posts: 38


« on: October 16, 2015, 01:07:15 pm »

Hi!
I'm starting with GRW and I create a PDF report. Is there any way to invoke automatically the Windows Printer dialog instead of the preview window ?
TIA
Nuno
Alex G.
Four Js
Posts: 124


« Reply #1 on: October 16, 2015, 01:38:20 pm »

Yes, but not via PDF output but via SVG output. Using the API function fgl_report_configureSVGPreview() you can pop up the print dialog, print directly on the default printer or print silently to a printer selected by name.

From the documentation:
fgl_report_configureSVGPreview

Select SVG preview mode or other print options.
Syntax

fgl_report_configureSVGPreview(
   preview STRING)

    preview - One of the following:
        The Preview option shows the report in a folder tab of the main preview window.
        The ShowPrintDialog option pops up the system print dialog allowing the user to select and configure a printer. If confirmed, the document is printed in the background and the previewer main window is not shown.
        The PrintOnDefaultPrinter option prints the report silently on the default printer. The previewer main window is not shown.
        The PrintOnNamedPrinter option prints the report silently on the named printer. The previewer main window is not shown. In order to provide the name and other parameters, these functions have been added: fgl_report_setSVGCopies, fgl_report_setSVGPageRange, fgl_report_setSVGPaperSource, fgl_report_setSVGPrinterName, fgl_report_setSVGSheetCollate.

Usage

Function to select SVG preview mode or other print options

This function is applicable only for the device SVG when previewing is selected.


Regards,
Alex
Reuben B.
Four Js
Posts: 704


« Reply #2 on: October 18, 2015, 10:08:52 pm »

I'll mention something that may help if you want to stay with PDF

If you look in GREDIR/bin/src you will see a file gviewdoc.4gl which gets compiled into GREDIR/lib

This is what is used when viewing a report with fgl_report_selectPreview(TRUE)

In there you will see it uses the shellexec frontcall to view the report file.  Shellexec is the equivalent of double-clicking on a file and using the default application to open the file.  Some little known functionality about shellexec frontcall is that if you specify a second argument you do the equivalent of right-clicking on file and selecting an action e.g. print

So you might be able to get what you want for PDF by adding a second argument to the shellexec frontcall in gviewdoc.4gl.  Some discussion here http://www.4js.com/fjs_forum/index.php?topic=140.0

Reuben
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines