PDFsharp & MigraDoc Forum
https://forum.pdfsharp.net/

Reducing the size of the output PDF file
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2955
Page 1 of 1

Author:  hsahay [ Thu Oct 16, 2014 11:04 am ]
Post subject:  Reducing the size of the output PDF file

I am using C# to take an Excel file as input and convert it into PDF. There are no images, just data in the form of tables. I am getting files as big as 100 MB.
I am using the following code for the conversions:
Code:
PdfDocumentRenderer _pdfRendererDoc1 = new PdfDocumentRenderer(true);
                        Document _doc1 = new Document();
                        Style _styleDoc1 = _object.SetStyle(_doc1);
                        PdfDocument pdfDoc1 = new PdfDocument();

                        Section _sectionDoc1 = _object.SetSection(_doc1);
                        Table _tableDoc1 = _object.AddTables(_sectionDoc1);

                        Row _rowDoc1;
                        Cell _cellDoc1;

                        _object.AddColumns(_tableDoc1, colWidth);

                        for (int row = 1; row <= end.Row; row++)
                        {
                            _rowDoc1 = _object.AddRows(_tableDoc1);

                            int col = 1, pdfCol = 0;
                            while (pdfCol < numColumns)
                            {
                                _cellDoc1 = _rowDoc1.Cells[pdfCol];
                                pdfCol ++;
                                col++;
                            }
                        }

                        _pdfRendererDoc1.Document = _doc1;

                        // Render output file //
                        _pdfRendererDoc1.RenderDocument();

                        // Save output file //
                        _pdfRendererDoc1.Save(outputFileLocation + outputFileName);


So, is there an option (like resolution, may be) to reduce the size of PDFs?

Thanks in advance :)

Author:  Thomas Hoevel [ Thu Oct 16, 2014 11:22 am ]
Post subject:  Re: Reducing the size of the output PDF file

The RELEASE build creates smaller files than the DEBUG build (verbose files with many comments).

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/