Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Printing transaprent GIFs to PCL and PostScript

Posted on 2003-11-19
4
Medium Priority
?
574 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 1500 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 1500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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…
Suggested Courses

783 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