The MindFusion Forums
Flow Diagramming Components >> ActiveX >> ScaleToPage print options
https://mindfusion.eu/Forum/YaBB.pl?num=1524651306

Message started by JR on Apr 25th, 2018 at 10:15am

Title: ScaleToPage print options
Post by JR on Apr 25th, 2018 at 10:15am
Hello,

I have a problem with the ScaleToPage print option.
If the diagram is little, it works, but when it is a big diagram, it does not work.

Is there a limit ?
My diagram zipped takes 650kb so I can't sent it to you.

How do I know if the diagram can fits in one page?

Best regards

Title: Re: ScaleToPage print options
Post by Slavcho on Apr 25th, 2018 at 11:37am
Hi,

What are your diagram's top/left/right/bottom boundaries and MeasureUnit?

Regards,
Slavcho

Title: Re: ScaleToPage print options
Post by JR on Apr 25th, 2018 at 12:32pm
Hi,

Measureunit = 2 (pixel)

top = 0
bottom = 24359
left = 0
right = 157213

Regards


Title: Re: ScaleToPage print options
Post by Slavcho on Apr 26th, 2018 at 8:06am
Hi,

[code]
fcx.MeasureUnit = uPixel
fcx.SetDocSize 0, 0, 157213, 24359
fcx.PrintOptions.ScaleToPage
[/code]

above fits it on a single page in my test -


ScaleToPage only calculates a current PrintOptions.ScaleFactor value and does not update it automatically later, so maybe check if the diagram size isn't growing at some point after you call the method.

Regards,
Slavcho

Title: Re: ScaleToPage print options
Post by JR on Apr 26th, 2018 at 8:14am
Hi,

The diagram does not grow.
I saved my graph with tour SaveToFile method.
When I load this file in you run demo application, I have the same problem when i click in Fit Page in the Print preview window.

Regards


Title: Re: ScaleToPage print options
Post by Slavcho on Apr 26th, 2018 at 10:28am
What's your printer's default paper size?

Title: Re: ScaleToPage print options
Post by JR on Apr 26th, 2018 at 10:34am
A4.

If I put the A0 format. It works.

I know that the display will be ugly, but the user will see that the printing of this graph in a single page will not be exploitable.
In fact, the problem is that the function does not work for large graphs. The graph remains the same as before fitting the page.
I would like to show him an error message if it's not good.

Here are the 3 files (remove .txt at the end of the filename) and use 7-zip on the .001 file
https://mindfusion.eu/Forum/YaBB.pl?action=downloadfile;file=essai_zip_001.txt ( 290 KB | 233 Downloads )
https://mindfusion.eu/Forum/YaBB.pl?action=downloadfile;file=essai_zip_002.txt ( 290 KB | 266 Downloads )
https://mindfusion.eu/Forum/YaBB.pl?action=downloadfile;file=essai_zip_003.txt ( 70 KB | 256 Downloads )

Title: Re: ScaleToPage print options
Post by Slavcho on May 1st, 2018 at 12:15pm
It actually calculates a ScaleFactor value close to zero for this graph, and since the property is of integer type the setter receives a truncated 0 value and refuses it -

[code]
STDMETHODIMP PrintOptions::ScaleToPage()
{
     .....
     put_ScaleFactor(SHORT(100 * ratio));
}

STDMETHODIMP PrintOptions::put_ScaleFactor(SHORT newVal)
{
     if (newVal > 0)
     .....
[/code]

The FP value is 0.533210039, which would print a pixel per 200-pixel large box, and that won't show anything legible anyway. I guess you could check if ScaleFactor remains unchanged by ScaleToPage() when the document is very large and show warning to user that it can't fit on a page.

Regards,
Slavcho

Title: Re: ScaleToPage print options
Post by JR on May 2nd, 2018 at 7:45am
Ok.

Thanks

Regards

The MindFusion Forums » Powered by YaBB 2.6.11!
YaBB Forum Software © 2000-2024. All Rights Reserved.