Hello Neven,
Thank you for contacting us.
As mentioned in this
fonts documentation section all fonts that are not one of the
standard PDF fonts should be embedded. If the font is not embedded the result of opening the PDF on different devices is unpredictable and this not recommended due to PDF format specification. That is the reason why RadPdfProcessing embeds all non-standart fonts used in the document.
As RadPdfProcessing default font is Helvetica, which is one of the standard fonts, this font is not embedded which explains why exporting "hello world" document with RadPdfProcessing results in much smaller size. However, if you change the font in RadPdfProcessing to "Calibri", the size of the document will be the same as in RadWordsProcessing as RadWordsProcessing uses RadPdfProcessing for its PDF export. Although this difference in document size may seem huge for a "hello world" document, in real world scenario when the document has more text content the size of the embedded font is much smaller compared to the size of the PDF content. Additionally I would like to mention that as an optimization RadPdfProcessing does not embed the whole font but instead embeds only the font subset of the used characters which guarantees minimum font size.
As for the images - RadPdfProcessing inserts the image in the PDF with the same resolution as the referenced image. Using the
ImageQuality enumeration you can control the quality of the image and this way reduce the size using lower quality. You may try
this SDK demo to see how the different image quality results in different document size. However, there is one additional suggestion I would like to mention when talking about reducing the PDF size. If an image is rendered with size 500x500 in the PDF page then you may consider adding the image with similar size to the document. This means that if your original image is for instance 2000x2000 then you may preprocess it to become 500x500 and then add it to the corresponding RadFlowDocument or RadFixedDocument instance. Even exporting to PDF with ImageQuality.High, this preprocessing will reduce the image size in the document about 4 times and still the image will be rendered with maximum quality. I am attaching a demo project showing how you can resize images using only .Net Framework. A few words about this demo:
- It is a console application.
- It opens BigImage.jpg file that is about 1.2 MB with resolution 2313x2311.
- ResizeImage method resizes the original image to 35 KB with resolution 693x693 and image quality 75. If you choose lower image quality value you can get even more impressive image size difference.
- After the image is resized the application opens it, so that you can see the result with your default jpeg viewer.
When talking about performance - as mentioned in this
"ImageQuality.High with JPEG and JPEG2000 images" documentation section, when using ImageQuality.High RadPdfProcessing reads only the image headers and when the image is JPEG it inserts it in the document without processing the whole image pixels. This not only guarantees best image quality but also guarantees maximum performace as processing big images may be a time consuming operation. So as a performance optimization I would suggest you to use ImageQuality.High when exporting to PDF.
I hope this information is helpful. If you have any other questions or concerns please do not hesitate to contact us again.
Regards,
Deyan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the
Telerik Feedback Portal and vote to affect the priority of the items