PoDoFo 0.9.20
|
#include <PdfStreamedDocument.h>
Public Member Functions | |
PdfStreamedDocument (const std::shared_ptr< OutputStreamDevice > &device, PdfVersion version=PdfVersionDefault, PdfEncrypt *encrypt=nullptr, PdfSaveOptions opts=PdfSaveOptions::None) | |
PdfStreamedDocument (const std::string_view &filename, PdfVersion version=PdfVersionDefault, PdfEncrypt *encrypt=nullptr, PdfSaveOptions opts=PdfSaveOptions::None) | |
void | Close () |
![]() | |
virtual | ~PdfDocument () |
PdfOutlines & | GetOrCreateOutlines () |
PdfNameTree & | GetOrCreateNameTree () |
PdfAcroForm & | GetOrCreateAcroForm (PdfAcroFormDefaulAppearance eDefaultAppearance=PdfAcroFormDefaulAppearance::BlackText12pt) |
void | AttachFile (const PdfFileSpec &fileSpec) |
PdfFileSpec * | GetAttachment (const PdfString &name) |
void | AddNamedDestination (const PdfDestination &dest, const PdfString &name) |
std::unique_ptr< PdfImage > | CreateImage (const std::string_view &prefix={ }) |
bool | IsPrintAllowed () const |
bool | IsEditAllowed () const |
bool | IsCopyAllowed () const |
bool | IsEditNotesAllowed () const |
bool | IsFillAndSignAllowed () const |
bool | IsAccessibilityAllowed () const |
bool | IsDocAssemblyAllowed () const |
bool | IsHighPrintAllowed () const |
bool | IsEncrypted () const |
PdfCatalog & | GetCatalog () |
const PdfCatalog & | GetCatalog () const |
PdfPageCollection & | GetPages () |
const PdfPageCollection & | GetPages () const |
PdfTrailer & | GetTrailer () |
const PdfTrailer & | GetTrailer () const |
const PdfInfo * | GetInfo () const |
PdfIndirectObjectList & | GetObjects () |
const PdfIndirectObjectList & | GetObjects () const |
Protected Member Functions | |
PdfVersion | GetPdfVersion () const override |
void | SetPdfVersion (PdfVersion version) override |
![]() | |
PdfDocument (bool empty=false) | |
void | SetTrailer (std::unique_ptr< PdfObject > obj) |
void | Init () |
void | Clear () |
PdfStreamedDocument is the preferred class for creating new PDF documents.
Page contents, fonts and images are written to disk as soon as possible and are not kept in memory. This results in faster document generation and less memory being used.
Please use PdfMemDocument if you intend to work on the object structure of a PDF file.
One of the design goals of PdfStreamedDocument was to hide the underlying object structure of a PDF file as far as possible.
Example of using PdfStreamedDocument:
PdfStreamedDocument document; document.Load("outputfile.pdf"); PdfPage& page = document.GetPages().CreatePage(PdfPage::CreateStandardPageSize(PdfPageSize::A4)); PdfFont* font = document.GetFonts().SearchFont("Arial");
PdfPainter painter; painter.SetCanvas(page); painter.TextState.SetFont(*font, 18); painter.DrawText("Hello World!", 56.69, page.GetRect().Height - 56.69); painter.FinishDrawing();
PdfStreamedDocument::PdfStreamedDocument | ( | const std::shared_ptr< OutputStreamDevice > & | device, |
PdfVersion | version = PdfVersionDefault, | ||
PdfEncrypt * | encrypt = nullptr, | ||
PdfSaveOptions | opts = PdfSaveOptions::None ) |
Create a new PdfStreamedDocument. All data is written to an output device immediately.
device | an output device |
version | the PDF version of the document to write. The PDF version can only be set in the constructor as it is the first item written to the document on disk. |
encrypt | pointer to an encryption object or nullptr. If not nullptr the PdfEncrypt object will be copied and used to encrypt the created document. |
opts | additional save options for writing the pdf |
PoDoFo::PdfStreamedDocument::PdfStreamedDocument | ( | const std::string_view & | filename, |
PdfVersion | version = PdfVersionDefault, | ||
PdfEncrypt * | encrypt = nullptr, | ||
PdfSaveOptions | opts = PdfSaveOptions::None ) |
Create a new PdfStreamedDocument. All data is written to a file immediately.
filename | resulting PDF file |
version | the PDF version of the document to write. The PDF version can only be set in the constructor as it is the first item written to the document on disk. |
encrypt | pointer to an encryption object or nullptr. If not nullptr the PdfEncrypt object will be copied and used to encrypt the created document. |
opts | additional options for writing the pdf |
void PdfStreamedDocument::Close | ( | ) |
Close the document. The PDF file on disk is finished. No other member function of this class may be called after calling this function.
|
overrideprotectedvirtual |
Get the PDF version of the document
Implements PoDoFo::PdfDocument.
|
overrideprotectedvirtual |
Get the PDF version of the document
Implements PoDoFo::PdfDocument.