Alaska Software Inc. - presentation space, PRINTER AND BITMAP
Username: Password:
AuthorTopic: presentation space, PRINTER AND BITMAP
JAYARAM MYSOREpresentation space, PRINTER AND BITMAP
on Mon, 01 Feb 2010 22:10:21 +0530
Hi, Friends
I need help regarding presentation space, PRINTER AND BITMAP
I need to create *.jpeg or *.bitmap image of what I print (Example : 
Invoice).
Then I want to email the *.jpeg or *.bitmap image as an attachement.

I create the printer object useing :

      oDlg := XbpPrintDialog():new()
      oDlg:enableNumCopies := .F.
      oDlg:create()
      oPrinter := oDlg:display()
      oDlg:destroy()
Then I create the   oPrinterPS as follows:

        oPrinterPS   := XbpPresSpace():new()
        oPrinter:setOrientation(XBPPRN_ORIENT_LANDSCAPE)
        aSize := { aSize[5] - aSize[3], ;
                   aSize[6] - aSize[4]  }
        oPrinterPS:create( oPrinter, aSize, GRA_PU_LOMETRIC )
        oPrinter:startDoc()

Then I out put the graphics as follows:

       nSegmentA := GraSegOpen(oPrinterPS)
       GraStringAt( oPrinterPS, {CL+950,1860}, "Jayanthi Coffee Works 
Bldg.")
       GraStringAt( oPrinterPS, {CL+950,1830}, "M.G.Road")
       GraStringAt( oPrinterPS, {CL+950,1800}, "CHIKMAGALUR - 577 101")
       GraSegClose(oPrinterPS)
       GraSegDraw( oPrinterPS, nSegmentA )


Then I create a bitmap object :

       oBitmap    := XbpBitmap():new():create( oPrinterPS )

       aAttr := Array( GRA_AA_COUNT )
       aAttr[GRA_AA_COLOR] := GRA_CLR_WHITE
       oPrinterPS:SetAttrArea(aAttr)
        set background white
       GraBox(oPrinterPS,{0,0},aSize,GRA_FILL)

       GraSegDraw( oPrinterPS, nSegmentA )

I save the image like this:

       cImgFile := '702213.JPG'
       oBitmap:saveFile( cImgFile, XBPBMP_FORMAT_JPG )

But I create a Image that is only Black.

What is the mistake I am doing?

Can I associate oPrinterPS with oBitmap ?

I am migrating from Clipper 87 and I am not able to understand this.

Any help is appreciated

Regards

Jayaram