[Raku PDF Project] / PDF::ISO_32000
The PDF 32000-1:2008 1.7 Specification contains around 380 tables, of which about 280 can be considered data or object definitions.
This module has been used to extract and generate the roles and classes from the PDF specification for use by PDF::Class.
PDF::Class (at last count) implements roles and classes for about 100 of these objects, most of which have been derived and/or checked against the roles generated by this module.
This module contains:
- JSON tables extracted from the above
- generated interface roles for building and validating PDF objects
- scripts and Makefiles for regenerating the XML tables and roles
Data is available for all of the tables in the PDF-32000 1.7 specification:
use PDF::ISO_32000;
# Load data about the Document Information dictionary
my %info = PDF::ISO_32000.table: "Table_317-Entries_in_the_document_information_dictionary";
# -OR- by table number
%info = PDF::ISO_32000.[317];
say %info<caption>; # Table 317 – Entries in the document information dictionary
say %info<head>.join(" | "); # Key | Type | Value
say %info<rows>[0].join(" | "); # Title | text string | (Optional; PDF 1.1) The document’s title.
The table-index
method returns a list that maps table numbers to table names:
say PDF::ISO_32000.table-index[317] # Table 317 - Info_entries
The appendix
method returns a hash index into the Appendix:
my $stream-ops = PDF::ISO_32000.appendix<A.1>;
say $stream-ops, # PDF_content_stream_operators
say PDF::ISO_32000.table($stream-ops)<caption>; # Table A.1 – PDF content stream operators
Roles are available for tables named *_entries
, or *_attributes
.
% p6doc ISO_32000:Table_317-Entries_in_the_document_information_dictionary
% p6doc ISO_32000:Table_28-Entries_in_the_catalog_dictionary
The roles also contain method stubs for the entries that need to be implemented for the role. For example:
% cat << EOF > lib/Catalog.rakumod
use ISO_32000::Table_28-Entries_in_the_catalog_dictionary;
unit class Catalog does ISO_32000::Table_28-Entries_in_the_catalog_dictionary;
EOF
% raku -I . -M Catalog
===SORRY!=== Error while compiling lib/Catalog.rakumod (Catalog)
Method 'SpiderInfo' must be implemented by Catalog because it is required by roles: ISO_32000::Table_28-Entries_in_the_catalog_dictionary.
at lib/Catalog.rakumod (Catalog):1
The companion git repository git@github.com:pdf-raku/PDF-ISO_32000-Builder-raku.git is used to build this module. It will be cloned automatically. Please check this module's META6.json for any missing dependencies.
Note that the META6.json
and README.md
are generated. Any edits
the these files should be made to the sources src/META6.in
and src/README.in
, before building.
To rebuild the roles, resources, README.md and META6.json:
$ make clean
$ make
$ make test
Or to fully rebuild the module type $ make realclean
. This will refetch specification and rebuild the the XML extract gen/PDF-ISO_32000.xml
. This will take some time. At least 2Gb
of available memory is recommended. The wget
utility
and network access are also required.
- This module has been developed on Linux using
GNU Make
The following interface roles have been mined from the ISO-32000 specification