Spire.XLS is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Mon Jun 13, 2022 9:04 am

how to convert xls to PDF full page A4

Code: Select all
                  name = "filename.xls;
                  File.WriteAllBytes(name, System.Convert.FromBase64String(//**Base64 file));

                    Workbook document = new Workbook();
                    document.LoadFromFile(name);
                    for (int j = 0; j < document.Worksheets.Count; j++)
                    {
                        document.Worksheets[j].PageSetup.IsFitToPage = true;
                    }
                    document.SaveToFile("filePDF.pdf", Spire.Xls.FileFormat.PDF);


file excle
Image

result
page A4
Image

jame_piyawat2
 
Posts: 10
Joined: Fri May 07, 2021 4:36 am

Mon Jun 13, 2022 10:12 am

Hi,

Thank you for your inquiry.
I did an initial test but didn't reproduce your problem. When converting Excel to PDF, the page size is A4 by default. In order to help us effectively solve your problem, please provide your Excel document and excepted output PDF. You can attach your file here or send it to us via email (support@e-iceblue.com). Thanks in advance.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 388
Joined: Mon Mar 07, 2022 2:30 am

Return to Spire.XLS