We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose PDF conversation : Fall over right most column to next page

We are using Aspose.Cell (dll Version 8.9.2.0) for printing Excel to PDF through Aspose.

Issue :
Aspose is not printing properly
Operating System : Windows 10
Screen Resolution : 1920 * 1080 (Recommended resolution)

Apart from any other resolution it is not working out(Even Microsoft Recommended Resolution also)
1024 * 768
1360 * 768
1366 * 768

How can we avoid the content spill over from system to system (different screen resolution). We verified that Microsoft interop dll and print to PDF of MS Excel prints data perfectly.

Could you please share the code to avoid content spill over?

Below I have attached the code and Excel document I used for PDF conversation.

Please let us know if more details required. It will be great if your share the resolution soon.

Attached sample for reproduced issue
Samples.zip (36.9 KB)

Here is the sample code we are used for converting

    public void ConvertExcelWorkbookToPDF(SpreadsheetGear.IWorkbook wb, string destinationFile, SpreadsheetGear.FileFormat f = SpreadsheetGear.FileFormat.OpenXMLWorkbook)
    {
          
            MemoryStream ms = new MemoryStream();
            wb.SanitizeWorkbookEx();
            wb.SaveToStreamEx(ref ms, f);
            Aspose.Cells.Workbook wb1 = new Aspose.Cells.Workbook(ms, new Aspose.Cells.LoadOptions(Aspose.Cells.LoadFormat.Auto));
            AutoFitterOptions oAutoFitterOptions = new AutoFitterOptions { AutoFitMergedCells = true, OnlyAuto = false };
            foreach (Aspose.Cells.Worksheet ws in wb1.Worksheets)
           {
                ws.AutoFitRow(0, 0, 0, oAutoFitterOptions);
                ws.AutoFitRows(true);                     
            }
            Aspose.Cells.PdfSaveOptions pso = new Aspose.Cells.PdfSaveOptions();
            pso.DefaultFont = "Calibri";
            wb1.Save(destinationFile, pso);
            ms.CloseEx();
            
        }

@sreeraj_05

Thanks for using Aspose APIs.

Please download and try the most recent version from the following link and it should fix your issue.

Please also see the following screenshot. Its resolution is 1920x1080. I tested the issue in this resolution and took the screenshot. Please download the output Pdf for your reference.

Output Pdf File.zip (26.6 KB)

C#

Workbook wb = new Workbook("TempFile_ForPreview.xlsx");
wb.Save("out.pdf");

Screenshot:

Thanks i will check and revert you.

@sreeraj_05

Thanks for using Aspose APIs.

Please check if your display setting is set to 100%, 125% or 150% as shown in this screenshot. If it is set to non-100%, set it back to 100% and it should fix your issue. It is best option.

In case, you do not want to set it to 100%, then set CellsHelper.DPI = 96 before you execute your code. And it should also solve your issue.

Screenshot:

Hi ,

I am using spreadsheet gear for inputting excel stream to pdf conversion still facing issue in different resolution. Can i debug its internals.

@sreeraj_05

Please try the solution and suggestions given to you in the previous post. i.e.

Progressing testing

@sreeraj_05

It seems, you are testing the methods suggested in previous posts. Let us know if you face any issue, we will look into it and help you asap.

Hi

I have set Aspose.Cells.CellsHelper.DPI =96 ; in code but its not changed in next line of code

For example Aspose.Cells.CellsHelper.DPI =96; printed Aspose.Cells.CellsHelper.DPI getting 120 there .

it is taking the value from some where , could you please have a look.

@sreeraj_05

Thanks for using Aspose APIs.

We have looked into this issue and found that,

CellsHelper.DPI = 96;

should be set at the start of your code and you should not get CellsHelper.DPI before you set it.

Hi,

I have tried adding above code in both before setting licence and after setting licence in App.xaml.cs this is the starting point of my wpf application .

I think something around this DPI settings , at some point it will change the DPI but it won’t next time

Try to change DPI to 96 and 120 several time using code
Also checked in version 17.12.8 you provided seems same issue in that .
Same issue for reference

@sreeraj_05

Please provide us your simplified test project utilizing the DPI settings. It will help us look into this issue further. Thanks for your help in this regard.

TestDPI.zip (20.5 KB)
I have attached a code for setting and printing DPI value
please refer Aspose.Cells.dll 8.9.2.0 version in that project as this app won’t support more than 3MB file upload

Please let me know if you required anything more from me

@sreeraj_05

Please comment the code line

Console.WriteLine(Aspose.Cells.CellsHelper.DPI.ToString());

CellsHelper.DPI API can be set only once.

If you get CellsHelper.DPI first, it will be set by Aspose Cells self internally.

I will check and revert you , thank you very much.

Hi @shakeel.faiz

We are progressing with testing and so far good , tested in two machine and working fine . i will let you know if anything comes up.
Thanks for your effort to solve this issue

@sreeraj_05

Thanks for your feedback and using Aspose.Cells.

It is good to know that initial testing yielded good results. Let us know if you encounter any other issue, we will be glad to look into it and help you further.

1 Like

Hi @shakeel.faiz

Our QA team confirmed that its working properly (CellsHelper.DPI = 96;)

Sorry for the delay .

@sreeraj_05,

Good to know that it passes QA tests. Feel free to write us back if you have further comments or questions, we will be happy to assist you soon.