Fuse::PDF::ContentFS - Represent actual PDF document properties as files
use Fuse::PDF::ContentFS; my $fs = Fuse::PDF::ContentFS->new({pdf => CAM::PDF->new('my_doc.pdf')}); $fs->fs_read('/');
or
% mount_pdf --all my_doc.pdf /Volumes/my_doc_pdf % cd /Volumes/my_doc_pdf % ls filesystems metadata pages revisions % ls metadata/ CreationDate Creator ID ModDate Producer % cat metadata/Producer Adobe PDF library 5.00 % ls pages 1 % ls pages/1 fonts images layout.txt text % ls pages/1/text formatted_text.txt plain_text.txt % cat pages/1/text/plain_text.txt F u s e : : P D F - E m b e d a f i l e s y s t e m i n a P D F d o c u m e n t C h r i s D o l a n < c d o l a n @ c p a n . o r g > T o g e t s o f t w a r e t h a t c a n i n t e r a c t w i t h t h i s f i l e s y s t e m , s e e h t t p : / / s e a r c h . c p a n . o r g / d i s t / F u s e - P D F / % cat pages/1/fonts/TT0/BaseFont HISDQN+Helvetica % ls pages/1/images/ 1.pdf 2.pdf 3.pdf 4.pdf % open pages/1/images/1.pdf % cd / % umount /Volumes/my_doc_pdf
Copyright 2007-2008 Chris Dolan, cdolan@cpan.org
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This is a read-only filesystem that represents the metadata of a PDF document as a filesystem. The metadata that are available are the ones that I've explicitly coded for. Much more is possible.
/pages/<num> - one folder per page of the document; count from 1 /pages/<num>/fonts/<ID> - one folder per referenced font, e.g. 'TT0' /pages/<num>/fonts/<ID>/Type - always 'Font' /pages/<num>/fonts/<ID>/Subtype - e.g. 'TrueType' /pages/<num>/fonts/<ID>/BaseFont - name of the font, e.g. 'Helvetica' /pages/<num>/fonts/<ID>/FirstChar - ordinal of the first available glyph /pages/<num>/fonts/<ID>/LastChar - ordinal of the last available glyph /pages/<num>/layout.txt - raw PDF markup for a page /pages/<num>/text/plain_text.txt - strings extracted from the page (rough!) /pages/<num>/text/formatted_text.txt - very rough text rendering of the page /pages/<num>/images/<num>.pdf - images used in the page, wrapped in a minimal PDF /metadata/ - one file for every metadata key/value in the root dict /metadata/ID - hexadecimal ID, hopefully unique /metadata/Author - usually the author's username; depends on authoring tool /metadata/Creator - name of generating application /metadata/Producer - name of generating application /metadata/CreationDate - e.g. D:20080104091746-06'00' /metadata/ModDate - date last modified (usually the same as the CreationDate) /filesystems/<name>/ - any embedded filesystems created by Fuse::PDF /revisions/<num> - look at older versions of annotated PDFs
Create a new filesystem instance. The only required option is the pdf key, like so:
pdf
my $fs = Fuse::PDF::ContentFS->new({pdf => CAM::PDF->new('file.pdf')});
All other options are currently unused, although they are passed to Fuse::PDF::FS instances created for the /filesystem folder.
Return a list of one instance for each revision of the PDF. The first item on the list is this instance (the newest) and the last item on the list is the first revision of the PDF (the oldest). Unedited PDFs (the most common) will return just a one-element list.
If there is an older version of the PDF, extract that and return a new Fuse::PDF::ContentFS instance which applies to that revision. Multiple versions is feature supported by the PDF specification, so this action is consistent with other PDF revision editing tools.
Fuse::PDF::ContentFS
If there are no previous revisions, this will return undef.
undef
Return a hashref with some global information about the filesystem.
Return a human-readable representation of the statistics for each revision of the filesystem.
The following methods are independent of Fuse, but uses almost the exact same API expected by that package (except for fs_setxattr), so they can easily be converted to a FUSE implementation.
These methods exist only to pass parameters through to Fuse::PDF::FS via the /filesystem/* sub-filesystems. See the methods of the same name in that module.
Fuse::PDF
CAM::PDF
Chris Dolan, cdolan@cpan.org
To install Fuse::PDF, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Fuse::PDF
CPAN shell
perl -MCPAN -e shell install Fuse::PDF
For more information on module installation, please visit the detailed CPAN module installation guide.