Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #1678 > unrolled thread
| Started by | David Mathog <dmathog@gmail.com> |
|---|---|
| First post | 2011-01-31 09:10 -0800 |
| Last post | 2011-02-03 15:14 -0800 |
| Articles | 4 — 2 participants |
Back to article view | Back to comp.lang.postscript
PS/PDF document analysis tool? David Mathog <dmathog@gmail.com> - 2011-01-31 09:10 -0800
Re: PS/PDF document analysis tool? ken <ken@spamcop.net> - 2011-01-31 17:28 +0000
Re: PS/PDF document analysis tool? David Mathog <dmathog@gmail.com> - 2011-01-31 09:37 -0800
Re: PS/PDF document analysis tool? David Mathog <dmathog@gmail.com> - 2011-02-03 15:14 -0800
| From | David Mathog <dmathog@gmail.com> |
|---|---|
| Date | 2011-01-31 09:10 -0800 |
| Subject | PS/PDF document analysis tool? |
| Message-ID | <824631ae-cb98-41ba-af88-f326ea850d61@17g2000prf.googlegroups.com> |
I have been experimenting with various settings in PDFCreator, which
is just a wrapper around Ghostscript (currrently 9.0) and it has been
doing some very odd things in terms of file size. For instance, with
color images and grayscale set exactly the same way (maximum jpeg
compression, resample to 72 dpi), printing a document from PPT as
"gray scale" instead of "color" doubled the size of the resulting
PDF. I cannot easily tell where the extra bytes are going.
Figuring out what is going on would be a lot easier if there was some
sort of analysis tool to look through a PDF or PS file and summarize
on a global and page by page basis exactly how much space is used,
where, and by what. For instance, in very crude terms, a 3 page PDF
with just text on the first page, a color image on the second page,
and 2 grayscale images on the third page might analyze something like
this:
% overview test.pdf
global:
Size 102768
Embeddedfonts: 2
Arial 64000
Calibri (subset) 32000
Definitions: N
function1 1234
....
functionN 5234
Pages: 3
Page 1.
Size: 246
Text: Arial 234
Calibri 12
ColorImages: None
GSImages: None
BWImages: None
Page 2:
Size 1234
Text: None
ColorImages: 1
Image 1, 72dpi 1234
GSImages: None
BWImages: None
Page 3
Size: 2468
Text: None
ColorImages: None
GSImages: 2
Image 1, 72dpi 1234
Image 2, 150dpi 1234
BWImages: None
Is there a program like this??? I sure hope so, because in one run it
would tell me how the
color -> gray scale print option in PPT changed the file size as it
did.
Thank you,
David Mathog
[toc] | [next] | [standalone]
| From | ken <ken@spamcop.net> |
|---|---|
| Date | 2011-01-31 17:28 +0000 |
| Message-ID | <MPG.27b101b282cbb290989811@usenet.plus.net> |
| In reply to | #1678 |
In article <824631ae-cb98-41ba-af88-f326ea850d61@ 17g2000prf.googlegroups.com>, dmathog@gmail.com says... > Is there a program like this??? I sure hope so, because in one run it > would tell me how the > color -> gray scale print option in PPT changed the file size as it > did. Adobe Acrobat can do some of this at least. In version 9 (Pro) if you select Advanced->PDF Optimizer and then press the "Audit Space Usage" button it will give you some information. I seem to recall earlier versions of Acrobat doing more in this regard but that could be faulty memory. Ken
[toc] | [prev] | [next] | [standalone]
| From | David Mathog <dmathog@gmail.com> |
|---|---|
| Date | 2011-01-31 09:37 -0800 |
| Message-ID | <e07ac764-1455-45c4-8c75-63ec62fe779b@o21g2000prn.googlegroups.com> |
| In reply to | #1685 |
On Jan 31, 9:28 am, ken <k...@spamcop.net> wrote: > Adobe Acrobat can do some of this at least. In version 9 (Pro) if you > select Advanced->PDF Optimizer and then press the "Audit Space Usage" > button it will give you some information. I seem to recall earlier > versions of Acrobat doing more in this regard but that could be faulty > memory. If push comes to shove I will try that. (I am, to put it mildly, not a fan of Adobe's bloated and difficult to uninstall software.) Is there perhaps some option in Ghostscript that can do this? Since gs can take apart PS and PDF files and put them back together again it would seem that somewhere in the middle it must have a data structure containing the desired information. Thanks, David Mathog
[toc] | [prev] | [next] | [standalone]
| From | David Mathog <dmathog@gmail.com> |
|---|---|
| Date | 2011-02-03 15:14 -0800 |
| Message-ID | <b9a13a31-b6d2-4f38-92f3-114a9bb158e1@n2g2000pre.googlegroups.com> |
| In reply to | #1678 |
MUPDF turned out to be pretty complex, so instead I modified a much
smaller script from Didier Stevens called pdf-parser.py
http://blog.didierstevens.com/programs/pdf-tools/
to emit a sort of object level overview, and then rolled a perl script
to massage that into the desired form. Both are included here:
ftp://saf.bio.caltech.edu/pub/software/linux_or_unix_tools/pdfsummary.tar.gz
I simplified the object form from "123 0" to just "123" to conserve
space. Also because none of the PDFs I tested had anything other than
0 in the second position. (What is the second position for, includes
from other files?)
Example:
% pdf-parser.py -b test.pdf | pdfsummary.pl
PDF summary:
-----------------------------------------
Page (Object): Size
1 ( 4): 66345
2 ( 13): 218479
3 ( 17): 18922
4 ( 26): 1048
5 ( 32): 1927
6 ( 38): 1177
7 ( 42): 1471
<SNIP>
32 ( 242): 118524
33 ( 250): 49082
34 ( 256): 71793
-----------------------------------------
Font (Object): Size (Description) PP: <page list>
1 ( 7): 206 (/Times-Roman) PP:
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
,29,30,31,32,33,34
2 ( 10): 119 (/Times-Italic) PP:
1,3,5,6,7,8,9,10,12,25,33,34
3 ( 21): 47 (/Symbol) PP: 3,5,6,7,8,9,21,25,34
4 ( 35): 119 (/Helvetica) PP:
5,9,11,13,14,19,21,26,28,29,31,32,33
5 ( 45): 3999 (/CXOYBI+Symbol) PP: 7,8,9,25
6 ( 56): 112 (/Times-Bold) PP: 9,11,16,17,18,24,25,27,28,29
7 ( 178): 7013 (/KPSHBO+TimesNewRoman,Bold) PP: 24
8 ( 180): 6439 (/KPSHBO+TimesNewRoman) PP: 24
-----------------------------------------
Image (Object): Size (Description) PP: <page list>
1 ( 8): 25782 (W=1056 H=299 Bpc=8 DCT) PP: 1
2 ( 9): 39040 (W=423 H=538 Bpc=8 DCT) PP: 1
3 ( 22): 8451 (W=328 H=248 Bpc=8 DCT) PP: 3
4 ( 29): 8229 (W=370 H=296 Bpc=8 DCT) PP: 4,32
<SNIP>
47 ( 253): 47607 (W=879 H=836 Bpc=8 DCT) PP: 33
48 ( 259): 52185 (W=878 H=837 Bpc=8 DCT) PP: 34
49 ( 261): 15911 (W=186 H=182 Bpc=8 Flate) PP: 34
-----------------------------------------
Object Summary:
Number: 270
MaxVal: 278
Sizes
Total: 1965662
PageSpecific: 1930963
Images: 1585349
Global-Fonts: 18054
Global-Other: 16645
-----------------------------------------
It can also dump the size and page usage information for all of the
objects, but by default that is off. Anyway, please give this sript a
try if it interests you.
Regards,
David Mathog
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.postscript
csiph-web