Create a Fax job from c#

  • Thread starter Thread starter Pj
  • Start date Start date
P

Pj

Hi

Is there any way I can obtain a Graphics object for a fax print job in
c#, In the same way I can call FaxStartPrintJob in MFC to get a device
context (And then use GDI calls to build up the page)

Thanks for any help!

Pj
 
I haven't tried it, but you should be able to P/Invoke FaxStartPrintJob, get
your HDC and use Graphics.FromHdc() to obtain a Graphics object
 
Yeah, I was kind of thinking along those lines as well, just wonderd if
there was a native .net solution that I should be using!

Ideally I'd use a .net PrintDocument just pointing to the fax server,
but see no way of inputing stuff like the dest. fax number
programatically ( Not actually tried this, but assume I would just get
the usual send fax dialog popping up wanting the params for the job if
I tried this )

Thanks!

Pj
 
ArgumentException was unhandled

Alex,

Your example code is awesome and looks like it would be a great solution for the app I'm working on. I'm running into a problem from this line of code in the MyPrinterSettings.cs:

typeof(StandardPrintController).GetField("dc", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(this, fci.hDC);

At run time with c# 2005 I get the error "Object of type 'System.IntPtr' cannot be converted to type 'System.Drawing.Internal.DeviceContext'."

I'm running out of ideas on how to fix this. I've tried different casting options and even marking the hDC as an unsafe pointer with no luck. Do you have any ideas how I could change the hDC to make it play nice with the setvalue? Any help would be greatly appreciated.

Thanks,
 
Back
Top