We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Exporting Excel to PDF its not Taking Excel Pagesize into PDF

Thread ID:

Created:

Updated:

Platform:

Replies:

125137 Jul 25,2016 01:58 AM Jul 30,2016 03:20 AM Windows Forms 6
loading
Tags: XlsIO
Nilofer
Asked On July 25, 2016 01:58 AM

Hi, I am exporting the Excel File to PDF but it's not replicating the Excel Pagesize.
I have a excel with ISO ID-1 (85.60 X 53.98 MM) Papersize; but when I export the pdf is A4 size. How to get the same sized (as of excel) in pdf also.

Try
                SetDefaultPrinter(_DEFAULT_ID_PRINTER_NORMAL)
                Dim excelEngine As ExcelEngine = New ExcelEngine
                Dim application As IApplication = excelEngine.Excel

                application.DefaultVersion = ExcelVersion.Excel2013

                Dim workbook As IWorkbook = application.Workbooks.Open(PRINT_FILE & ".xlsx", ExcelOpenType.Automatic)
                Dim sheet As IWorksheet = workbook.Worksheets(0)

                'Converts the particular sheet 
                Dim converter As ExcelToPdfConverter = New ExcelToPdfConverter(sheet)
                Dim pdfDocument As PdfDocument = New PdfDocument()

                pdfDocument = converter.Convert()
                'Save the pdf file
                pdfDocument.Save(PRINT_FILE & ".pdf")

                'Dispose the objects
                pdfDocument.Close()
                converter.Dispose()
                workbook.Close()

                excelEngine.Dispose()

            Catch ex As Exception
                ' Respond to the error.
 MessageBox.Show(ex.Message)
                  CONTINUE_PRINT_FLAG = False
            Finally

                GC.Collect()
                GC.WaitForPendingFinalizers()
                GC.Collect()
                GC.WaitForPendingFinalizers()

                GC.Collect()
                GC.WaitForPendingFinalizers()

            End Try

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

Kesavan D [Syncfusion]
Replied On July 26, 2016 06:37 AM

Hi Nilofer, 

  

We regret to let you know that currently we do not have support for preserving custom page size in Excel To PDF conversion. However, we have added it to our Feature request list and it will be implemented in any of our upcoming releases.      
  
Please let us know if you need any other assistance on this. 

Regards, 
Kesavan

Nilofer
Replied On July 26, 2016 06:52 AM

oh ok. won't it take the default printer page size also ? the default printer is having same page size.

Thanks,

Kesavan D [Syncfusion]
Replied On July 27, 2016 05:54 AM

Hi Nillofer, 

Custom page size in Excel document is linked to the paper size of a printer. Converting such documents using XlsIO sets A4 as its default size in Excel To PDF conversion.  

Regards, 
Kesavan 


Nilofer
Replied On July 27, 2016 07:19 AM

Ok. Thanks.
Lets wait for the update you talked about. That will be certainly a great feature to have.

Best Regards,

Kesavan D [Syncfusion]
Replied On July 28, 2016 01:23 AM

Hi Nilofer, 
 
Thank you. We will let you once the feature is implemented in any of our upcoming releases 
 
Regards, 
Kesavan 


Nilofer
Replied On July 30, 2016 03:20 AM

Thank you. Looking forward for the update.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;