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. Image for the cookie policy date
close icon

Exporting Excel to PDF its not Taking Excel Pagesize into PDF

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

6 Replies

KD Kesavan D Syncfusion Team July 26, 2016 10:37 AM UTC

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


NI Nilofer July 26, 2016 10:52 AM UTC

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

Thanks,


KD Kesavan D Syncfusion Team July 27, 2016 09:54 AM UTC

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 



NI Nilofer July 27, 2016 11:19 AM UTC

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

Best Regards,


KD Kesavan D Syncfusion Team July 28, 2016 05:23 AM UTC

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



NI Nilofer July 30, 2016 07:20 AM UTC

Thank you. Looking forward for the update.

Loader.
Live Chat Icon For mobile
Up arrow icon