Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cesar
  Where is Cesar?
 
 Brazil
 Cesar
 To: mohammed qasem
  Where is mohammed qasem?
 amman
 Jordan
 mohammed qasem
 Tags
Subject: RE: print chart
Thread ID: 248704 Message ID: 248779 # Views: 1 # Ratings: 3
Version: Visual FoxPro 9 Category: Reports and Printers
Date: Wednesday, December 23, 2009 10:38:56 AM         
   


> hi all,
>
> i need help to set the printer as landscape or portrait to print the chart
>
> i use this code
>
> LOCAL loBmp as xfcBitmap
> loBmp = Thisform.Foxcharts1.oBmp
>
> loBmp.ToPrinter()
>
> thanks

Mohammed,

There is another very easy and simple way to print images directly, totally safe.

Please go to the link below
http://weblogs.foxite.com/vfpimaging/archive/2007/01/17/3143.aspx

Just save the codes you'll find there to a PRG file, called "PrintImage.Prg"

To use it, just run the command below:

=PRINTIMAGE(GETPICT(), "ORIENTATION=1" + CHR(13) + "COPIES=3" + CHR(13) + "COLOR=1"


That will print 3 copies of your image in LandScape and GreyScale.
Have a look at the blog post, you can customize other things as well.

The big advantage of that aproach is that you send to VFP the responsibility to print your image, no need of API calls or external stuff.

So, for your particular case, you should do the following.

* 1 - Save the current chart to a temp file in disk
LOCAL lcFile
lcFile = ADDBS(GETENV("TEMP")) + "_TempImg_" + SYS(2015)
lcFile = FORCEEXT(lcFile, "PNG")
Thisform.FoxCharts1.SaveToFile(lcFile)

* 2 - Print the saved Image
=PRINTIMAGE(lcFile)

* 3 - Delete the Temporary Image from disk
TRY
   DELETE FILE(lcFile)
CATCH
ENDTRY



HTH

Regards,

Cesar
My Blog

ENTIRE THREAD

print chart Posted by mohammed qasem @ 12/22/2009 12:27:20 PM
RE: print chart Posted by Cesar @ 12/22/2009 12:42:07 PM
RE: print chart Posted by Cesar @ 12/23/2009 10:38:56 AM
RE: print chart Posted by mohammed qasem @ 12/23/2009 1:20:43 PM
RE: print chart Posted by Cesar @ 12/23/2009 2:20:11 PM
RE: print chart Posted by mohammed qasem @ 12/24/2009 8:24:34 AM
RE: print chart Posted by Cesar @ 12/24/2009 11:41:55 AM
RE: print chart Posted by mohammed qasem @ 12/24/2009 12:08:05 PM