[Raku PDF Project] / PDF::ISO_32000_2
The PDF 32000-2:2020 2.0 Specification contains around 440 tables, of which about 300 can be considered data or object definitions.
This module has been used to extract and generate the roles and classes from the PDF specification.
PDF::Class uses this module plus PDF::ISO_32000, to support both the PDF 32000-1:2008 1.7 and PDF 32000-2:2020 2.0 standards.
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-2 2.0 specification:
use PDF::ISO_32000_2;
# Load data about the Document Information dictionary
my %info = PDF::ISO_32000_2.table: "Table_349-Entries_in_the_document_information_dictionary";
# -OR- by table number
%info = PDF::ISO_32000_2.[349];
say %info<caption>; # Table 349 – 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_2.table-index[349] # Table 349 - Info_entries
The appendix
method returns a hash index into the Appendix:
my $stream-ops = PDF::ISO_32000_2.appendix<A.1>;
say $stream-ops, # PDF_content_stream_operators
say PDF::ISO_32000_2.table($stream-ops)<caption>; # Table A.1 – PDF content stream operators
Roles are available for tables named *_entries
, or *_attributes
.
% p6doc ISO_32000_2:Table_349-Entries_in_the_document_information_dictionary
% p6doc ISO_32000_2: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_2::Table_28-Entries_in_the_catalog_dictionary;
unit class Catalog does ISO_32000_2::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_2::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_2-Builder-raku.git is used to build this module. For copyright reasons, you will need to obtain your own copy of the PDF 2.0 specification. A free personal copy may be obtained by registering at https://pdfa.org/resource/iso-32000-pdf/. Please also check the builder'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
- This module has been developed on Linux using
GNU Make
The following interface roles have been mined from the ISO-32000-2 specification