The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Renard::API::MuPDF::mutool::ObjectParser - Parser for the output of mutool show

VERSION

version 0.006

EXTENDS

ATTRIBUTES

filename

A required File attribute that represents the location of the PDF file.

string

A required Str attribute that represents the raw string output from mutool show.

is_toplevel

An optional Bool attribute that tells whether the data is top-level or not. This influences the parsing by removing the header from the mutool show output.

Default: true

data

A Str containing the parsed data.

type

Contains the type parsed in the data attribute. See "Types" for more information.

CLASS METHODS

unescape_ascii_string

  classmethod unescape_ascii_string((Str) $pdf_string )

A class method that unescapes the escape sequences in a PDF string.

Returns a Str.

decode_hex_utf16be

  classmethod decode_hex_utf16be( (Str) $pdf_string )

A class method that decodes data stored in angle brackets.

Currently only implements Unicode character encoding for what is called a UTF-16BE encoded string with a leading byte order marker using ASCIIHexDecode:

  • first two bytes must be the Unicode byte order marker (U+FEFF),

  • one byte per each pair of hex characters (/[0-9A-F]{2}/))

  • whitespace is ignored

See the following parts of PDF Reference 1.7:

  • Section 3.3.1 ASCIIHexDecode Filter (pg. 69) and

  • Section 3.8.1 Text String Type (pg. 158)

Returns a Str.

METHODS

BUILD

Initialises the object by parsing the input data.

resolve_key

  method resolve_key( (Str) $key )

A method that follows the reference IDs contained in the data for the until a non-reference type is found.

Returns a Renard::API::MuPDF::mutool::ObjectParser instance.

new_from_reference

  method new_from_reference( (InstanceOf['Renard::API::MuPDF::mutool::ObjectParser']) $ref_obj )

Returns an instance of Renard::API::MuPDF::mutool::ObjectParser that follows the reference ID contained inside $ref_obj.

Types

  TypeNull
  TypeString
  TypeStringASCII
  TypeStringUTF16BE
  TypeNumber
  TypeBoolean
  TypeReference
  TypeDictionary
  TypeDate
  TypeArray

The listed types are an enum for the kind of datatypes stored in the type attribute.

AUTHOR

Project Renard

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Project Renard.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.