Solved

Print Canvas and Screen Canvas

Posted on 2001-07-16
12
1,105 Views
Last Modified: 2008-02-26
I'm working on a project where I send text to a canvas and do all the wrapping of the text manually.  But the difference between the Printer?s canvas and the screen canvas make it very difficult to do anti aliasing.  Does any one have any suggestions.  Or algorithms  to calculate the difference in text appearance on a printer canvas compared to a screen canvas.  I know this questions has a lot of holes if you have any questions please ask.  

My goal is to give the user a print preview that is accurate.  

Thanks

Mike
0
Comment
Question by:mchagberg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 

Expert Comment

by:comptebidon81
ID: 6286529
Did you try to play with the property PrintScale. Maybe setting it to PrintToFit could Help. I haven't try, but I think it will make a difference.
0
 

Expert Comment

by:lsae
ID: 6287530
listening...
0
 

Author Comment

by:mchagberg
ID: 6287887
I'm sorry Comptebidon81 I don't know how to make printTofit apply to printing in the way I'm doing it.  I'm drawing every item on the print canvas one at a time.

text images to whole thing.  I put the text on in the order it is in a listbox.  And Images go on in the preview window.  When I add images I brake the string up into smaller strings to wrap around the image.

It's quite a process.  But I run the same procedure twice. Once when the user previews and once when they print.

Not to mention all the times they add and image or new item to the list.

my problem is that I want the preview to look the same as the print but because of difference in the screen canvas and Printer canvas it is not very accurate
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6288101
Just a thought, perhaps you could run your procedure once (for Preview) then save it to disk as an Image, and finally, print the image?


DragonSlayer.
0
 
LVL 21

Expert Comment

by:ziolko
ID: 6288509
Look at: GetDeviceCaps() or one of my previouse Q:
ww.experts-exchange.com/jsp/qManageQuestion.jsp?ta=delphi&qid=10309960
ziolko.
0
 

Accepted Solution

by:
lacob earned 300 total points
ID: 6288839
If I uderstood:
Screen canvas use resolution 96 or 120 ppi and printer use 300, 600 or more there is base difference
when you san use the same FontSize on printer like on Screen you can use this algorithm: PrinterFont.Size:=Round((GetDeviceCaps(Form1.Canvas.Handle,LOGPIXELSY) /72) *PrinterResolution).

If you can use PrintPreview in your SW and you can use the same result on screen like on printer there is also little harder way to do it. When you are drawing on Canvas(or DeviceContext) with the same resolution like in printer and show it on screen with zoom (smaller). Use winodows functions SetMapMode(Form1.Canvas.Handle,MM_ISOTROPIC)
, SetWindowExtEx(Form1.Canvas.Handle,XBase,YBase,oldWindowExtent) and SetViewportExtEx(Form1.Canvas.Handle,XResolution,YResolution,OldViewportExtent). There is Zoom=Resolution/Base.


It is good if you can print data drawed by user wherever on Canvas.
Don't remember to set old Mapping mode at last of drawing.
0
 
LVL 17

Expert Comment

by:geobul
ID: 6289424
Listening...
0
 

Expert Comment

by:TomazB
ID: 6291181
Listening...
0
 

Author Comment

by:mchagberg
ID: 6304007
DragonSlayer.
my boss doesn't want a rastered image.

lacob

I'm going to give it a shot give me a couple of days
0
 

Author Comment

by:mchagberg
ID: 6349335
lacob

I still havent had a chance to work on this any more

but I'll give you the points any way if you can help me with some thing else.

I need the API call to inverse text and turn it upside down.

thanks

Mike
0
 

Expert Comment

by:lacob
ID: 6354833
Mike
if you can inverse color of text (if I understood)
use Canvas.Pen.mode:=pmNotXor and your active pen and brush color will be xored with color where you want draw
if you want rorate text before drawing (applied only on TT or vector fonts) use
FontH:HFONT;
LogFont:TLogFont;
FFont:TFont;

FFont:=TFont.Create;
LogFont.lfHeight:=...
LogFont.lfEscapement:=Angle*10 //angle in degrees
                               //using in WinNT orherwise
                               //can be zero
LogFont.lfOrientation:=Angle*10 //angle in degrees
FFont.Assing(Canvas.Font);
FontH:=CreateFontIndirect(LogFont);
Canvas.FontHandle:=FontH;
Canvas.TextOut or some drawing operations
Canvas.Font.Assing(FFont);
DeleteObject(FontH);
FFont.Free;

or you can draw text in Bitmap and rotate bitmap
but you can find (now I dont know) any algorithm to rotate position of BitmapPixels to another Bitmap
0
 

Author Comment

by:mchagberg
ID: 6373229
Thanks
0

Featured Post

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month5 days, 12 hours left to enroll

627 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