You want to detect some of the low-level structure in a PDF file, right? Perhaps the
pagedump.pl script, which comes in the
PDF
CPAN package in the "examples" subdirectory would be of some help.
Here is the start of what it dumps about the first page of The Perl Journal:
% perl pagedump.pl 0301tpj.pdf 1
Page 1
Dictionary
<<
Name: /CropBox => Array
[
Number: 0
Number: 0
Number: 558
Number: 756
]
Name: /MediaBox => Array
[
Number: 0
Number: 0
Number: 558
Number: 756
]
Name: /Rotate => Number: 0
Other: Page_Object => Object: 402 0 R
Other: Resource_Object => Object: 434 0 R
>>
...
You can probably find a distinct set of components for your image-only cases.
Update: Mr. Muskrat and I seem to have different interpretations of your question. I read "detect that" to mean "detect that a file (which is already known to be a pdf file) contains only images rather than images plus text or text alone."
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.