Ipelib: ipe::PdfParser Class Reference

Ipelib

Public Member Functions | List of all members
ipe::PdfParser Class Reference
Ipe Base

`#include <ipepdfparser.h>`

## Public Member Functions
| PdfParser (DataSource &source)
void | getChar ()
bool | eos () const noexcept
PdfToken | token () const noexcept
void | getToken ()
PdfObj * | getObject (bool lateStream=false)
PdfObj * | getObjectDef (bool lateStream)
PdfDict * | getTrailer ()
void | skipXRef ()
std::vector< int > | readXRef ()

## Detailed Description

PDF parser.

The parser understands the syntax of PDF files, but very little of its semantics. It is meant to be able to parse PDF documents created by Ipe for loading, and to extract information from PDF files created by Pdflatex or Xelatex.

The parser reads a PDF file sequentially from front to back, ignores the contents of 'xref' sections, stores only generation 0 objects, and stops after reading the first 'trailer' section (so it cannot deal with files with incremental updates). It cannot handle stream objects whose /Length entry has been deferred (using an indirect object).

## Constructor & Destructor Documentation

## ◆ PdfParser()

PdfParser::PdfParser | ( | DataSource & | source | ) |

Construct with a data source.

Referenced by ipe::PdfDict::inflate().

## Member Function Documentation

## ◆ getChar()

void ipe::PdfParser::getChar | ( |  | ) |
| inline

Referenced by getTrailer().

## ◆ eos()

bool ipe::PdfParser::eos | ( |  | ) | const
| inlinenoexcept

Referenced by ipe::CairoPainter::executeStream().

## ◆ token()

PdfToken ipe::PdfParser::token | ( |  | ) | const
| inlinenoexcept

Referenced by ipe::CairoPainter::executeStream(), and getTrailer().

## ◆ getToken()

void PdfParser::getToken | ( |  | ) |

Read the next token from the input stream.

References ipe::PdfObj::dict(), ipe::PdfToken::EArrayBg, ipe::PdfToken::EArrayEnd, ipe::PdfToken::EDictBg, ipe::PdfToken::EDictEnd, ipe::PdfToken::EErr, ipe::PdfToken::EFalse, ipe::PdfToken::EName, ipe::PdfToken::ENull, ipe::PdfToken::ENumber, ipe::PdfToken::EOp, ipe::PdfToken::EString, ipe::PdfToken::EStringBinary, ipe::PdfToken::ETrue, ipe::PdfToken::iString, ipe::PdfObj::name(), ipe::PdfObj::number(), ipe::PdfObj::ref(), ipe::Platform::toDouble(), and ipe::PdfNumber::value().

Referenced by ipe::CairoPainter::executeStream(), and getTrailer().

## ◆ getObject()

PdfObj * PdfParser::getObject | ( | bool | lateStream = `false` | ) |

Read one object from input stream.

References ipe::PdfToken::EArrayBg, ipe::PdfToken::EDictBg, ipe::PdfToken::EErr, ipe::PdfToken::EFalse, ipe::PdfToken::EName, ipe::PdfToken::ENull, ipe::PdfToken::ENumber, ipe::PdfToken::EString, ipe::PdfToken::EStringBinary, ipe::PdfToken::ETrue, ipe::PdfToken::iString, ipe::PdfToken::iType, ipe::String::substr(), and ipe::Platform::toDouble().

Referenced by ipe::CairoPainter::executeStream(), and getTrailer().

## ◆ getObjectDef()

PdfObj * PdfParser::getObjectDef | ( | bool | lateStream | ) |

Parse an object definition (current token is object number).

References ipe::PdfObj::dict(), ipe::PdfToken::ENumber, ipe::PdfToken::EOp, and ipe::PdfDict::lateStream().

Referenced by getTrailer().

## ◆ getTrailer()

PdfDict * PdfParser::getTrailer | ( |  | ) |

Parse trailer dictionary (current token is 'trailer')

References ipe::PdfObj::array(), ipe::PdfArray::count(), ipe::Buffer::data(), ipe::PdfDict::dict(), ipe::PdfToken::EDictBg, ipe::PdfToken::ENumber, ipe::PdfToken::EOp, ipe::String::find(), ipe::PdfDict::get(), getChar(), ipe::DataSource::getChar(), ipe::Lex::getInt(), ipe::PdfDict::getInteger(), getObject(), getObjectDef(), getToken(), getTrailer(), ipe::PdfDict::inflate(), ipe::PdfToken::iString, ipe::PdfToken::iType, ipe::PdfDict::lateStream(), ipe::DataSource::length(), ipe::PdfObj::name(), ipe::PdfObj::number(), ipe::PdfArray::obj(), ipe::PdfFile::parse(), readXRef(), ipe::PdfDict::setLateStream(), ipe::DataSource::setPosition(), ipe::BufferSource::setPosition(), ipe::PdfDict::setStream(), ipe::size(), skipXRef(), ipe::String::substr(), token(), ipe::PdfNumber::value(), ipe::PdfName::value(), and ipe::String::z().

Referenced by getTrailer().

## ◆ skipXRef()

void PdfParser::skipXRef | ( |  | ) |

Skip xref table (current token is 'xref')

Referenced by getTrailer().

## ◆ readXRef()

std::vector< int > PdfParser::readXRef | ( |  | ) |

Read xref table (current token is 'xref')

Referenced by getTrailer().

The documentation for this class was generated from the following files:

- ipepdfparser.h
- ipepdfparser.cpp