ipe::PdfWriter Class Reference

`#include <ipepdfwriter.h>`

## Public Member Functions

| PdfWriter (TellStream &stream, const Document *doc, const PdfResources *resources, uint32_t flags, int fromPage, int toPage, int compression)
| ~PdfWriter ()
void | createPages ()
void | createPageView (int page, int view)
void | createBookmarks ()
void | createNamedDests ()
void | createXmlStream (String xmldata, bool preCompressed)
void | createTrailer ()

## Detailed Description

Create PDF file.

This class is responsible for the creation of a PDF file from the Ipe data. You have to create a PdfWriter first, providing a file that has been opened for (binary) writing and is empty. Then call createPages() to embed the pages. Optionally, call `createXmlStream` to embed a stream with the XML representation of the document. Finally, call `createTrailer` to complete the PDF document, and close the file.

Some reserved PDF object numbers:

- 0: Must be left empty (a PDF restriction).
- 1: XML stream.
- 2: Parent of all pages objects.
- 3: ExtGState resource from pdflatex
- 4: Shading resource from pdflatex
- 5: Pattern resource from pdflatex
- 6: ColorSpace resource from pdflatex

## Constructor & Destructor Documentation

## PdfWriter()

PdfWriter::PdfWriter | ( | TellStream & | stream,
|  | const Document * | doc,
|  | const PdfResources * | resources,
|  | uint32_t | flags,
|  | int | fromPage,
|  | int | toPage,
|  | int | compression )

Create a PDF writer operating on this (open and empty) file.

References ipe::Object::accept(), ipe::Cascade::allNames(), ipe::BBoxPainter::bbox(), ipe::Document::cascade(), ipe::Document::countPages(), ipe::String::data(), ipe::Object::draw(), ipe::Gradient::EAxial, ipe::EGradient, ipe::EOpacity, ipe::ESymbol, ipe::ETiling, ipe::Cascade::find(), ipe::Document::findBitmaps(), ipe::Cascade::findGradient(), ipe::Cascade::findSymbol(), ipe::Cascade::findTiling(), ipe::Tiling::iAngle, ipe::BitmapFinder::iBitmaps, ipe::Gradient::iExtend, ipe::Symbol::iObject, ipe::Gradient::iRadius, ipe::Attribute::isNumber(), ipe::Tiling::iStep, ipe::Gradient::iStops, ipe::Gradient::iType, ipe::Gradient::iV, ipe::Tiling::iWidth, ipe::Symbol::iXForm, ipe::Attribute::number(), ipe::String::size(), and ipe::size().

## ~PdfWriter()

PdfWriter::~PdfWriter | ( |  | ) |

Destructor.

## Member Function Documentation

## createPages()

void PdfWriter::createPages | ( |  | ) |

Create all PDF pages.

References ipe::Page::countViews(), createPageView(), ipe::Page::marked(), ipe::SaveFlag::MarkedView, ipe::Page::markedView(), and ipe::Document::page().

Referenced by ipe::Document::exportPages(), and ipe::Document::save().

## createPageView()

void PdfWriter::createPageView | ( | int | page,
|  | int | view )

create contents and page stream for this page view.

References ipe::Object::accept(), ipe::Object::asGroup(), ipe::Attribute::BACKGROUND(), ipe::Page::bbox(), ipe::Document::cascade(), ipe::DeflateStream::close(), ipe::Page::count(), ipe::String::data(), ipe::Page::effect(), ipe::String::empty(), ipe::SaveFlag::Export, ipe::Cascade::findEffect(), ipe::Page::findLayer(), ipe::Cascade::findLayout(), ipe::Cascade::findSymbol(), ipe::Layout::iCrop, ipe::Symbol::iObject, ipe::Rect::isEmpty(), ipe::Attribute::isNormal(), ipe::SaveFlag::KeepNotes, ipe::String::left(), ipe::Page::notes(), ipe::Page::object(), ipe::Page::objectVisible(), ipe::Document::page(), ipe::Page::pageBBox(), ipe::Effect::pageDictionary(), ipe::Layout::paper(), ipe::BitmapFinder::scanPage(), ipe::String::size(), ipe::String::substr(), ipe::Group::url(), ipe::Page::viewBBox(), and ipe::Page::visible().

Referenced by createPages(), and ipe::Document::exportView().

## createBookmarks()

void PdfWriter::createBookmarks | ( |  | ) |

Create the bookmarks (PDF outline).

References ipe::String::empty(), ipe::Page::findLayer(), ipe::Page::marked(), ipe::SaveFlag::MarkedView, ipe::Document::page(), ipe::Page::section(), and ipe::size().

Referenced by ipe::Document::save().

## createNamedDests()

void PdfWriter::createNamedDests | ( |  | ) |

Create the named destinations.

References ipe::String::empty(), ipe::Page::findLayer(), ipe::Page::marked(), ipe::SaveFlag::MarkedView, ipe::Document::page(), and ipe::Page::section().

Referenced by ipe::Document::save().

## createXmlStream()

void PdfWriter::createXmlStream | ( | String | xmldata,
|  | bool | preCompressed )

Create a stream containing the XML data.

References ipe::String::data(), and ipe::String::size().

Referenced by ipe::Document::save().

## createTrailer()

void PdfWriter::createTrailer | ( |  | ) |

Create the root objects and trailer of the PDF file.

References ipe::Page::countMarkedViews(), ipe::Document::countPages(), ipe::Document::countTotalViews(), ipe::Page::countViews(), ipe::String::empty(), ipe::Document::SProperties::iAuthor, ipe::Document::SProperties::iCreated, ipe::Document::SProperties::iCreator, ipe::Document::SProperties::iFullScreen, ipe::Document::SProperties::iKeywords, ipe::Document::SProperties::iModified, ipe::Document::SProperties::iSubject, ipe::Document::SProperties::iTitle, ipe::Page::marked(), ipe::SaveFlag::MarkedView, ipe::Document::page(), ipe::Document::properties(), and ipe::TellStream::tell().

Referenced by ipe::Document::exportPages(), ipe::Document::exportView(), and ipe::Document::save().

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

- ipepdfwriter.h
- ipepdfwriter.cpp