Solved

Printing transaprent GIFs to PCL and PostScript

Posted on 2003-11-19
4
545 Views
Last Modified: 2013-12-03
Hi,
 
we get a HDC from a previously opened printer using the correct defaults struct and access rights.
we attach this HDC to a CDC which we will use to write to.
next we load an image from a file (JPG) into a CImage object. this JPG is not transparent. we then render this image onto the CDC (which has been prepared as in CView::OnPrepareDC to the doc extents that we desire).
again, we load another gif (this time a transparent gif) into a CImage object and render that one using the same coordinates as the previous. i.e. it should be drawn on top of the first image (we do the render with CImage::Draw(dc, rect)).
 
now - we expect the printout to show the underlying image and the transparent image on top.
 
using PCL printer drivers for both OKI and HP printers this is the case. the transparent image is drawn correctly. however, using PostScript drivers for the same printers the transparent gif (i.e. the 2nd one) is rendered transparent but has a transparent border area, thereby blocking out the underlying image from being printed - not what we want. however, this behaviour only occurs with overlapping pictures. if part of the transparent gif is drawn over coloured paper it will be rendered as transparent.
 
 
furthermore, we wish to draw text onto our CDC. we use the CDC::DrawText function to do this (we create the required CFont before hand and select it into our CDC). what we find here is that for PS drivers the resulting text comes out perfect but for the PCL drivers the text is unevenly spaced. why???
0
Comment
Question by:RainUK
  • 2
  • 2
4 Comments
 
LVL 23

Assisted Solution

by:Roshan Davis
Roshan Davis earned 500 total points
ID: 9784617
I think you are blitting images 2 times in the Printer DC for an overlapping image.
This is just a try out, Draw the entire to a memory DC, and blitting that to the PrinterDC.
Rosh :)
0
 
LVL 5

Author Comment

by:RainUK
ID: 9786801
Hi Roshmon,

Having problems BitBilting from one dc to another dc. ANy simple sample code, basically it seems to have bitblt, but I print and nothing appears on the paper.
0
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 500 total points
ID: 9786843
>> basically it seems to have bitblt, but I print and nothing appears on the paper.
Ohh Yes.

For printing you have to create the Device Independent Bitmap. Normal blitting images are device dependent....

This will help

http://www.codeproject.com/printing/printingtricksandtips.asp - Printing tips and tricks from the trenches

Copy that function *DDBToDIB* and ::StretchDIBits function part from that Link.

Good luck
0
 
LVL 5

Author Comment

by:RainUK
ID: 10993917
Hi Roshmon,

It was actually a printer driver problem from OKI. It does not work properly with Arabic locale which is causingt he problems. But thanks for the help.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now