How to fit diagram in a page with viewbale/readable content

In the attached file which we are printing in tiff, we want to fit the diagram in a page with viewbale/readable content.
We have tried many drawing and printing properties but, none of them seem to be working as per expected.

Sample code for propetirs that we used is as per following,

//Formating
foreach (AsposeVisio.Page page in visioDocument.Pages)
{
page.PageSheet.PageProps.PageHeight.Value = 11.0;
page.PageSheet.PageProps.PageWidth.Value = 8.5;

page.PageSheet.PrintProps.CenterX.Value = AsposeVisio.BOOL.True;
page.PageSheet.PrintProps.CenterY.Value = AsposeVisio.BOOL.True;
page.PageSheet.PrintProps.OnPage.Value = AsposeVisio.BOOL.True;

page.PageSheet.PageProps.DrawingSizeType.Value = AsposeVisio.DrawingSizeTypeValue.FitPageDrawContents;

}

//Printing
AsposeVisio.Saving.ImageSaveOptions options = new AsposeVisio.Saving.ImageSaveOptions(AsposeVisio.SaveFileFormat.Tiff);
options.Resolution = 300;

options.ExportHiddenPage = true;

AsposeVisio.Saving.PageSize pageSize = new AsposeVisio.Saving.PageSize(GetPaperSize(printConfiguration.VisioPrintingSetting.PageSize));

pageSize.Height = (float)(11 * 300);
pageSize.Width = (float)(8.5 * 300);

options.PageSize = pageSize;
options.EnlargePage = false;

options.TiffCompression = AsposeVisio.Saving.TiffCompression.Ccitt4;
options.ImageColorMode = AsposeVisio.Saving.ImageColorMode.Grayscale;

                options.PageCount = 1;
                for (int i = 0; i < _document.Pages.Count; i++)
                {
                    options.PageIndex = i;
                    _document.Save(@"D:\DVisio{i}.tif", options);
                }

Kindly look into it, and suggest us if any changes require from our side.

Note: We are using print paper as Letter (8.5 * 11)

Visio.zip (91.8 KB)

@hemalp
Please set the unit of pageszie to pt,as this sample code:

        float width = (float)diagram.Pages[0].PageSheet.PageProps.PageWidth.Value * 72f;
        float heitht = (float)diagram.Pages[0].PageSheet.PageProps.PageHeight.Value * 72f;
        options.PageSize = new PageSize(width, heitht);
        diagram.Save("out.tiff", options); 

Thanks.

Hello @philip.zhou,

Thank you for quick response!

We’ve tried above solution and we have still found issue in content reading(not readable) and dimensions are not matched with our standards for letter paper.

Is there any recommendations/solutions for above stated issue?

Thank You.

@hemalp

Please describe the above issues in detail, you can use some screenshots.

Thanks.

Hello @philip.zhou,

Please check attached files for reference of output

OutputFiles.zip (57.8 KB)
.
Thank you.

@hemalp
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): DIAGRAMNET-53125

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hello @philip.zhou,

Thank you for response, we will wait for further updates on same.

Thank You.

@hemalp
We found that the tiff file generated by the following code is different from yours, please share your executable code to generate tiff .

        Diagram diagram = new Diagram("Visio.vsd");
        Aspose.Diagram.Saving.ImageSaveOptions options = new Aspose.Diagram.Saving.ImageSaveOptions(SaveFileFormat.TIFF);
        float width = (float)diagram.Pages[0].PageSheet.PageProps.PageWidth.Value * 72f;
        float heitht = (float)diagram.Pages[0].PageSheet.PageProps.PageHeight.Value * 72f;
        options.PageSize = new PageSize(width, heitht);
        diagram.Save("out.tiff", options);

Thanks.
out.zip (407.5 KB)

Hello @philip.zhou,

We need to print different scenarios PaperSizeFormat like letter, A4, etc. For the same file that’s why we set custom dimensions. In this situation, we are not able to use the below code.

float width = (float)diagram.Pages[0].PageSheet.PageProps.PageWidth.Value * 72f;
float height = (float)diagram.Pages[0].PageSheet.PageProps.PageHeight.Value * 72f;

Are there any recommendations/solutions for the above-stated issue?

Thank You.

@hemalp
Please set the pagesize to the size you want to print, in pt

//the above code
pageSize.Height = (float)(11 * 300); //unit to pt ,11inch*72
pageSize.Width = (float)(8.5 * 300);

Thanks

Hello @philip.zhou,

We set the below pagesize, but the output is incorrect
pageSize.Height = (float)(11 * 300);
pageSize.Width = (float)(8.5 * 300);

You can get a file from the attachment
OutputFile_2.zip (72.3 KB)

@hemalp
The tiff file generated by the following code is different from the output above, please share your executable code to generate the output file above.

Diagram diagram = new Diagram(“Visio.vsd”);
Aspose.Diagram.Saving.ImageSaveOptions options = new Aspose.Diagram.Saving.ImageSaveOptions(SaveFileFormat.TIFF);
float width = (float)11 * 300f;
float heitht = (float)8.5 * 300f;
options.PageSize = new PageSize(width, heitht);
diagram.Save(“out.tiff”, options);

Thanks.53125.zip (580.1 KB)

Hello @philip.zhou

We use the above code, but the output is incorrect.

We needed it in this Output_3.zip file.

The output file name which we needed is Needed Output.tif.
But the current output is the file: current output.tif

You can get a file from the attachment
Output_3.zip (82.3 KB)

@hemalp
We will look further into this issue.
You will be notified here once any update is ready for sharing.
Thanks.

Hello @philip.zhou

Is there any update on mentioned issue ?

Thanks

@hemalp
The file we generate with the above code is different from the output_3 file.
Could you please give us environment details with locale/regional settings and MS Visio language and version information. We will evaluate your issue further.
Thanks.

Hello @philip.zhou

What do you mean by environment details And locale/regional settings and MS Visio language
can you elaborate in detail.

Thanks

@hemalp
We need to check the system configuration because the same code produces different result files.

The system is a Windows 10 with English Language.
The regional setting is us-english.
Thanks.

Hello @philip.zhou

Our system is Window 10 Enterprise And Regional setting is English(India)

Thanks

Thanks for providing us locale/regional settings details.
We reproduced the problems you mentioned,The generated TIFF page appears stretched.We need to evaluate your issue in details.
Thanks.