Board index » cppbuilder » Printing Jpegs

Printing Jpegs

I am trying to print a jpeg using Borland C++ Builder 4.0.  It seems to
work however the image comes out at about 30% of the original resolution
and size.  I tried to use stretch draw but the image is still in low
resolution.  I can't figure out the problem.  Can someone please, please
help.

Here is the code I use:

                TClipboard *pCB = Clipboard();
                 Clipboard()->Assign(largeImage->Picture);

                 Graphics::TBitmap *pBitmap = new Graphics::TBitmap();

                 pBitmap->LoadFromClipboardFormat(CF_BITMAP,                                          
pCB->GetAsHandle(CF_BITMAP), 0);

                 TPrinter *Prntr = Printer();
                 Prntr->BeginDoc();

                 Prntr->Canvas->Draw((Prntr->PageWidth -                                               largeImage->Width)/2,
                        (Prntr->PageHeight - largeImage->Height)/2,                                       pBitmap);

                 Prntr->EndDoc();

                delete pBitmap;

Thanks

Adam Berent
www.abisoft.net
aber...@abisoft.net

 

Re:Printing Jpegs


Draw, and StretchDraw fail on many printers.

You may also be told to use StretchDIBits(),
however, StretchDIBits() requires about 2000
lines of low level graphics support code to work
well, else many of your customers may receive
blank or garbled pages

If you do not need to deploy your applicaition,
and it will only run on the printer, computer, and
operating system you are using now, then use
StretchDraw().

If you plan to deploy your applicaiton, or you will be
using your application on other printers, computers,
and other versions of Windows, then you will need
to invest in a reliable printing unit. Take a look at
TExcellentImagePrinter, available at:

http://www.code4sale.com/joehecht

--
Jimmy Page is having a charity artwork sale: Action For Brazil's Children Trust: http://www.zeppinhood.net/
Whole Lotta Love computing to cure cancer! http://www.wholelottalove.org/

Quote
"aberent" <aber...@abisoft.net> wrote in message news:3C5AB9EB.3080903@abisoft.net...
> I am trying to print a jpeg using Borland C++ Builder 4.0.  It seems to
> work however the image comes out at about 30% of the original resolution
> and size.  I tried to use stretch draw but the image is still in low
> resolution.  I can't figure out the problem.  Can someone please, please
> help.

> Here is the code I use:

> TClipboard *pCB = Clipboard();
>                  Clipboard()->Assign(largeImage->Picture);

>                  Graphics::TBitmap *pBitmap = new Graphics::TBitmap();

>                  pBitmap->LoadFromClipboardFormat(CF_BITMAP,
> pCB->GetAsHandle(CF_BITMAP), 0);

>                  TPrinter *Prntr = Printer();
>                  Prntr->BeginDoc();

>                  Prntr->Canvas->Draw((Prntr->PageWidth - largeImage->Width)/2,
>                   (Prntr->PageHeight - largeImage->Height)/2, pBitmap);

>                  Prntr->EndDoc();

> delete pBitmap;

> Thanks

> Adam Berent
> www.abisoft.net
> aber...@abisoft.net

Other Threads