Scribus
Open source desktop publishing at your fingertips
|
Helper class for reading/writing PDFOptions. More...
#include <pdfoptionsio.h>
Public Member Functions | |
PDFOptionsIO (PDFOptions &opts) | |
simple ctor | |
bool | writeTo (QIODevice &outDevice, bool includePasswords=false) |
Save the PDF settings to a file or other stream. More... | |
bool | writeTo (QString outFileName, bool includePasswords=false) |
bool | readFrom (QIODevice &inStream) |
Load the PDF settings from a file or other data stream, overwriting any current settings. More... | |
bool | readFrom (QString inFileName) |
const QString & | lastError () const |
Return human-readable explanation of last error. More... | |
Protected Attributes | |
QDomDocument | m_doc |
QDomElement | m_root |
PDFOptions * | m_opts |
bool | m_includePasswords |
QString | m_error |
Static Protected Attributes | |
static const int | formatVersion = 1300 |
Helper class for reading/writing PDFOptions.
PDFOptionsIO reads and writes PDFOptions to various formats. Currently only a custom XML format is supported, but support for reading/writing Adobe's .joboptions (for example) might be added in future.
Usage: // Writing: // where `opts' is an existing PDFOptions instance PDFOptionsIO io(opts); if (!io.writeTo("/path/to/file")) qDebug("Failed to save settings: %s", io.lastError.utf8());
// Reading: PDFOptions opts; PDFOptionsIO io(opts); if (!io.readFrom("/path/to/file")) qDebug("Failed to load settings: %s", io.lastError.utf8());
You should generally not keep PDFOptionsIO objects around; just create an instance when you need it.
const QString & PDFOptionsIO::lastError | ( | ) | const |
Return human-readable explanation of last error.
bool PDFOptionsIO::readFrom | ( | QIODevice & | inStream | ) |
Load the PDF settings from a file or other data stream, overwriting any current settings.
inStream | QIODevice to settings data from. |
bool PDFOptionsIO::writeTo | ( | QIODevice & | outDevice, |
bool | includePasswords = false |
||
) |
Save the PDF settings to a file or other stream.
outDevice | QIODevice to write output to. |
includePasswords | true if with passwords |