Print Page | Close Window

PDF Size/Quality Control

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1873
Printed Date: 22 Nov 24 at 7:42PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: PDF Size/Quality Control
Posted By: vk_rt
Subject: PDF Size/Quality Control
Date Posted: 30 Jun 11 at 1:52AM
Hi,

I am using importemffromfile function to convert a metafile into pdf format, i am using bitmap image as vector image is not giving me properly formatted pdf. But issue with bitmap or vector image for me is that size of the pdf being generated is too much, for a 50kb emf file I am getting around 2.7mb of pdf with bitmap and 12mb of pdf with vector image for 6 pages. It seems like DPI of pdf is too high.

Is there a way that i can control dpi or quality of pdf while generating pdf, so that i can get pdf file with reasonable size. 

Thanks



Replies:
Posted By: Rowan
Date Posted: 30 Jun 11 at 1:17PM
A PDF does not have any concept of DPI. It's like that the image data is compressed in the EMF and when it's added to the PDF is is uncompressed. Can you upload can example of the EMF and the resulting PDF that we can test?


Posted By: vk_rt
Date Posted: 30 Jun 11 at 11:08PM
So, does size of pdf only depends on size of emf? Is there any other quality/size/compression factor we can control?

I added 3 examples here :
http://www.raintreeinc.com/files/pdfandemf.rar

PDF's are encrypted with password 1234. These pdf examples i generated are using older version pdf library but functions are same. With new version, i need to change and control size, if possible.


Posted By: Rowan
Date Posted: 01 Jul 11 at 10:51AM
Image data and font data can have a big affect on the size of a PDF. For instance, in the PDFs you uploaded (specifically 'Productivity Report Page.pdf'), 99.87% of the file size is caused by image data.

After adding the EMF to the PDF you can try calling CompressImages to see if you can compress the image data that way.


Posted By: vk_rt
Date Posted: 01 Jul 11 at 9:13PM
Check size of these 2 pdf files, one is generated from pdf library and another using pdf print driver. 

Big difference in file size with same data, 27kb and 1.4Mb

http://www.raintreeinc.com/public/pdf_lib_testsize3page.pdf - http://www.raintreeinc.com/public/pdf_lib_testsize3page.pdf
http://www.raintreeinc.com/public/pdfprint_driver_testsize.pdf - http://www.raintreeinc.com/public/pdfprint_driver_testsize.pdf

I would like to get the file from library to around same size, I tried compressImages but didn't saw any change in file size

          lPDF.CheckError(lPDF.ImportEMFFromStream(lMetafileStream, 1, 1));
          lPDF.CheckError(lPDF.compressimages(1));



Posted By: vk_rt
Date Posted: 01 Jul 11 at 9:13PM
again password is 1234 for the pdf 


Posted By: vk_rt
Date Posted: 05 Jul 11 at 8:03PM
Hi Rowan, any other ideas?


Posted By: Ingo
Date Posted: 05 Jul 11 at 8:18PM
Hi vk_rt!

The large file contains images and the page size is 6597 x 5100 pixels.
The small file contains only text and the page size is 612 x 792 pixels.
So work on the image-properties BEFORE using it for pdf-creation.

Cheers and welcome here,
Ingo




Posted By: vk_rt
Date Posted: 06 Jul 11 at 2:17AM
How do i decrease image size, to create that small size pdf? As compress images didn't worked out, do i need to use vector image?
I also tried using setimageresolution function, that too didn't helped at all.


Posted By: engstmalta
Date Posted: 30 Sep 11 at 9:57AM
All ImportEMF functions embedd the complete fonts. So far so good. But those fonts are embedded as uncompressed streams not only one of the compress methods manage to compress them!
 
That blows any PDF size generated with EMF out of proportion. What about allowing to compress existing font streams? Or another nice function would be CompressObject(compressiontype). With such a function we could manually search uncompressed objects and compress them.
 
Thanks!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk