Commit c9cb6353 authored by Pino Toscano's avatar Pino Toscano
Browse files

[cpp] add function to query for document "permissions"

parent 30e90c7c
......@@ -271,6 +271,29 @@ bool document::is_linearized() const
return d->doc->isLinearized();
bool document::has_permission(permission_enum which) const
switch (which) {
case perm_print:
return d->doc->okToPrint();
case perm_change:
return d->doc->okToChange();
case perm_copy:
return d->doc->okToCopy();
case perm_add_notes:
return d->doc->okToAddNotes();
case perm_fill_forms:
return d->doc->okToFillForm();
case perm_accessibility:
return d->doc->okToAccessibility();
case perm_assemble:
return d->doc->okToAssemble();
case perm_print_high_resolution:
return d->doc->okToPrintHighRes();
return true;
int document::pages() const
return d->doc->getNumPages();
......@@ -65,6 +65,7 @@ public:
unsigned int /*time_t*/ info_date(const std::string &key) const;
bool is_encrypted() const;
bool is_linearized() const;
bool has_permission(permission_enum which) const;
int pages() const;
page* create_page(const ustring &label) const;
......@@ -60,6 +60,10 @@ enum rotation_enum { rotate_0, rotate_90, rotate_180, rotate_270 };
enum page_box_enum { media_box, crop_box, bleed_box, trim_box, art_box };
enum permission_enum { perm_print, perm_change, perm_copy, perm_add_notes,
perm_fill_forms, perm_accessibility, perm_assemble,
perm_print_high_resolution };
typedef std::vector<char> byte_array;
class POPPLER_CPP_EXPORT ustring : public std::basic_string<unsigned short>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment