Printing mystery

I am encountering a difficulty with printing.

I create the print graphics object with as I always did.

The difference is I created a global g as graphics property, so I can pass all requests to a generalized routine which fetches a print queue.

It hangs and never prints.

I verified g is not nil.

What may be going on ?


Michel, can you post a snippet or two?
I do something similar and have had no problems (but its been a version of two)

[code] if pageSetup = nil then
pageSetup = New PrinterSetup

If pageSetup.PageSetupDialog Then
  system.DebugLog "page setup dialog"
  printerSetupString = pageSetup.SetupString
End If


if pagesetup.HorizontalResolution = 72 then 
end if

if pagesetup.HorizontalResolution <> 300 then
  pRatio = pageSetup.HorizontalResolution/72
  zRatio = 0.6666666666*pRatio
end if

end if

g = OpenPrinterDialog(pageSetup)

g.textsize = 24zRatio
g.DrawString(“Hello World”, 100, 500

g is a graphics global module property

If I dim it locally, it prints.

assumption :
somewhere you have a public

DIM g as GRAPHICS (or equiv)

But Michel… WHERE do you tell it to PRINT the page… you put “Hello World”, and now it is waiting for either more drawing instructions, or to eject/print the page


Yeah !

This is one of those moments when asking the question brings the response : when I dim g becomes nil at the end of the event, and the page is sent to the printer.

With a property that does not happen, I have to set it myself to nil.

That is what actually prints.


Right… it would become nil when it went out of scope… but in your case it never does :slight_smile: