Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Dec 10, 2019 5:02 pm

hi by the way spire is great library converting excel files to pdf in just three lines of codes is a huge thing in my opinion
may question is i have worksheet that containing ten columns the problem is when i convert the worksheet to pdf file i only get eight columns the other are gone, so how to shrink the worksheet content to fit the pdf width i tried Workbook.Convertingsettings.Sheetfittopage but all i get is fitting the content to one page i want the content to fit the pdf width so all columns will appear in the same line here is what i did
Code: Select all
            workbook = new Workbook();
            workbook.LoadFromFile(ExcelPath);
            worksheet = workbook.Worksheets[SheetName];
            workbook.ConverterSetting.SheetfitTopage = true;
            worksheet.SaveToPdf(destinationPath);
and again thanks for making our lives easier :)

omaromar
 
Posts: 1
Joined: Thu Nov 28, 2019 10:37 pm

Wed Dec 11, 2019 2:08 am

Hi,

Thanks for your inquiry.
Please refer to following code:
Code: Select all
            var workbook = new Workbook();
            workbook.LoadFromFile(FilePath);
            Worksheet  worksheet = workbook.Worksheets[SheetName];
            //Automatically fit page height
            worksheet.PageSetup.FitToPagesTall = 0;
            //Fit to one page width
            worksheet.PageSetup.FitToPagesWide = 1;
            worksheet.SaveToPdf(destinationPath);


If you still have the issue, please provide your input Excel file for further investigation.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Jan 20, 2020 8:24 am

Hi,

Greetings from E-iceblue.
Did the code I provided help you solve your issue? Has your issue been resolved?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF