This is a migrated thread and some comments may be shown as answers.

PDF File Size

9 Answers 445 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
imaginarylight
Top achievements
Rank 1
imaginarylight asked on 23 Jan 2008, 02:44 PM
Hi,

I am using the script I found in another thread to export my reports directly to PDF. It is simple and works great. However, the size of the resulting PDFs seems too large. A single letter size page with one small logo and just text exports to 1.6 MB. If there a setting or something I can play with to help render these to a smaller file size?

Thanks

John

PS - I tried the same report without the logo and it only reduced the size by 0.1 MB.

9 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 23 Jan 2008, 03:05 PM
Hello imaginarylight,

Thank you for contacting Telerik Support.

The large size of your PDF file is most probably such because fonts are embedded in the file.

With Q3 2007 SP1 we introduced a configuration parameter for the PDF Rendering Extension called FontEmbedding. You can select whether to embed all fonts entirely (Full), embed only the used subsets (Subset) or do not embed fonts at all (None).

To learn how to configure you export to PDF with the settings that you want, please read carefully the following help topics:

Configuring Telerik Reporting
Device Information Settings

Note: In those topics, in places where version 2.0.0.0 is mentioned, you should put 2.0.1.0 if you are using the Service Pack.

If you have any problems configuring Telerik Reporting, do not hesitate to drop us a line.

All the best,
Ross
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
imaginarylight
Top achievements
Rank 1
answered on 23 Jan 2008, 03:15 PM
Hi Again,

Here is the code I am using;

Sub

ExportToPDF(ByVal reportName As String, ByVal reportToExport As Telerik.Reporting.Report)

Dim mimeType As String = String.Empty
Dim ext As String = String.Empty
Dim encoding As Encoding = Encoding.[Default]
Dim reportBytes As Byte() = ReportProcessor.Render("PDF", reportToExport, Nothing, mimeType, ext, encoding)
Dim fileName As String = reportName + ".pdf"

Response.Clear()
Response.ContentType = mimeType
Response.Cache.SetCacheability(HttpCacheability.[Private])
Response.Expires = -1
Response.Buffer =

False
Response.AddHeader("Content-Disposition", String.Format("{0};FileName=""{1}""", "attachment", fileName))
Response.OutputStream.Write(reportBytes, 0, reportBytes.Length)
Response.[End]()

End Sub

Where would I use the parameter you are talking about?

John

0
Rossen Hristov
Telerik team
answered on 23 Jan 2008, 03:38 PM
Hello imaginarylight,

Instead of passing Nothing for the deviceInfo parameter of ReportProcessor.Render, you should create a new Hashtable and set the key "FontEmbedding" to "Subset' or "None".

...
Dim
deviceInfo As Hashtable = new Hashtable()
deviceInfo("FontEmbedding") = "Subset"
Dim reportBytes As Byte() = ReportProcessor.Render("PDF", reportToExport, deviceInfo, mimeType, ext, encoding)
...

Best wishes,
Ross
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
rh
Top achievements
Rank 1
answered on 17 Feb 2008, 02:53 PM
This FontEmbedding setting doesn't help with file size. In fact, it seems to have the opposite effect. When setting it to Subset when compared to leaving deviceInfo null the file size actually increased. When setting it to None as compared to Subset the file size stayed the same.
0
Rossen Hristov
Telerik team
answered on 18 Feb 2008, 08:14 AM
Hello rh,

The behavior that you are describing is very strange. Can we have the report that causes it. We would like to debug the PDF generation and locate the cause for this behavior.

Sincerely yours,
Ross
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Rahul Khinvasara
Top achievements
Rank 1
answered on 17 Oct 2008, 11:39 AM
Hi Ross
            I have also used same code for generating PDF, I don't want to show PDF directly to User it will be sent through E-mail to the User. Can it's possible??

Thanks 
0
Steve
Telerik team
answered on 17 Oct 2008, 12:19 PM
Hi Rahul,

We've already answered your question in the other forum thread you've opened. Please restrain from opening multiple threads with the same content as this only slows us down. A solution for emailing the report is available in this code library.

Best wishes,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Vincenzo
Top achievements
Rank 1
answered on 12 Jan 2009, 05:42 PM
I'd like the C# version for the referenced code below for the FontEmbedding parameter please:

Dim deviceInfo As Hashtable = new Hashtable()
deviceInfo("FontEmbedding") = "Subset"
Dim reportBytes As Byte() = ReportProcessor.Render("PDF", reportToExport, deviceInfo, mimeType, ext, encoding)

Thanks,
Vince



0
Steve
Telerik team
answered on 13 Jan 2009, 08:23 AM
Hello Vincenzo,

You can use our code converter when you need to convert code - it is available here. Here is the C# version of the code you've requested:

       Hashtable deviceInfo = new Hashtable();
       deviceInfo["FontEmbedding"] = "Subset";
       byte[] reportBytes = ReportProcessor.Render("PDF", reportToExport, deviceInfo, mimeType, ext, encoding);

Best wishes,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
imaginarylight
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
imaginarylight
Top achievements
Rank 1
rh
Top achievements
Rank 1
Rahul Khinvasara
Top achievements
Rank 1
Steve
Telerik team
Vincenzo
Top achievements
Rank 1
Share this question
or