Print Page | Close Window

How to resample pdf images to compress pdf size?

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=2655
Printed Date: 29 Mar 24 at 1:21PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: How to resample pdf images to compress pdf size?
Posted By: ExchangeViews
Subject: How to resample pdf images to compress pdf size?
Date Posted: 28 May 13 at 8:24AM
How to resample pdf images to compress pdf size? I extracted one by one image on disk, downsize the quality of JPG using image processing library then replaces the existing image with new one. After that, the file size get increased instead of going to down. Please assist the best way to reduce file size by downsizing the image quality.

Thanks in advance.Clap



Replies:
Posted By: AndrewC
Date Posted: 29 May 13 at 2:03PM
We would need to see your code and the PDF to understand what could be happening.

Andrew.


Posted By: ExchangeViews
Date Posted: 01 Jun 13 at 6:31AM
Dear Andrew thanks for reply. Here is the code i m using:
  for J := 1 to ImgCOunt do
  Begin
     ImgID:= QP.GetImageID(J);
     QP.SelectImage(ImgID);
     if QP.ImageType = 1 then
     Begin
      QP.SaveImageToFile('F:\temp.jpg');
      ObjImage.IO.LoadFromFileAuto('F:\temp.jpg');
      ObjImage.IO.Params.JPEG_Quality:= 40;
      ObjImage.IO.SaveToFileJpeg('F:\temp.jpg');
      QP.ReplaceImage(ImgID, QP.AddImageFromFile('F:\temp.jpg',0));
     End;
  End;
     QP.SaveToFile('F:\new.pdf');

Is this correct way of reducing the image size? Is there any memory still present in pdf which is increasing file size. Please help me. Thanks in advance.


Posted By: AndrewC
Date Posted: 04 Jun 13 at 3:51AM
Have you tried calling QP.ClearImage(ImageID);  which will mostly remove the original image.  This line should go after the call to QP.ReplaceImage.

Are you also calling QP.CompressImages(1) at the start of your code.

Andrew.



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