Bug 687931 - GS produces large PDF files
Summary: GS produces large PDF files
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: master
Hardware: PC Windows 2000
: P4 enhancement
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-07 13:25 UTC by Edward
Modified: 2013-07-03 08:10 UTC (History)
2 users (show)

See Also:
Customer:
Word Size: ---


Attachments
PostScript file (zipped with winzip) (777.47 KB, application/octet-stream)
2005-02-07 13:26 UTC, Edward
Details
PDF file created with Adobe Distiller (603.61 KB, application/pdf)
2005-02-07 13:27 UTC, Edward
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Edward 2005-02-07 13:25:56 UTC
When trying to convert the attached PostScript file with GS HEAD (i also tried 
it with GS 7.03, 8.14, 8.34 - same results), i get a 1.8Mb PDF file.

When i convert it with Adobe Distiller the PDF file is 620Kb in size.

The original document doesn't have any images inside - only text. After a 
quick look at the document structure i noticed that Distiller groups text 
blocks together and GS doesn't.
Comment 1 Edward 2005-02-07 13:26:55 UTC
Created attachment 1195 [details]
PostScript file (zipped with winzip)
Comment 2 Edward 2005-02-07 13:27:42 UTC
Created attachment 1196 [details]
PDF file created with Adobe Distiller
Comment 3 Jack Moffitt 2005-02-09 08:37:38 UTC
CVS HEAD and 8.50 both produce a 2MB file for me.
Comment 4 Igor Melichev 2005-03-04 03:09:41 UTC
1. Adobe Distiller 6 with "standard" settings creates a 1179K file. Probably 
you apply a different settings. Doing so, please specify corresponding 
settings to Ghostscript. Attach settings/command lines to the bug report.

2. Ghostscript use a different font set than Adobe. With Adobe fonts the 
character width appears same as in the source document, but with GS charater 
widths deltas go to the text. Here are qoutes :

Adobe : [(Sales History)17.2( Location)]TJ
GS:     [(S)1.54437(a)1.45652(l)0.184955(e)1.45652(s)0.90628( )0.725949(H)
1.09123(i)0.180331(s)0.910904(t)0.725949(o)1.45652(r)0.268185(y)0.910904( )
0.725949(-)0.268185( )0.725949(L)1.45652(o)1.45652(c)0.910904(a)1.45652(t)
0.725949(i)0.180331(o)1.45652(n)456.002]TJ

It is an old known problem, which to be addressed to the font wendor. We'll 
discuss it in support meeting once again, but please don't expact a rocket 
progress with it. 

3. GS writes clipping rectangles with general path construction commands, 
rather than Adobe does with 're' :

Adobe : 556.801 327.28 24.12 8.28 re
GS : 301.211 6866.8 m
450.008 6866.8 l
450.008 6784 l
301.211 6784 l
h

We'll improve it sometimes, rather it won't give a sensible effect due to the 
compression applied to contents streams. It's a low priority improvement.

For now I'm returning the bag to general Support.
Comment 5 Ray Johnston 2007-12-31 12:26:14 UTC
Reassigning to current "owner". Size still the same with rev 8468.
Comment 6 Shailesh Mistry 2011-07-13 20:59:50 UTC
Enhancement still missing in Ghostscript 9.03
Comment 7 Ken Sharp 2013-07-03 08:10:45 UTC
commit 489253b834075391d7826bc81ef52ede34f8289f improves the output file size by 30%, by spotting the rectangular clips and emitting 're'.

The text positioning difference is nothing to do with differences in the fonts. The text is originally shown in the PostScript file using the xshow operator, where each character has its position individually adjusted. The Ghostscript output pretty much matches that. Distiller spots that some of the adjustments are the same, and uses the 'Tc' and 'Tw' operators to adjust the movement for those characters instead. This results in fewer individual adjustments being required and so smaller output.

xshow and yshow are not normally heavily used operators and I think its not really worth adding this optimisation. At least for the present.

The GS output file is now 1.4 Mb (previously 2.0) as against Acrobat's 1.1.