From: "Michael Pawlowski" Subject: Re: How to print a bitmap??? Date: Tuesday, February 20, 2001 2:52 AM Just a quick note to explain the problem. I was attempting to the StretchDraw() method from the Printer() object. On occasion the output from the printer was a blank sheet of paper. Most times the application would memory fault. To resolve the problem, I used the StretchDIBits() function. Here's my translation to C++ of the Pascal example referenced below: ============================================== if(Printer()->Orientation == poPortrait) { ARect.Left = 325; ARect.Top = 300; ARect.Right = 1700; ARect.Bottom = 800; } else { ARect.Left = 725; ARect.Top = 300; ARect.Right = 1700; ARect.Bottom = 800; } int HeaderSize, ImageSize; BITMAPINFO *BitmapHeader; void *BitmapImage; GetDIBSizes( AnalyzerPlotForm->AnalyzerDisplayImage->Picture->Bitmap->Handle, HeaderSize, ImageSize); BitmapHeader = (BITMAPINFO *)malloc(HeaderSize); BitmapImage = (void *)malloc(ImageSize); GetDIB( AnalyzerPlotForm->AnalyzerDisplayImage->Picture->Bitmap->Handle, AnalyzerPlotForm->AnalyzerDisplayImage->Picture->Bitmap->Palette, BitmapHeader, BitmapImage); Printer()->BeginDoc(); StretchDIBits( Printer()->Canvas->Handle, ARect.Left, ARect.Top, ARect.Right, ARect.Bottom, 0, 0, 128, // Analyzer display width 64, // Analyzer display height BitmapImage, BitmapHeader, DIB_RGB_COLORS, SRCCOPY); Printer()->EndDoc(); =================================================== Thanks, Mike "Earl F. Glynn" wrote in message news:96t3mt$b3v2@bornews.inprise.com... > "Michael Pawlowski" wrote in message > news:3a920f39$1_2@dnews... > > My previous post re: GPF... was unanswered, so I'll pose the question > > another way... > > > > What is the recommended way to assign a TBitmap to a TImage, then print > the > > bitmap to a printer??? > > StretchDIBits? > > See "Printing Bitmaps" on this page: > http://www.efg2.com/Lab/Library/Delphi/Printing/Default.htm#PrintBitmap > > The code is Delphi. But the VCL/API calls are the same for Delphi and > Builder. > > > -- > efg Earl F. Glynn, Overland Park, KS USA > > efg's Computer Lab: http://www.efg2.com/Lab > Mirror: http://homepages.borland.com/efg2lab/Default.htm