Select printer

FastReport for Xailer & [x]Harbour (English/Spanish)
Responder
nbatocanin
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Select printer

Mensaje por nbatocanin »

Hi to all :)

Is this forum still active?

I need to select a specific printer that is not Windows default for one specific report. Is there a way to do that?

Regards, Nenad
hgarciaj
Mensajes: 107
Registrado: Jue Sep 23, 2010 12:44 am

Re: Select printer

Mensaje por hgarciaj »

First you have to identify tthe correct name for the printer you need, (check tprinter class) then you have to send it to your fr3 with this:

::oFastReport:oPrintOptions:cPrinter:="your printer"
Regards
Saludos
Héctor García
nbatocanin
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Re: Select printer

Mensaje por nbatocanin »

hgarciaj escribió: Jue Jun 10, 2021 3:19 am First you have to identify tthe correct name for the printer you need, (check tprinter class) then you have to send it to your fr3 with this:

::oFastReport:oPrintOptions:cPrinter:="your printer"
Regards
Thank you!

NB
nbatocanin
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Re: Select printer

Mensaje por nbatocanin »

hgarciaj escribió: Jue Jun 10, 2021 3:19 am ::oFastReport:oPrintOptions:cPrinter:="your printer"
Unfortunately, this is not work (undefined variable cPrinter). I try with

oFr:SetProperty ("PrintOptions", "cPrinter", "My Printer")

But this has no effect either :(
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9255
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Select printer

Mensaje por ignacio »

Imagen 180.png
Imagen 180.png (7.4 KiB) Visto 5485 veces
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
nbatocanin
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Re: Select printer

Mensaje por nbatocanin »

Ah, I realized what the problem was! I use FrReportManager as base class instead TFastReport. Unfortunately, it's a big problem for me to change this, is there a way to set up a printer from this class? I try

::Super:oPrintOptions:cPrinter

but :oPrintOptions is NIL??
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9255
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

Re: Select printer

Mensaje por ignacio »

Hi,
CLASS frReportManager FROM TFastReport
::Super NOT NEEDED.

Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
nbatocanin
Mensajes: 42
Registrado: Sab Ago 10, 2013 2:39 am

Re: Select printer

Mensaje por nbatocanin »

Ignacio, thank you very much!

The problem is of course in my code. I did that part a long time ago (Spirin version), so I forgot how it works. Basically, all my reports look like this:

oFr := FRInit()
...
...
oFr:activate()

FRInit() doing this:

Código: Seleccionar todo

oFr := FrReportManager():New()
oFr:SetProperty("DESIGNER", "DefaultFont.Charset", 238)
oFr:SetFormatSettings(frxThousandSeparator, ".")
...
:activate() is this method:

Código: Seleccionar todo

::Create() 
::LoadFromFile (::cScript) 
::Init()
::ShowReport()
The problem occurs because variable oPrintOptions = NIL before the ::create() activation! As I put oFr:oPrintOptions:cPrinter := "..." before ::activate(), I got an error.
Responder