简体   繁体   中英

GhostScript PDF Compression - PDF Size Increasing Issue

I am trying to compress the PDF file using my Asp.Net application with GhostScript. But somehow i couldn't get the successful ouput for some PDF.

GhostScript Application Details

Version : 9.19

name : gswin64c.exe

Please have a look at the below mentioned issue.

My issue is, for some PDF, ghost compression technique is not working fine rather it increases the File size.

For eg. please have a look at this link (Here i have added some of input and output files, which i had tested with application)

Case 1: PDF compression not worked as desired.

Here B_BeforeCompression.pdf (its size is 369 KB) is the source PDF, when i compress it using the GhostPDF Compression technique it actually increases its size B_AfterCompression.pdf (its size is 473 KB)

Case 2: PDF Compression worked fine

Here A_BeforeCompression.pdf (its size is 1458 KB) when it is compressed, the output PDF is generated as A_AfterCompression.pdf size is 286 KB.

Here my question is, Why this contrary occurs (a technique works with one PDF but not successfully do with the another PDF.)

 "-sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile="OutputPDF" "InputPDF";

Please give me the possible solution that would make the PDF Compression is compatible for the all the PDF files.

Ghostscript does not, ever, compress a PDF file. see the Overview in this document

What the Ghostscript pdfwrite device does is produce a new PDF, the goal of this device is that the visual appearance of the PDF file should be the same as the appearnace of the input, no matter what format the input was in (originally PostScript it now works, with differing degrees of success, with PostScript, PDF, PCL, PXL and XPS input).

The way the PDF interpreter and the pdfwrite device work, it may be that the new file is smaller than the original, particularly if you use aggressive processing on the input such as downsampling the resolution of any images. However, this is by no means guaranteed, as you have discovered.

There is, therefore, no "solution that would make the PDF Compression is compatible for the all the PDF files."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM