Just remember that doing that is considered a REFRYING operation and is quite 
LOSSY.  If that’s OK for your content – feel free, but just make sure you 
understand the risks involved in doing so.

Leonard

From: Carlos Arturo Bernal Carvajal 
<bernalcarva...@gmail.com<mailto:bernalcarva...@gmail.com>>
Reply-To: Post here 
<itext-questions@lists.sourceforge.net<mailto:itext-questions@lists.sourceforge.net>>
Date: Tuesday, July 8, 2014 at 11:38 AM
To: Post here 
<itext-questions@lists.sourceforge.net<mailto:itext-questions@lists.sourceforge.net>>
Subject: Re: [iText-questions] [SPAM] Re: Reduce PDF file size

You could try using Ghostscript after generating the PDF width iText. 
http://www.ghostscript.com/

It works really good for me. I work at a photobook internet company and we 
generate the print PDF's using iText, but the output can be huge, like 500mb, 
so we use Ghostscript to compress the resulting file.

We use the following command;

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.7 -dPDFSETTINGS=/prepress 
-sDefaultRGBProfile=/home/ubuntu/cronjob_autopdf_pixote2/colorProfiles/AdobeRGB1998.icc
 
-sDefaultCMYKProfile=/home/ubuntu/cronjob_autopdf_pixote2/colorProfiles/CoatedFOGRA39.icc
 -dOverrideICC=true 
-sOutputICCProfile=/home/ubuntu/cronjob_autopdf_pixote2/colorProfiles/CoatedFOGRA39.icc
 -dNOPAUSE -dQUIET -dBATCH -sOutputFile="${file/.pdf/}_optimized.pdf" "$file"


2014-07-08 10:18 GMT-05:00 TvT 
<tvtre...@nepatec.de<mailto:tvtre...@nepatec.de>>:
Ok Suresh,

that is not possible. Some pdfs do not contain any images, nor any unused 
objects - size reduction is not possible in that case even if the pdf is 200 MB.
I am guessing you want to reduce the size of Pdfs which mostly (or only) 
contain images (e.g. PDFs created from a scanner etc).
You want to reduce the quality of the contained images so that the final size 
will be much smaller...?

You need to be more specific here...



2014-07-08 17:09 GMT+02:00 Suresh Amsala 
<sureshinfo...@gmail.com<mailto:sureshinfo...@gmail.com>>:

Dear Leonard Rosenthol,

I didn't try using Adobe Acrobat but i want to do through programmatically not 
manually why because that is not a fixed size it may vary and the files should 
be uploaded by users.

The quality should maintain 70%-80% compare to original pdf.The remaining 
things I don't mine like fonts,headers etc.


On Tue, Jul 8, 2014 at 8:25 PM, Leonard Rosenthol 
<lrose...@adobe.com<mailto:lrose...@adobe.com>> wrote:
Did you try using Adobe Acrobat (even a trial version) to see if it can reduce 
the size of your PDFs?  Depending on what is in there, and what options are 
important to you (embedded fonts, high quality images, etc.) it may not be 
possible to reduce the size.

Leonard

From: Suresh Amsala <sureshinfo...@gmail.com<mailto:sureshinfo...@gmail.com>>
Reply-To: Post here 
<itext-questions@lists.sourceforge.net<mailto:itext-questions@lists.sourceforge.net>>
Date: Tuesday, July 8, 2014 at 10:45 AM
To: Post here 
<itext-questions@lists.sourceforge.net<mailto:itext-questions@lists.sourceforge.net>>
Subject: Re: [iText-questions] [SPAM] Re: Reduce PDF file size

I am uploading 20 MB pdf file it contains images and text and i want to 
compress this file size to bellow 1 MB using iTextSharp in C#.

How to do this? I tried TVT's Sample code but the file does not compressing I 
mean the file size is same before uploading and after uploading.


On Tue, Jul 8, 2014 at 5:04 PM, TvT 
<tvtre...@nepatec.de<mailto:tvtre...@nepatec.de>> wrote:
There are several options but mkl is right: You need to be certain that there 
are unused things in your pdf.
To get an idea whats possible try the following two options in adobe acrobat:
"File > Save As > Optimized PDF...", and "File > Save As > Reduced Size PDF...".

In iText you got several options:

- enable compression
- remove unused objects
- remove fields, annotations etc. if you don't need those anymore

However you need to be more specific about your situation. Maybe you merged two 
PDFs and didn't used PdfCopy instead of PdfSmartCopy - who knows?

Still some code which shows some of the stuff:

PdfStamper stamper = new PdfStamper(reader, fs, 
PdfWriter.VERSION_1_5);PdfWriter writer = stamper.Writer;
writer.SetPdfVersion(PdfWriter.PDF_VERSION_1_5);
writer.CompressionLevel = pdf.PdfStream.BEST_COMPRESSION;
reader.RemoveFields();
reader.RemoveUnusedObjects();
stamper.Reader.RemoveUnusedObjects();

stamper.SetFullCompression();
stamper.Writer.SetFullCompression();
stamper.Close();






2014-07-08 12:42 GMT+02:00 mkl 
<m...@wir-sind-cool.org<mailto:m...@wir-sind-cool.org>>:

Amsala Suresh,

Suresh Amsala wrote
> I want to compress a *PDF file size from MB's to KB's* (if the file size
> is 5 MB then it should be compressed in to KB's like 500 KB or 600 KB).

What information in those PDFs is superfluous in your context and can be
thrown away?

Regards,   Michael

PS: Knowing nothing about the PDFs in question it is hard to tell whether or
not they can be compressed at all. There of course are some techniques like

* replacing images with lower-resolution or lower-quality replacements (but
you have not told us whether there are images in those PDFs and whether they
may be downgraded);
* removing embedded fonts if you know they are available to the target
audience PDF viewers and provide the required information (but you have not
told us whether there are such embedded fonts);
* re-compressing the streams at highest compression setting and switching to
object streams (but the files may already use those settings);
* hunting for duplicate objects like identical header images included
separately in the file (but you have not indicated whether there are such
duplicates)...



--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Reduce-PDF-file-size-tp4660118p4660119.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net<mailto:iText-questions@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net<mailto:iText-questions@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php



--
Thanks and Regards
Amsala Suresh
9966151913

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net<mailto:iText-questions@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php



--
Thanks and Regards
Amsala Suresh
9966151913

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net<mailto:iText-questions@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net<mailto:iText-questions@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php



--
Carlos Bernal
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to