Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Printing problems when there is a background image (Read 5081 times)
John
Guest


Printing problems when there is a background image
Feb 16th, 2006 at 7:50pm
Print Post  
I'm having a problem with the PrintPreviewEx Window everytime I try to print a chart with a background image.

Basically, if I set the ScaleToPage print option before calling the PrintPreviewEx(or PrintPreview for that matter), then the scale of the chart objects and the cropping seems pretty good, but the background image is totally zoomed in.

Similarly, if I don't set the ScaleToPage print option before calling the PrintPreviewEx, then the background image is at what appears to be the proper scale, but the chart items are tiny.

When printing, the chart items and the background image never seem to be at the same scale.

While working with the chart items within the flowchart, the scale always seems to be in sync between the chart items and the background (i.e. when zooming in, zooming out, within overview, etc), but as soon as I try to print the background image with the items, they are nolonger in sync.

I'm using standard graphics files for the backgrounds (i.e. JPG's) and I'm not sure if the following is useful, but it is a code snippet of how I get the background image and set the extents:






Image i = Image.FromFile(d.FileName);









RectangleF r = new RectangleF(new PointF(0,0), i.Size);









_flowChart.DocExtents = r;





_flowChart.BackgroundImage = i;

Like I said, this method seems to work fine until I try to print.

Any ideas?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Printing problems when there is a background i
Reply #1 - Feb 17th, 2006 at 6:16am
Print Post  
Hi,

What MeasureUnit value does your application use ?

Is the ImageAlign.Document flag set in the fc.BkgrImagePos property ? It specifies whether an image should be aligned to the DocExtents rectangle or to the control client rectangle / printed page bounds. If that flag is disabled, you will get different result on screen and in print preview.

Stoyan
  
Back to top
 
IP Logged
 
John
Guest


Re: Printing problems when there is a background i
Reply #2 - Feb 17th, 2006 at 5:38pm
Print Post  
It looks like my MeasureUnit is Pixel, and it looks like  BkgrImgPos is set to Document.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Printing problems when there is a background i
Reply #3 - Feb 17th, 2006 at 6:16pm
Print Post  
Yes, the pixel unit is not suitable for printing, but if you need to use it you could still get better results by setting

BkgrImagePos = ImageAlign.Stretch | ImageAlign.Document

or switch the MeasureUnit value temporarily to Points before printing and restore it back to Pixel after that.
  
Back to top
 
IP Logged
 
John
Guest


Re: Printing problems when there is a background i
Reply #4 - Feb 17th, 2006 at 6:54pm
Print Post  
Thanks, the stretching seems to have done the trick.

After the stretching code was added, I didn't really see a noticable difference when setting the MeasureUnit to Point...do you still recommend I set/reset this value?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Printing problems when there is a background i
Reply #5 - Feb 17th, 2006 at 7:52pm
Print Post  
There will be a bigger difference if you don't call ScaleToPage - the objects will be very tiny because of the high resolution of printers. If you always use ScaleToPage, I guess you don't need setting MeasureUnit to Points.

Stoyan
  
Back to top
 
IP Logged
 
John
Guest


Re: Printing problems when there is a background i
Reply #6 - Feb 17th, 2006 at 10:51pm
Print Post  
I currently plan on always calling ScaleToPage before the print preview, but that's good to know -incase I do things differently in the future.

Thanks again for all the help.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint