Source code for apryse_sdk

# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.1
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.

from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
    raise RuntimeError("Python 2.7 or later required")

# Import the low-level C/C++ module
if __package__ or "." in __name__:
    from . import _PDFNetPython
else:
    import _PDFNetPython

try:
    import builtins as __builtin__
except ImportError:
    import __builtin__

def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except __builtin__.Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)


def _swig_setattr_nondynamic_instance_variable(set):
    def set_instance_attr(self, name, value):
        if name == "thisown":
            self.this.own(value)
        elif name == "this":
            set(self, name, value)
        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
            set(self, name, value)
        else:
            raise AttributeError("You cannot add instance attributes to %s" % self)
    return set_instance_attr


def _swig_setattr_nondynamic_class_variable(set):
    def set_class_attr(cls, name, value):
        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
            set(cls, name, value)
        else:
            raise AttributeError("You cannot add class attributes to %s" % cls)
    return set_class_attr


def _swig_add_metaclass(metaclass):
    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
    def wrapper(cls):
        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
    return wrapper


class _SwigNonDynamicMeta(type):
    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)


import weakref

[docs] class SwigPyIterator(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") def __init__(self, args, kwargs): raise AttributeError("Noructor defined - class is abstract") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_SwigPyIterator
[docs] def value(self): return _PDFNetPython.SwigPyIterator_value(self)
[docs] def incr(self, n=1): return _PDFNetPython.SwigPyIterator_incr(self, n)
[docs] def decr(self, n=1): return _PDFNetPython.SwigPyIterator_decr(self, n)
[docs] def distance(self, x): return _PDFNetPython.SwigPyIterator_distance(self, x)
[docs] def equal(self, x): return _PDFNetPython.SwigPyIterator_equal(self, x)
[docs] def copy(self): return _PDFNetPython.SwigPyIterator_copy(self)
[docs] def next(self): return _PDFNetPython.SwigPyIterator_next(self)
def __next__(self): return _PDFNetPython.SwigPyIterator___next__(self)
[docs] def previous(self): return _PDFNetPython.SwigPyIterator_previous(self)
[docs] def advance(self, n): return _PDFNetPython.SwigPyIterator_advance(self, n)
def __eq__(self, x): return _PDFNetPython.SwigPyIterator___eq__(self, x) def __ne__(self, x): return _PDFNetPython.SwigPyIterator___ne__(self, x) def __iadd__(self, n): return _PDFNetPython.SwigPyIterator___iadd__(self, n) def __isub__(self, n): return _PDFNetPython.SwigPyIterator___isub__(self, n) def __add__(self, n): return _PDFNetPython.SwigPyIterator___add__(self, n) def __sub__(self, args): return _PDFNetPython.SwigPyIterator___sub__(self, args) def __iter__(self): return self
# Register SwigPyIterator in _PDFNetPython: _PDFNetPython.SwigPyIterator_swigregister(SwigPyIterator)
[docs] class VectorDouble(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorDouble_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorDouble___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorDouble___bool__(self) def __len__(self): return _PDFNetPython.VectorDouble___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorDouble___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorDouble___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorDouble___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorDouble___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorDouble___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorDouble___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorDouble_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorDouble_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorDouble_empty(self)
[docs] def size(self): return _PDFNetPython.VectorDouble_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorDouble_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorDouble_begin(self)
[docs] def end(self): return _PDFNetPython.VectorDouble_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorDouble_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorDouble_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorDouble_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorDouble_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorDouble_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorDouble_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorDouble_swiginit(self, _PDFNetPython.new_VectorDouble(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorDouble_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorDouble_front(self)
[docs] def back(self): return _PDFNetPython.VectorDouble_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorDouble_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorDouble_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorDouble_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorDouble_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorDouble_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorDouble
# Register VectorDouble in _PDFNetPython: _PDFNetPython.VectorDouble_swigregister(VectorDouble)
[docs] class VectorObj(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorObj_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorObj___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorObj___bool__(self) def __len__(self): return _PDFNetPython.VectorObj___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorObj___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorObj___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorObj___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorObj___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorObj___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorObj___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorObj_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorObj_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorObj_empty(self)
[docs] def size(self): return _PDFNetPython.VectorObj_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorObj_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorObj_begin(self)
[docs] def end(self): return _PDFNetPython.VectorObj_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorObj_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorObj_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorObj_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorObj_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorObj_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorObj_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorObj_swiginit(self, _PDFNetPython.new_VectorObj(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorObj_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorObj_front(self)
[docs] def back(self): return _PDFNetPython.VectorObj_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorObj_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorObj_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorObj_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorObj_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorObj_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorObj
# Register VectorObj in _PDFNetPython: _PDFNetPython.VectorObj_swigregister(VectorObj)
[docs] class VectorPage(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorPage_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorPage___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorPage___bool__(self) def __len__(self): return _PDFNetPython.VectorPage___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorPage___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorPage___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorPage___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorPage___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorPage___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorPage___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorPage_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorPage_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorPage_empty(self)
[docs] def size(self): return _PDFNetPython.VectorPage_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorPage_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorPage_begin(self)
[docs] def end(self): return _PDFNetPython.VectorPage_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorPage_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorPage_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorPage_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorPage_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorPage_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorPage_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorPage_swiginit(self, _PDFNetPython.new_VectorPage(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorPage_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorPage_front(self)
[docs] def back(self): return _PDFNetPython.VectorPage_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorPage_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorPage_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorPage_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorPage_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorPage_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorPage
# Register VectorPage in _PDFNetPython: _PDFNetPython.VectorPage_swigregister(VectorPage)
[docs] class VectorUChar(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorUChar_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorUChar___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorUChar___bool__(self) def __len__(self): return _PDFNetPython.VectorUChar___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorUChar___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorUChar___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorUChar___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorUChar___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorUChar___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorUChar___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorUChar_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorUChar_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorUChar_empty(self)
[docs] def size(self): return _PDFNetPython.VectorUChar_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorUChar_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorUChar_begin(self)
[docs] def end(self): return _PDFNetPython.VectorUChar_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorUChar_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorUChar_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorUChar_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorUChar_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorUChar_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorUChar_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorUChar_swiginit(self, _PDFNetPython.new_VectorUChar(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorUChar_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorUChar_front(self)
[docs] def back(self): return _PDFNetPython.VectorUChar_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorUChar_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorUChar_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorUChar_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorUChar_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorUChar_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorUChar
# Register VectorUChar in _PDFNetPython: _PDFNetPython.VectorUChar_swigregister(VectorUChar)
[docs] class VectorChar(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorChar_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorChar___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorChar___bool__(self) def __len__(self): return _PDFNetPython.VectorChar___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorChar___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorChar___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorChar___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorChar___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorChar___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorChar___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorChar_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorChar_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorChar_empty(self)
[docs] def size(self): return _PDFNetPython.VectorChar_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorChar_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorChar_begin(self)
[docs] def end(self): return _PDFNetPython.VectorChar_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorChar_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorChar_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorChar_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorChar_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorChar_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorChar_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorChar_swiginit(self, _PDFNetPython.new_VectorChar(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorChar_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorChar_front(self)
[docs] def back(self): return _PDFNetPython.VectorChar_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorChar_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorChar_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorChar_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorChar_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorChar_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorChar
# Register VectorChar in _PDFNetPython: _PDFNetPython.VectorChar_swigregister(VectorChar)
[docs] class VectorInt(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorInt_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorInt___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorInt___bool__(self) def __len__(self): return _PDFNetPython.VectorInt___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorInt___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorInt___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorInt___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorInt___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorInt___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorInt___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorInt_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorInt_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorInt_empty(self)
[docs] def size(self): return _PDFNetPython.VectorInt_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorInt_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorInt_begin(self)
[docs] def end(self): return _PDFNetPython.VectorInt_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorInt_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorInt_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorInt_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorInt_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorInt_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorInt_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorInt_swiginit(self, _PDFNetPython.new_VectorInt(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorInt_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorInt_front(self)
[docs] def back(self): return _PDFNetPython.VectorInt_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorInt_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorInt_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorInt_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorInt_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorInt_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorInt
# Register VectorInt in _PDFNetPython: _PDFNetPython.VectorInt_swigregister(VectorInt)
[docs] class VectorString(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorString_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorString___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorString___bool__(self) def __len__(self): return _PDFNetPython.VectorString___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorString___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorString___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorString___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorString___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorString___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorString___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorString_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorString_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorString_empty(self)
[docs] def size(self): return _PDFNetPython.VectorString_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorString_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorString_begin(self)
[docs] def end(self): return _PDFNetPython.VectorString_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorString_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorString_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorString_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorString_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorString_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorString_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorString_swiginit(self, _PDFNetPython.new_VectorString(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorString_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorString_front(self)
[docs] def back(self): return _PDFNetPython.VectorString_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorString_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorString_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorString_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorString_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorString_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorString
# Register VectorString in _PDFNetPython: _PDFNetPython.VectorString_swigregister(VectorString)
[docs] class VectorRedaction(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorRedaction_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorRedaction___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorRedaction___bool__(self) def __len__(self): return _PDFNetPython.VectorRedaction___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorRedaction___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorRedaction___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorRedaction___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorRedaction___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorRedaction___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorRedaction___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorRedaction_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorRedaction_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorRedaction_empty(self)
[docs] def size(self): return _PDFNetPython.VectorRedaction_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorRedaction_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorRedaction_begin(self)
[docs] def end(self): return _PDFNetPython.VectorRedaction_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorRedaction_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorRedaction_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorRedaction_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorRedaction_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorRedaction_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorRedaction_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorRedaction_swiginit(self, _PDFNetPython.new_VectorRedaction(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorRedaction_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorRedaction_front(self)
[docs] def back(self): return _PDFNetPython.VectorRedaction_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorRedaction_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorRedaction_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorRedaction_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorRedaction_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorRedaction_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorRedaction
# Register VectorRedaction in _PDFNetPython: _PDFNetPython.VectorRedaction_swigregister(VectorRedaction)
[docs] class VectorQuadPoint(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorQuadPoint_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorQuadPoint___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorQuadPoint___bool__(self) def __len__(self): return _PDFNetPython.VectorQuadPoint___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorQuadPoint___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorQuadPoint___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorQuadPoint___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorQuadPoint___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorQuadPoint___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorQuadPoint___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorQuadPoint_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorQuadPoint_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorQuadPoint_empty(self)
[docs] def size(self): return _PDFNetPython.VectorQuadPoint_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorQuadPoint_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorQuadPoint_begin(self)
[docs] def end(self): return _PDFNetPython.VectorQuadPoint_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorQuadPoint_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorQuadPoint_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorQuadPoint_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorQuadPoint_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorQuadPoint_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorQuadPoint_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorQuadPoint_swiginit(self, _PDFNetPython.new_VectorQuadPoint(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorQuadPoint_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorQuadPoint_front(self)
[docs] def back(self): return _PDFNetPython.VectorQuadPoint_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorQuadPoint_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorQuadPoint_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorQuadPoint_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorQuadPoint_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorQuadPoint_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorQuadPoint
# Register VectorQuadPoint in _PDFNetPython: _PDFNetPython.VectorQuadPoint_swigregister(VectorQuadPoint)
[docs] class VectorSeparation(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorSeparation_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorSeparation___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorSeparation___bool__(self) def __len__(self): return _PDFNetPython.VectorSeparation___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorSeparation___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorSeparation___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorSeparation___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorSeparation___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorSeparation___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorSeparation___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorSeparation_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorSeparation_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorSeparation_empty(self)
[docs] def size(self): return _PDFNetPython.VectorSeparation_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorSeparation_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorSeparation_begin(self)
[docs] def end(self): return _PDFNetPython.VectorSeparation_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorSeparation_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorSeparation_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorSeparation_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorSeparation_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorSeparation_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorSeparation_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorSeparation_swiginit(self, _PDFNetPython.new_VectorSeparation(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorSeparation_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorSeparation_front(self)
[docs] def back(self): return _PDFNetPython.VectorSeparation_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorSeparation_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorSeparation_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorSeparation_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorSeparation_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorSeparation_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorSeparation
# Register VectorSeparation in _PDFNetPython: _PDFNetPython.VectorSeparation_swigregister(VectorSeparation)
[docs] class VectorDisallowedChange(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorDisallowedChange_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorDisallowedChange___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorDisallowedChange___bool__(self) def __len__(self): return _PDFNetPython.VectorDisallowedChange___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorDisallowedChange___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorDisallowedChange___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorDisallowedChange___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorDisallowedChange___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorDisallowedChange___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorDisallowedChange___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorDisallowedChange_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorDisallowedChange_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorDisallowedChange_empty(self)
[docs] def size(self): return _PDFNetPython.VectorDisallowedChange_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorDisallowedChange_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorDisallowedChange_begin(self)
[docs] def end(self): return _PDFNetPython.VectorDisallowedChange_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorDisallowedChange_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorDisallowedChange_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorDisallowedChange_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorDisallowedChange_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorDisallowedChange_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorDisallowedChange_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorDisallowedChange_swiginit(self, _PDFNetPython.new_VectorDisallowedChange(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorDisallowedChange_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorDisallowedChange_front(self)
[docs] def back(self): return _PDFNetPython.VectorDisallowedChange_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorDisallowedChange_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorDisallowedChange_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorDisallowedChange_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorDisallowedChange_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorDisallowedChange_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorDisallowedChange
# Register VectorDisallowedChange in _PDFNetPython: _PDFNetPython.VectorDisallowedChange_swigregister(VectorDisallowedChange)
[docs] class VectorAnnot(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorAnnot_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorAnnot___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorAnnot___bool__(self) def __len__(self): return _PDFNetPython.VectorAnnot___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorAnnot___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorAnnot___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorAnnot___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorAnnot___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorAnnot___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorAnnot___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorAnnot_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorAnnot_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorAnnot_empty(self)
[docs] def size(self): return _PDFNetPython.VectorAnnot_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorAnnot_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorAnnot_begin(self)
[docs] def end(self): return _PDFNetPython.VectorAnnot_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorAnnot_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorAnnot_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorAnnot_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorAnnot_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorAnnot_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorAnnot_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorAnnot_swiginit(self, _PDFNetPython.new_VectorAnnot(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorAnnot_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorAnnot_front(self)
[docs] def back(self): return _PDFNetPython.VectorAnnot_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorAnnot_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorAnnot_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorAnnot_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorAnnot_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorAnnot_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorAnnot
# Register VectorAnnot in _PDFNetPython: _PDFNetPython.VectorAnnot_swigregister(VectorAnnot)
[docs] class VectorX509Extension(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorX509Extension_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorX509Extension___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorX509Extension___bool__(self) def __len__(self): return _PDFNetPython.VectorX509Extension___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorX509Extension___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorX509Extension___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorX509Extension___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorX509Extension___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorX509Extension___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorX509Extension___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorX509Extension_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorX509Extension_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorX509Extension_empty(self)
[docs] def size(self): return _PDFNetPython.VectorX509Extension_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorX509Extension_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorX509Extension_begin(self)
[docs] def end(self): return _PDFNetPython.VectorX509Extension_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorX509Extension_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorX509Extension_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorX509Extension_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorX509Extension_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorX509Extension_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorX509Extension_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorX509Extension_swiginit(self, _PDFNetPython.new_VectorX509Extension(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorX509Extension_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorX509Extension_front(self)
[docs] def back(self): return _PDFNetPython.VectorX509Extension_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorX509Extension_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorX509Extension_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorX509Extension_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorX509Extension_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorX509Extension_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorX509Extension
# Register VectorX509Extension in _PDFNetPython: _PDFNetPython.VectorX509Extension_swigregister(VectorX509Extension)
[docs] class VectorX509Certificate(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorX509Certificate_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorX509Certificate___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorX509Certificate___bool__(self) def __len__(self): return _PDFNetPython.VectorX509Certificate___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorX509Certificate___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorX509Certificate___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorX509Certificate___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorX509Certificate___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorX509Certificate___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorX509Certificate___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorX509Certificate_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorX509Certificate_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorX509Certificate_empty(self)
[docs] def size(self): return _PDFNetPython.VectorX509Certificate_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorX509Certificate_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorX509Certificate_begin(self)
[docs] def end(self): return _PDFNetPython.VectorX509Certificate_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorX509Certificate_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorX509Certificate_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorX509Certificate_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorX509Certificate_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorX509Certificate_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorX509Certificate_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorX509Certificate_swiginit(self, _PDFNetPython.new_VectorX509Certificate(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorX509Certificate_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorX509Certificate_front(self)
[docs] def back(self): return _PDFNetPython.VectorX509Certificate_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorX509Certificate_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorX509Certificate_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorX509Certificate_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorX509Certificate_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorX509Certificate_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorX509Certificate
# Register VectorX509Certificate in _PDFNetPython: _PDFNetPython.VectorX509Certificate_swigregister(VectorX509Certificate)
[docs] class VectorX501AttributeTypeAndValue(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorX501AttributeTypeAndValue___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorX501AttributeTypeAndValue___bool__(self) def __len__(self): return _PDFNetPython.VectorX501AttributeTypeAndValue___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorX501AttributeTypeAndValue___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorX501AttributeTypeAndValue___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorX501AttributeTypeAndValue___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorX501AttributeTypeAndValue___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorX501AttributeTypeAndValue___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorX501AttributeTypeAndValue___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorX501AttributeTypeAndValue_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_empty(self)
[docs] def size(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorX501AttributeTypeAndValue_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_begin(self)
[docs] def end(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorX501AttributeTypeAndValue_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorX501AttributeTypeAndValue_swiginit(self, _PDFNetPython.new_VectorX501AttributeTypeAndValue(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorX501AttributeTypeAndValue_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_front(self)
[docs] def back(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorX501AttributeTypeAndValue_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorX501AttributeTypeAndValue_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorX501AttributeTypeAndValue_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorX501AttributeTypeAndValue_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorX501AttributeTypeAndValue_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorX501AttributeTypeAndValue
# Register VectorX501AttributeTypeAndValue in _PDFNetPython: _PDFNetPython.VectorX501AttributeTypeAndValue_swigregister(VectorX501AttributeTypeAndValue)
[docs] class VectorByteRange(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorByteRange_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorByteRange___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorByteRange___bool__(self) def __len__(self): return _PDFNetPython.VectorByteRange___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorByteRange___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorByteRange___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorByteRange___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorByteRange___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorByteRange___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorByteRange___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorByteRange_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorByteRange_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorByteRange_empty(self)
[docs] def size(self): return _PDFNetPython.VectorByteRange_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorByteRange_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorByteRange_begin(self)
[docs] def end(self): return _PDFNetPython.VectorByteRange_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorByteRange_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorByteRange_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorByteRange_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorByteRange_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorByteRange_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorByteRange_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorByteRange_swiginit(self, _PDFNetPython.new_VectorByteRange(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorByteRange_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorByteRange_front(self)
[docs] def back(self): return _PDFNetPython.VectorByteRange_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorByteRange_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorByteRange_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorByteRange_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorByteRange_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorByteRange_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorByteRange
# Register VectorByteRange in _PDFNetPython: _PDFNetPython.VectorByteRange_swigregister(VectorByteRange)
[docs] class VectorVectorX509Certificate(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def iterator(self): return _PDFNetPython.VectorVectorX509Certificate_iterator(self)
def __iter__(self): return self.iterator() def __nonzero__(self): return _PDFNetPython.VectorVectorX509Certificate___nonzero__(self) def __bool__(self): return _PDFNetPython.VectorVectorX509Certificate___bool__(self) def __len__(self): return _PDFNetPython.VectorVectorX509Certificate___len__(self) def __getslice__(self, i, j): return _PDFNetPython.VectorVectorX509Certificate___getslice__(self, i, j) def __setslice__(self, args): return _PDFNetPython.VectorVectorX509Certificate___setslice__(self, args) def __delslice__(self, i, j): return _PDFNetPython.VectorVectorX509Certificate___delslice__(self, i, j) def __delitem__(self, args): return _PDFNetPython.VectorVectorX509Certificate___delitem__(self, args) def __getitem__(self, args): return _PDFNetPython.VectorVectorX509Certificate___getitem__(self, args) def __setitem__(self, args): return _PDFNetPython.VectorVectorX509Certificate___setitem__(self, args)
[docs] def pop(self): return _PDFNetPython.VectorVectorX509Certificate_pop(self)
[docs] def append(self, x): return _PDFNetPython.VectorVectorX509Certificate_append(self, x)
[docs] def empty(self): return _PDFNetPython.VectorVectorX509Certificate_empty(self)
[docs] def size(self): return _PDFNetPython.VectorVectorX509Certificate_size(self)
[docs] def swap(self, v): return _PDFNetPython.VectorVectorX509Certificate_swap(self, v)
[docs] def begin(self): return _PDFNetPython.VectorVectorX509Certificate_begin(self)
[docs] def end(self): return _PDFNetPython.VectorVectorX509Certificate_end(self)
[docs] def rbegin(self): return _PDFNetPython.VectorVectorX509Certificate_rbegin(self)
[docs] def rend(self): return _PDFNetPython.VectorVectorX509Certificate_rend(self)
[docs] def clear(self): return _PDFNetPython.VectorVectorX509Certificate_clear(self)
[docs] def get_allocator(self): return _PDFNetPython.VectorVectorX509Certificate_get_allocator(self)
[docs] def pop_back(self): return _PDFNetPython.VectorVectorX509Certificate_pop_back(self)
[docs] def erase(self, args): return _PDFNetPython.VectorVectorX509Certificate_erase(self, args)
def __init__(self, args): _PDFNetPython.VectorVectorX509Certificate_swiginit(self, _PDFNetPython.new_VectorVectorX509Certificate(args))
[docs] def push_back(self, x): return _PDFNetPython.VectorVectorX509Certificate_push_back(self, x)
[docs] def front(self): return _PDFNetPython.VectorVectorX509Certificate_front(self)
[docs] def back(self): return _PDFNetPython.VectorVectorX509Certificate_back(self)
[docs] def assign(self, n, x): return _PDFNetPython.VectorVectorX509Certificate_assign(self, n, x)
[docs] def resize(self, args): return _PDFNetPython.VectorVectorX509Certificate_resize(self, args)
[docs] def insert(self, args): return _PDFNetPython.VectorVectorX509Certificate_insert(self, args)
[docs] def reserve(self, n): return _PDFNetPython.VectorVectorX509Certificate_reserve(self, n)
[docs] def capacity(self): return _PDFNetPython.VectorVectorX509Certificate_capacity(self)
__swig_destroy__ = _PDFNetPython.delete_VectorVectorX509Certificate
# Register VectorVectorX509Certificate in _PDFNetPython: _PDFNetPython.VectorVectorX509Certificate_swigregister(VectorVectorX509Certificate)
[docs] class Selection(object): r"""A class representing the current text selection.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def GetPageNum(self): r""" :rtype: int :return: the page number containing the selected text. """ return _PDFNetPython.Selection_GetPageNum(self)
[docs] def GetQuads(self): r""" Returns the list of tight bounding quads in the current text selection. :param quads: - Sets a pointer to an array of vertices representing a list of bounding quads for the selected text. Each bounding quad is represented using 8 numbers in an array of doubles. Each two consecutive values represent the x and y coordinates of a quad vertex and the four vertices are arranged counter-clockwisely, 3--------2 | | | | | | 0--------1 e.g., (quad[0], quad[1]) is the coordinate of vertex 0, and (quad[4], quad[5]) is the coordinate of vertex 2. Note that it is only ensured that the four vertices are arranged sequentially; it is possible in practice that (quad[0], quad[1]) is the coordinate of any vertex. :rtype: std::vector< QuadPoint,std::allocator< PDF::QuadPoint > > :return: the number of quads in 'quads' array. Notes: the 'quads' array is owned by the current selection and does not need to be explicitly released. """ return _PDFNetPython.Selection_GetQuads(self)
[docs] def GetAsUnicode(self): r""" :rtype: string :return: the current text selection represented as an Unicode string. """ return _PDFNetPython.Selection_GetAsUnicode(self)
[docs] def GetAsHtml(self): r""" :rtype: string :return: the current text selection in HTML format. HTML text will contain styling information such as text color, font size, style etc. Notes: this function can be used to implement clipboard copy and paste that preserves text formating. """ return _PDFNetPython.Selection_GetAsHtml(self)
__swig_destroy__ = _PDFNetPython.delete_Selection def __init__(self, args): _PDFNetPython.Selection_swiginit(self, _PDFNetPython.new_Selection(args))
# Register Selection in _PDFNetPython: _PDFNetPython.Selection_swigregister(Selection)
[docs] class Callback(object): r""" SWIG director's base class Contains virtual functions which match the signature of the PDFNet function pointers. Each virtual function has a matching static function calling it. User extends this class in the target language and overrides the function of interest. The static function is assigned to the function pointer. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): if self.__class__ == Callback: _self = None else: _self = self _PDFNetPython.Callback_swiginit(self, _PDFNetPython.new_Callback(_self, )) __swig_destroy__ = _PDFNetPython.delete_Callback
[docs] def RenderBeginEventProc(self): return _PDFNetPython.Callback_RenderBeginEventProc(self)
[docs] @staticmethod def StaticRenderBeginEventProc(data): return _PDFNetPython.Callback_StaticRenderBeginEventProc(data)
[docs] def RenderFinishEventProc(self, cancelled): return _PDFNetPython.Callback_RenderFinishEventProc(self, cancelled)
[docs] @staticmethod def StaticRenderFinishEventProc(data, cancelled): return _PDFNetPython.Callback_StaticRenderFinishEventProc(data, cancelled)
[docs] def ErrorReportProc(self, message): return _PDFNetPython.Callback_ErrorReportProc(self, message)
[docs] @staticmethod def StaticErrorReportProc(message, data): return _PDFNetPython.Callback_StaticErrorReportProc(message, data)
[docs] def CurrentPageProc(self, current_page, num_pages): return _PDFNetPython.Callback_CurrentPageProc(self, current_page, num_pages)
[docs] @staticmethod def StaticCurrentPageProc(current_page, num_pages, data): return _PDFNetPython.Callback_StaticCurrentPageProc(current_page, num_pages, data)
[docs] def JavaScriptEventProc(self, event_type, json): return _PDFNetPython.Callback_JavaScriptEventProc(self, event_type, json)
[docs] @staticmethod def StaticJavaScriptEventProc(event_type, json, data): return _PDFNetPython.Callback_StaticJavaScriptEventProc(event_type, json, data)
[docs] def CurrentZoomProc(self, curr_zoom_proc): return _PDFNetPython.Callback_CurrentZoomProc(self, curr_zoom_proc)
[docs] @staticmethod def StaticCurrentZoomProc(curr_zoom_proc, data): return _PDFNetPython.Callback_StaticCurrentZoomProc(curr_zoom_proc, data)
[docs] def ConnectionErrorProc(self, message, error_code, switch_to_demo): return _PDFNetPython.Callback_ConnectionErrorProc(self, message, error_code, switch_to_demo)
[docs] @staticmethod def StaticConnectionErrorProc(message, error_code, switch_to_demo, data): return _PDFNetPython.Callback_StaticConnectionErrorProc(message, error_code, switch_to_demo, data)
[docs] def ThumbAsyncHandler(self, page_num, was_thumb_found, thumb_buf, thumb_width, thumb_height): return _PDFNetPython.Callback_ThumbAsyncHandler(self, page_num, was_thumb_found, thumb_buf, thumb_width, thumb_height)
[docs] @staticmethod def StaticThumbAsyncHandler(page_num, was_thumb_found, thumb_buf, thumb_width, thumb_height, custom_data): return _PDFNetPython.Callback_StaticThumbAsyncHandler(page_num, was_thumb_found, thumb_buf, thumb_width, thumb_height, custom_data)
[docs] def RequestRenderInWorkerThread(self): return _PDFNetPython.Callback_RequestRenderInWorkerThread(self)
[docs] @staticmethod def StaticRequestRenderInWorkerThread(custom_data): return _PDFNetPython.Callback_StaticRequestRenderInWorkerThread(custom_data)
[docs] def FindTextHandler(self, success, selection): return _PDFNetPython.Callback_FindTextHandler(self, success, selection)
[docs] @staticmethod def StaticFindTextHandler(success, selection, custom_data): return _PDFNetPython.Callback_StaticFindTextHandler(success, selection, custom_data)
[docs] def CreateTileProc(self, buffer, originX, originY, width, height, pagNum, cellNumber, finalRender, predictionRender, tilesRemaining, firstTile, canvasWidth, canvasHeight, cellSideLength, cellPerRow, cellPerCol, thumbnailId): return _PDFNetPython.Callback_CreateTileProc(self, buffer, originX, originY, width, height, pagNum, cellNumber, finalRender, predictionRender, tilesRemaining, firstTile, canvasWidth, canvasHeight, cellSideLength, cellPerRow, cellPerCol, thumbnailId)
[docs] @staticmethod def StaticCreateTileProc(customData, buffer, originX, originY, width, height, pageNum, cellNumber, finalRender, predictionRender, tilesRemaining, firstTile, canvasWidth, canvasHeight, cellSideLength, cellPerRow, cellPerCol, thumbnailId): return _PDFNetPython.Callback_StaticCreateTileProc(customData, buffer, originX, originY, width, height, pageNum, cellNumber, finalRender, predictionRender, tilesRemaining, firstTile, canvasWidth, canvasHeight, cellSideLength, cellPerRow, cellPerCol, thumbnailId)
[docs] def AnnotBitmapProc(self, operation_type, buffer, width, height, stride, page_num, annot_index, annot_key, x_in_page, y_in_page, x_offset, y_offset, remaining_tiles, sequence_number, x_page_size, y_page_size): return _PDFNetPython.Callback_AnnotBitmapProc(self, operation_type, buffer, width, height, stride, page_num, annot_index, annot_key, x_in_page, y_in_page, x_offset, y_offset, remaining_tiles, sequence_number, x_page_size, y_page_size)
[docs] @staticmethod def StaticAnnotBitmapProc(me, operation_type, buffer, width, height, stride, page_num, annot_index, annot_key, x_in_page, y_in_page, x_offset, y_offset, remaining_tiles, sequence_number, x_page_size, y_page_size): return _PDFNetPython.Callback_StaticAnnotBitmapProc(me, operation_type, buffer, width, height, stride, page_num, annot_index, annot_key, x_in_page, y_in_page, x_offset, y_offset, remaining_tiles, sequence_number, x_page_size, y_page_size)
[docs] def DeluxeCreateTileProc(self, buffer, width, height, stride, page_num, x_page_loc, y_page_loc, zoomed_page_width, zoomed_page_height, tile_id, x_in_page, y_in_page, canvas_id, remaining_tiles, tile_type, sequence_number): return _PDFNetPython.Callback_DeluxeCreateTileProc(self, buffer, width, height, stride, page_num, x_page_loc, y_page_loc, zoomed_page_width, zoomed_page_height, tile_id, x_in_page, y_in_page, canvas_id, remaining_tiles, tile_type, sequence_number)
[docs] @staticmethod def StaticDeluxeCreateTileProc(me, buffer, width, height, stride, page_num, x_page_loc, y_page_loc, zoomed_page_width, zoomed_page_height, tile_id, x_in_page, y_in_page, canvas_id, remaining_tiles, tile_type, sequence_number): return _PDFNetPython.Callback_StaticDeluxeCreateTileProc(me, buffer, width, height, stride, page_num, x_page_loc, y_page_loc, zoomed_page_width, zoomed_page_height, tile_id, x_in_page, y_in_page, canvas_id, remaining_tiles, tile_type, sequence_number)
[docs] def RemoveTileProc(self, canvasNumber, cellNumber, thumbnailId, sequenceNumber): return _PDFNetPython.Callback_RemoveTileProc(self, canvasNumber, cellNumber, thumbnailId, sequenceNumber)
[docs] @staticmethod def StaticRemoveTileProc(customData, canvasNumber, cellNumber, thumbnailId, sequenceNumber): return _PDFNetPython.Callback_StaticRemoveTileProc(customData, canvasNumber, cellNumber, thumbnailId, sequenceNumber)
[docs] def PartDownloadedProc(self, dlType, doc, pageNum, objNum, message): return _PDFNetPython.Callback_PartDownloadedProc(self, dlType, doc, pageNum, objNum, message)
[docs] @staticmethod def StaticPartDownloadedProc(dlType, doc, pageNum, objNum, message, customData): return _PDFNetPython.Callback_StaticPartDownloadedProc(dlType, doc, pageNum, objNum, message, customData)
def __disown__(self): self.this.disown() _PDFNetPython.disown_Callback(self) return weakref.proxy(self)
# Register Callback in _PDFNetPython: _PDFNetPython.Callback_swigregister(Callback)
[docs] def Callback_StaticRenderBeginEventProc(data): return _PDFNetPython.Callback_StaticRenderBeginEventProc(data)
[docs] def Callback_StaticRenderFinishEventProc(data, cancelled): return _PDFNetPython.Callback_StaticRenderFinishEventProc(data, cancelled)
[docs] def Callback_StaticErrorReportProc(message, data): return _PDFNetPython.Callback_StaticErrorReportProc(message, data)
[docs] def Callback_StaticCurrentPageProc(current_page, num_pages, data): return _PDFNetPython.Callback_StaticCurrentPageProc(current_page, num_pages, data)
[docs] def Callback_StaticJavaScriptEventProc(event_type, json, data): return _PDFNetPython.Callback_StaticJavaScriptEventProc(event_type, json, data)
[docs] def Callback_StaticCurrentZoomProc(curr_zoom_proc, data): return _PDFNetPython.Callback_StaticCurrentZoomProc(curr_zoom_proc, data)
[docs] def Callback_StaticConnectionErrorProc(message, error_code, switch_to_demo, data): return _PDFNetPython.Callback_StaticConnectionErrorProc(message, error_code, switch_to_demo, data)
[docs] def Callback_StaticThumbAsyncHandler(page_num, was_thumb_found, thumb_buf, thumb_width, thumb_height, custom_data): return _PDFNetPython.Callback_StaticThumbAsyncHandler(page_num, was_thumb_found, thumb_buf, thumb_width, thumb_height, custom_data)
[docs] def Callback_StaticRequestRenderInWorkerThread(custom_data): return _PDFNetPython.Callback_StaticRequestRenderInWorkerThread(custom_data)
[docs] def Callback_StaticFindTextHandler(success, selection, custom_data): return _PDFNetPython.Callback_StaticFindTextHandler(success, selection, custom_data)
[docs] def Callback_StaticCreateTileProc(customData, buffer, originX, originY, width, height, pageNum, cellNumber, finalRender, predictionRender, tilesRemaining, firstTile, canvasWidth, canvasHeight, cellSideLength, cellPerRow, cellPerCol, thumbnailId): return _PDFNetPython.Callback_StaticCreateTileProc(customData, buffer, originX, originY, width, height, pageNum, cellNumber, finalRender, predictionRender, tilesRemaining, firstTile, canvasWidth, canvasHeight, cellSideLength, cellPerRow, cellPerCol, thumbnailId)
[docs] def Callback_StaticAnnotBitmapProc(me, operation_type, buffer, width, height, stride, page_num, annot_index, annot_key, x_in_page, y_in_page, x_offset, y_offset, remaining_tiles, sequence_number, x_page_size, y_page_size): return _PDFNetPython.Callback_StaticAnnotBitmapProc(me, operation_type, buffer, width, height, stride, page_num, annot_index, annot_key, x_in_page, y_in_page, x_offset, y_offset, remaining_tiles, sequence_number, x_page_size, y_page_size)
[docs] def Callback_StaticDeluxeCreateTileProc(me, buffer, width, height, stride, page_num, x_page_loc, y_page_loc, zoomed_page_width, zoomed_page_height, tile_id, x_in_page, y_in_page, canvas_id, remaining_tiles, tile_type, sequence_number): return _PDFNetPython.Callback_StaticDeluxeCreateTileProc(me, buffer, width, height, stride, page_num, x_page_loc, y_page_loc, zoomed_page_width, zoomed_page_height, tile_id, x_in_page, y_in_page, canvas_id, remaining_tiles, tile_type, sequence_number)
[docs] def Callback_StaticRemoveTileProc(customData, canvasNumber, cellNumber, thumbnailId, sequenceNumber): return _PDFNetPython.Callback_StaticRemoveTileProc(customData, canvasNumber, cellNumber, thumbnailId, sequenceNumber)
[docs] def Callback_StaticPartDownloadedProc(dlType, doc, pageNum, objNum, message, customData): return _PDFNetPython.Callback_StaticPartDownloadedProc(dlType, doc, pageNum, objNum, message, customData)
[docs] class SignatureHandler(object): r""" A base class for SignatureHandler. SignatureHandler instances are responsible for defining the digest and cipher algorithms to create and/or validate a signed PDF document. SignatureHandlers are added to PDFDoc instances by calling the PDFDoc::AddSignatureHandler method. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def GetName(self): r""" Gets the name of this SignatureHandler. The name of the SignatureHandler is what identifies this SignatureHandler from all others. This name is also added to the PDF as the value of /Filter entry in the signature dictionary. :rtype: string :return: The name of this SignatureHandler. """ return _PDFNetPython.SignatureHandler_GetName(self)
[docs] def AppendData(self, data): r""" Adds data to be signed. This data will be the raw serialized byte buffer as the PDF is being saved to any stream. :type data: std::vector< int,std::allocator< int > > :param data: A chunk of data to be signed. """ return _PDFNetPython.SignatureHandler_AppendData(self, data)
[docs] def Reset(self): r""" Resets any data appending and signature calculations done so far. This method should allow PDFNet to restart the whole signature calculation process. It is important that when this method is invoked, any data processed with the AppendData method should be discarded. :rtype: boolean :return: True if there are no errors, otherwise false. """ return _PDFNetPython.SignatureHandler_Reset(self)
[docs] def CreateSignature(self): r""" Calculates the actual signature using client implemented signing methods. The returned value (byte array) will be written as the /Contents entry in the signature dictionary. :rtype: std::vector< int,std::allocator< int > > :return: The calculated signature data. """ return _PDFNetPython.SignatureHandler_CreateSignature(self)
[docs] def Clone(self): r""" This method returns a cloned copy of the current instance. :rtype: :py:class:`SignatureHandler` :return: A new, cloned instance of SignatureHandler. Notes: this method must be implemented in any derived class from SignatureHandler. """ return _PDFNetPython.SignatureHandler_Clone(self)
__swig_destroy__ = _PDFNetPython.delete_SignatureHandler def __init__(self): if self.__class__ == SignatureHandler: _self = None else: _self = self _PDFNetPython.SignatureHandler_swiginit(self, _PDFNetPython.new_SignatureHandler(_self, )) def __disown__(self): self.this.disown() _PDFNetPython.disown_SignatureHandler(self) return weakref.proxy(self)
# Register SignatureHandler in _PDFNetPython: _PDFNetPython.SignatureHandler_swigregister(SignatureHandler)
[docs] class TRN_matrix2d(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr m_a = property(_PDFNetPython.TRN_matrix2d_m_a_get, _PDFNetPython.TRN_matrix2d_m_a_set) m_b = property(_PDFNetPython.TRN_matrix2d_m_b_get, _PDFNetPython.TRN_matrix2d_m_b_set) m_c = property(_PDFNetPython.TRN_matrix2d_m_c_get, _PDFNetPython.TRN_matrix2d_m_c_set) m_d = property(_PDFNetPython.TRN_matrix2d_m_d_get, _PDFNetPython.TRN_matrix2d_m_d_set) m_h = property(_PDFNetPython.TRN_matrix2d_m_h_get, _PDFNetPython.TRN_matrix2d_m_h_set) m_v = property(_PDFNetPython.TRN_matrix2d_m_v_get, _PDFNetPython.TRN_matrix2d_m_v_set) def __init__(self): _PDFNetPython.TRN_matrix2d_swiginit(self, _PDFNetPython.new_TRN_matrix2d()) __swig_destroy__ = _PDFNetPython.delete_TRN_matrix2d
# Register TRN_matrix2d in _PDFNetPython: _PDFNetPython.TRN_matrix2d_swigregister(TRN_matrix2d)
[docs] class TRN_byterange(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr m_offset = property(_PDFNetPython.TRN_byterange_m_offset_get, _PDFNetPython.TRN_byterange_m_offset_set) m_size = property(_PDFNetPython.TRN_byterange_m_size_get, _PDFNetPython.TRN_byterange_m_size_set) def __init__(self): _PDFNetPython.TRN_byterange_swiginit(self, _PDFNetPython.new_TRN_byterange()) __swig_destroy__ = _PDFNetPython.delete_TRN_byterange
# Register TRN_byterange in _PDFNetPython: _PDFNetPython.TRN_byterange_swigregister(TRN_byterange)
[docs] class TRN_rect(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr x1 = property(_PDFNetPython.TRN_rect_x1_get, _PDFNetPython.TRN_rect_x1_set) y1 = property(_PDFNetPython.TRN_rect_y1_get, _PDFNetPython.TRN_rect_y1_set) x2 = property(_PDFNetPython.TRN_rect_x2_get, _PDFNetPython.TRN_rect_x2_set) y2 = property(_PDFNetPython.TRN_rect_y2_get, _PDFNetPython.TRN_rect_y2_set) mp_rect = property(_PDFNetPython.TRN_rect_mp_rect_get, _PDFNetPython.TRN_rect_mp_rect_set) def __init__(self): _PDFNetPython.TRN_rect_swiginit(self, _PDFNetPython.new_TRN_rect()) __swig_destroy__ = _PDFNetPython.delete_TRN_rect
# Register TRN_rect in _PDFNetPython: _PDFNetPython.TRN_rect_swigregister(TRN_rect)
[docs] class TRN_date(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr year = property(_PDFNetPython.TRN_date_year_get, _PDFNetPython.TRN_date_year_set) month = property(_PDFNetPython.TRN_date_month_get, _PDFNetPython.TRN_date_month_set) day = property(_PDFNetPython.TRN_date_day_get, _PDFNetPython.TRN_date_day_set) hour = property(_PDFNetPython.TRN_date_hour_get, _PDFNetPython.TRN_date_hour_set) minute = property(_PDFNetPython.TRN_date_minute_get, _PDFNetPython.TRN_date_minute_set) second = property(_PDFNetPython.TRN_date_second_get, _PDFNetPython.TRN_date_second_set) UT = property(_PDFNetPython.TRN_date_UT_get, _PDFNetPython.TRN_date_UT_set) UT_hour = property(_PDFNetPython.TRN_date_UT_hour_get, _PDFNetPython.TRN_date_UT_hour_set) UT_minutes = property(_PDFNetPython.TRN_date_UT_minutes_get, _PDFNetPython.TRN_date_UT_minutes_set) mp_obj = property(_PDFNetPython.TRN_date_mp_obj_get, _PDFNetPython.TRN_date_mp_obj_set) def __init__(self): _PDFNetPython.TRN_date_swiginit(self, _PDFNetPython.new_TRN_date()) __swig_destroy__ = _PDFNetPython.delete_TRN_date
# Register TRN_date in _PDFNetPython: _PDFNetPython.TRN_date_swigregister(TRN_date)
[docs] class TRN_chardata(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr char_code = property(_PDFNetPython.TRN_chardata_char_code_get, _PDFNetPython.TRN_chardata_char_code_set) x = property(_PDFNetPython.TRN_chardata_x_get, _PDFNetPython.TRN_chardata_x_set) y = property(_PDFNetPython.TRN_chardata_y_get, _PDFNetPython.TRN_chardata_y_set) char_data = property(_PDFNetPython.TRN_chardata_char_data_get, _PDFNetPython.TRN_chardata_char_data_set) bytes = property(_PDFNetPython.TRN_chardata_bytes_get, _PDFNetPython.TRN_chardata_bytes_set) def __init__(self): _PDFNetPython.TRN_chardata_swiginit(self, _PDFNetPython.new_TRN_chardata()) __swig_destroy__ = _PDFNetPython.delete_TRN_chardata
# Register TRN_chardata in _PDFNetPython: _PDFNetPython.TRN_chardata_swigregister(TRN_chardata)
[docs] class TRN_point(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr x = property(_PDFNetPython.TRN_point_x_get, _PDFNetPython.TRN_point_x_set) y = property(_PDFNetPython.TRN_point_y_get, _PDFNetPython.TRN_point_y_set) def __init__(self): _PDFNetPython.TRN_point_swiginit(self, _PDFNetPython.new_TRN_point()) __swig_destroy__ = _PDFNetPython.delete_TRN_point
# Register TRN_point in _PDFNetPython: _PDFNetPython.TRN_point_swigregister(TRN_point)
[docs] class TRN_quadpoint(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr p1x = property(_PDFNetPython.TRN_quadpoint_p1x_get, _PDFNetPython.TRN_quadpoint_p1x_set) p1y = property(_PDFNetPython.TRN_quadpoint_p1y_get, _PDFNetPython.TRN_quadpoint_p1y_set) p2x = property(_PDFNetPython.TRN_quadpoint_p2x_get, _PDFNetPython.TRN_quadpoint_p2x_set) p2y = property(_PDFNetPython.TRN_quadpoint_p2y_get, _PDFNetPython.TRN_quadpoint_p2y_set) p3x = property(_PDFNetPython.TRN_quadpoint_p3x_get, _PDFNetPython.TRN_quadpoint_p3x_set) p3y = property(_PDFNetPython.TRN_quadpoint_p3y_get, _PDFNetPython.TRN_quadpoint_p3y_set) p4x = property(_PDFNetPython.TRN_quadpoint_p4x_get, _PDFNetPython.TRN_quadpoint_p4x_set) p4y = property(_PDFNetPython.TRN_quadpoint_p4y_get, _PDFNetPython.TRN_quadpoint_p4y_set) def __init__(self): _PDFNetPython.TRN_quadpoint_swiginit(self, _PDFNetPython.new_TRN_quadpoint()) __swig_destroy__ = _PDFNetPython.delete_TRN_quadpoint
# Register TRN_quadpoint in _PDFNetPython: _PDFNetPython.TRN_quadpoint_swigregister(TRN_quadpoint)
[docs] class Matrix2D(TRN_matrix2d): r""" 2D Matrix A Matrix2D object represents a 3x3 matrix that, in turn, represents an affine transformation. A Matrix2D object stores only six of the nine numbers in a 3x3 matrix because all 3x3 matrices that represent affine transformations have the same third column (0, 0, 1). Affine transformations include rotating, scaling, reflecting, shearing, and translating. In PDFNet, the Matrix2D class provides the foundation for performing affine transformations on vector drawings, images, and text. A transformation matrix specifies the relationship between two coordinate spaces. By modifying a transformation matrix, objects can be scaled, rotated, translated, or transformed in other ways. A transformation matrix in PDF is specified by six numbers, usually in the form of an array containing six elements. In its most general form, this array is denoted [a b c d h v]; The following table lists the arrays that specify the most common transformations: - Translations are specified as [1 0 0 1 tx ty], where tx and ty are the distances to translate the origin of the coordinate system in the horizontal and vertical dimensions, respectively. - Scaling is obtained by [sx 0 0 sy 0 0]. This scales the coordinates so that 1 unit in the horizontal and vertical dimensions of the new coordinate system is the same size as sx and sy units, respectively, in the previous coordinate system. - Rotations are produced by [cos(A) sin(A) -sin(A) cos(A) 0 0], which has the effect of rotating the coordinate system axes by an angle 'A' counterclockwise. - Skew is specified by [1 tan(A) tan(B) 1 0 0], which skews the x axis by an angle A and the y axis by an angle B. Matrix2D elements are positioned as follows : | m_a m_b 0 | | m_c m_d 0 | | m_h m_v 1 | A single Matrix2D object can store a single transformation or a sequence of transformations. The latter is called a composite transformation. The matrix of a composite transformation is obtained by multiplying (concatenating) the matrices of the individual transformations. Because matrix multiplication is not commutative-the order in which matrices are multiplied is significant. For example, if you first rotate, then scale, then translate, you get a different result than if you first translate, then rotate, then scale. For more information on properties of PDF matrices please refer to PDF Reference Manual (Sections 4.2 'Coordinate Systems' and 4.2.3 'Transformation Matrices') .. code-block:: c++ The following sample illustrates how to use Matrix2D in order to position an image on the page. Note that PDFNet uses the same convention of matrix multiplication used in PostScript and OpenGL. Element element = eb.CreateImage(Image(...)); double deg2rad = 3.1415926535 / 180.0; Matrix2D mtx = Matrix2D(1, 0, 0, 1, 0, 200); // Translate mtx = Matrix2D(300, 0, 0, 200, 0, 0); // Scale mtx = Matrix2D::RotationMatrix( 90 deg2rad ); // Rotate element.GetGState().SetTransform(mtx); writer.WritePlacedElement(element); .. code-block:: c++ The following sample sample illustrates how to use Matrix2D in order to calculate absolute positioning for the text on the page. ... Matrix2D text_mtx = text_element.GetTextMatrix(); double x, y; for (CharIterator itr = text_element.GetCharIterator(); itr.HasNext(); itr.Next()) { x = itr.Current().x; // character positioning information y = itr.Current().y; // Get current transformation matrix (CTM) Matrix2D ctm = text_element.GetCTM(); // To get the absolute character positioning information concatenate current // text matrix with CTM and then multiply relative positioning coordinates with // the resulting matrix. Matrix2D mtx = ctm text_mtx; mtx.Mult(x, y); } """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): r""" Overload 1: Creates and initializes a Matrix object based on six numbers that define an affine transformation. :type a: double :param a: the matrix element in the first row, first column. :type b: double :param b: the matrix element in the first row, second column. :type c: double :param c: the matrix element in the second row, first column. :type d: double :param d: the matrix element in the second row, second column. :type h: double :param h: the matrix element in the third row, first column. :type v: double :param v: the matrix element in the third row, second column. when none the arguments are specified, an identity matrix is created. | Overload 2: Copyructor. """ _PDFNetPython.Matrix2D_swiginit(self, _PDFNetPython.new_Matrix2D(args))
[docs] def Set(self, a, b, c, d, h, v): r""" The Set method sets the elements of this matrix. :type a: double :param a: the matrix element in the first row, first column. :type b: double :param b: the matrix element in the first row, second column. :type c: double :param c: the matrix element in the second row, first column. :type d: double :param d: the matrix element in the second row, second column. :type h: double :param h: the matrix element in the third row, first column. :type v: double :param v: the matrix element in the third row, second column. """ return _PDFNetPython.Matrix2D_Set(self, a, b, c, d, h, v)
[docs] def Concat(self, a, b, c, d, h, v): r""" The Concat method updates this matrix with the product of itself and another matrix specified through an argument list. :type a: double :param a: the matrix element in the first row, first column. :type b: double :param b: the matrix element in the first row, second column. :type c: double :param c: the matrix element in the second row, first column. :type d: double :param d: the matrix element in the second row, second column. :type h: double :param h: the matrix element in the third row, first column. :type v: double :param v: the matrix element in the third row, second column. """ return _PDFNetPython.Matrix2D_Concat(self, a, b, c, d, h, v)
[docs] def Multiply(self, m): return _PDFNetPython.Matrix2D_Multiply(self, m)
[docs] def IsEquals(self, m): return _PDFNetPython.Matrix2D_IsEquals(self, m)
[docs] def IsNotEquals(self, m): return _PDFNetPython.Matrix2D_IsNotEquals(self, m)
[docs] def Mult(self, pt): r"""Transform/multiply the point (in_out_x, in_out_y) using this matrix""" return _PDFNetPython.Matrix2D_Mult(self, pt)
[docs] def Inverse(self): r""" :rtype: :py:class:`Matrix2D` :return: If this matrix is invertible, the Inverse method returns its inverse matrix. """ return _PDFNetPython.Matrix2D_Inverse(self)
[docs] def Translate(self, h, v): r""" Updates this matrix with the product of itself and a translation matrix (i.e. it is equivalent to this.m_h += h; this.m_v += v). :type h: double :param h: the horizontal component of the translation. :type v: double :param v: the vertical component of the translation. Notes: This method is deprecated. Please use PreTranslate or PostTranslate instead. The behavior of this method is identical to PreTranslate, but PostTranslate will be more suitable for some use cases. """ return _PDFNetPython.Matrix2D_Translate(self, h, v)
[docs] def PreTranslate(self, h, v): r""" Updates this matrix to the concatenation of a translation matrix and the original matrix. M' = T(h, v) M. It is equivalent to this.m_h += h; this.m_v += v. :type h: double :param h: the horizontal component of the translation. :type v: double :param v: the vertical component of the translation. """ return _PDFNetPython.Matrix2D_PreTranslate(self, h, v)
[docs] def PostTranslate(self, h, v): r""" Updates this matrix by concatenating a translation matrix. M' = M T(h, v). It is equivalent to this.Concat(1,0,0,1,h,v). :type h: double :param h: the horizontal component of the translation. :type v: double :param v: the vertical component of the translation. """ return _PDFNetPython.Matrix2D_PostTranslate(self, h, v)
[docs] def Scale(self, h, v): r""" The Scale method updates this matrix with the product of itself and a scaling matrix. :type h: double :param h: the horizontal scale factor. :type v: double :param v: the vertical scale factor """ return _PDFNetPython.Matrix2D_Scale(self, h, v)
[docs] @staticmethod def ZeroMatrix(): r"""Create zero matrix (0 0 0 0 0 0)""" return _PDFNetPython.Matrix2D_ZeroMatrix()
[docs] @staticmethod def IdentityMatrix(): r"""Create identity matrix (1 0 0 1 0 0)""" return _PDFNetPython.Matrix2D_IdentityMatrix()
[docs] @staticmethod def RotationMatrix(angle): r""" :rtype: :py:class:`Matrix2D` :return: A rotation matrix for a given angle. :type angle: double :param angle: the angle of rotation in radians. Positive values specify clockwise rotation. """ return _PDFNetPython.Matrix2D_RotationMatrix(angle)
__swig_destroy__ = _PDFNetPython.delete_Matrix2D
# Register Matrix2D in _PDFNetPython: _PDFNetPython.Matrix2D_swigregister(Matrix2D)
[docs] def Matrix2D_ZeroMatrix(): r"""Create zero matrix (0 0 0 0 0 0)""" return _PDFNetPython.Matrix2D_ZeroMatrix()
[docs] def Matrix2D_IdentityMatrix(): r"""Create identity matrix (1 0 0 1 0 0)""" return _PDFNetPython.Matrix2D_IdentityMatrix()
[docs] def Matrix2D_RotationMatrix(angle): r""" :rtype: :py:class:`Matrix2D` :return: A rotation matrix for a given angle. :type angle: double :param angle: the angle of rotation in radians. Positive values specify clockwise rotation. """ return _PDFNetPython.Matrix2D_RotationMatrix(angle)
[docs] class GSChangesIterator(object): r"""The Iterator specialization for integer type.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_GSChangesIterator
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.GSChangesIterator_Destroy(self)
[docs] def Next(self): return _PDFNetPython.GSChangesIterator_Next(self)
[docs] def Current(self): return _PDFNetPython.GSChangesIterator_Current(self)
[docs] def HasNext(self): return _PDFNetPython.GSChangesIterator_HasNext(self)
def __init__(self, args): _PDFNetPython.GSChangesIterator_swiginit(self, _PDFNetPython.new_GSChangesIterator(args)) mp_impl = property(_PDFNetPython.GSChangesIterator_mp_impl_get, _PDFNetPython.GSChangesIterator_mp_impl_set)
# Register GSChangesIterator in _PDFNetPython: _PDFNetPython.GSChangesIterator_swigregister(GSChangesIterator)
[docs] class UInt32Iterator(object): r"""Supports a simple iteration over a generic collection.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_UInt32Iterator
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.UInt32Iterator_Destroy(self)
[docs] def Next(self): r""" Note: HasNext() must be true before calling Next() Advances the iterator to the next element of the collection. """ return _PDFNetPython.UInt32Iterator_Next(self)
[docs] def Current(self): r""" Note: HasNext() must be true before calling Current() :rtype: int :return: the current element in the collection """ return _PDFNetPython.UInt32Iterator_Current(self)
[docs] def HasNext(self): r""" :rtype: boolean :return: true if the iterator can be successfully advanced to the next element; false if the iterator is no longer valid. """ return _PDFNetPython.UInt32Iterator_HasNext(self)
def __init__(self, args): _PDFNetPython.UInt32Iterator_swiginit(self, _PDFNetPython.new_UInt32Iterator(args)) mp_impl = property(_PDFNetPython.UInt32Iterator_mp_impl_get, _PDFNetPython.UInt32Iterator_mp_impl_set)
# Register UInt32Iterator in _PDFNetPython: _PDFNetPython.UInt32Iterator_swigregister(UInt32Iterator)
[docs] class PageIterator(object): r"""Supports a simple iteration over a generic collection.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_PageIterator
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.PageIterator_Destroy(self)
[docs] def Next(self): r""" Note: HasNext() must be true before calling Next() Advances the iterator to the next element of the collection. """ return _PDFNetPython.PageIterator_Next(self)
[docs] def Current(self): r""" Note: HasNext() must be true before calling Current() :rtype: :py:class:`Page` :return: the current element in the collection """ return _PDFNetPython.PageIterator_Current(self)
[docs] def HasNext(self): r""" :rtype: boolean :return: true if the iterator can be successfully advanced to the next element; false if the iterator is no longer valid. """ return _PDFNetPython.PageIterator_HasNext(self)
def __init__(self, args): _PDFNetPython.PageIterator_swiginit(self, _PDFNetPython.new_PageIterator(args)) mp_impl = property(_PDFNetPython.PageIterator_mp_impl_get, _PDFNetPython.PageIterator_mp_impl_set)
# Register PageIterator in _PDFNetPython: _PDFNetPython.PageIterator_swigregister(PageIterator)
[docs] class FDFFieldIterator(object): r"""Supports a simple iteration over a generic collection.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_FDFFieldIterator
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.FDFFieldIterator_Destroy(self)
[docs] def Next(self): r""" Note: HasNext() must be true before calling Next() Advances the iterator to the next element of the collection. """ return _PDFNetPython.FDFFieldIterator_Next(self)
[docs] def Current(self): r""" Note: HasNext() must be true before calling Current() :rtype: :py:class:`FDFField` :return: the current element in the collection """ return _PDFNetPython.FDFFieldIterator_Current(self)
[docs] def HasNext(self): r""" :rtype: boolean :return: true if the iterator can be successfully advanced to the next element; false if the iterator is no longer valid. """ return _PDFNetPython.FDFFieldIterator_HasNext(self)
def __init__(self, args): _PDFNetPython.FDFFieldIterator_swiginit(self, _PDFNetPython.new_FDFFieldIterator(args)) mp_impl = property(_PDFNetPython.FDFFieldIterator_mp_impl_get, _PDFNetPython.FDFFieldIterator_mp_impl_set)
# Register FDFFieldIterator in _PDFNetPython: _PDFNetPython.FDFFieldIterator_swigregister(FDFFieldIterator)
[docs] class FieldIterator(object): r"""Supports a simple iteration over a generic collection.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_FieldIterator
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.FieldIterator_Destroy(self)
[docs] def Next(self): r""" Note: HasNext() must be true before calling Next() Advances the iterator to the next element of the collection. """ return _PDFNetPython.FieldIterator_Next(self)
[docs] def Current(self): r""" Note: HasNext() must be true before calling Current() :rtype: :py:class:`Field` :return: the current element in the collection """ return _PDFNetPython.FieldIterator_Current(self)
[docs] def HasNext(self): r""" :rtype: boolean :return: true if the iterator can be successfully advanced to the next element; false if the iterator is no longer valid. """ return _PDFNetPython.FieldIterator_HasNext(self)
def __init__(self, args): _PDFNetPython.FieldIterator_swiginit(self, _PDFNetPython.new_FieldIterator(args)) mp_impl = property(_PDFNetPython.FieldIterator_mp_impl_get, _PDFNetPython.FieldIterator_mp_impl_set)
# Register FieldIterator in _PDFNetPython: _PDFNetPython.FieldIterator_swigregister(FieldIterator)
[docs] class CharIterator(object): r"""Supports a simple iteration over a generic collection.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_CharIterator
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.CharIterator_Destroy(self)
[docs] def Next(self): r""" Note: HasNext() must be true before calling Next() Advances the iterator to the next element of the collection. """ return _PDFNetPython.CharIterator_Next(self)
[docs] def Current(self): r""" Note: HasNext() must be true before calling Current() :rtype: :py:class:`TRN_chardata` :return: the current element in the collection """ return _PDFNetPython.CharIterator_Current(self)
[docs] def HasNext(self): r""" :rtype: boolean :return: true if the iterator can be successfully advanced to the next element; false if the iterator is no longer valid. """ return _PDFNetPython.CharIterator_HasNext(self)
def __init__(self, args): _PDFNetPython.CharIterator_swiginit(self, _PDFNetPython.new_CharIterator(args)) mp_impl = property(_PDFNetPython.CharIterator_mp_impl_get, _PDFNetPython.CharIterator_mp_impl_set)
# Register CharIterator in _PDFNetPython: _PDFNetPython.CharIterator_swigregister(CharIterator)
[docs] class DigitalSignatureFieldIterator(object): r"""Supports a simple iteration over a generic collection.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_DigitalSignatureFieldIterator
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.DigitalSignatureFieldIterator_Destroy(self)
[docs] def Next(self): r""" Note: HasNext() must be true before calling Next() Advances the iterator to the next element of the collection. """ return _PDFNetPython.DigitalSignatureFieldIterator_Next(self)
[docs] def Current(self): r""" Note: HasNext() must be true before calling Current() :rtype: :py:class:`DigitalSignatureField` :return: the current element in the collection """ return _PDFNetPython.DigitalSignatureFieldIterator_Current(self)
[docs] def HasNext(self): r""" :rtype: boolean :return: true if the iterator can be successfully advanced to the next element; false if the iterator is no longer valid. """ return _PDFNetPython.DigitalSignatureFieldIterator_HasNext(self)
def __init__(self, args): _PDFNetPython.DigitalSignatureFieldIterator_swiginit(self, _PDFNetPython.new_DigitalSignatureFieldIterator(args)) mp_impl = property(_PDFNetPython.DigitalSignatureFieldIterator_mp_impl_get, _PDFNetPython.DigitalSignatureFieldIterator_mp_impl_set)
# Register DigitalSignatureFieldIterator in _PDFNetPython: _PDFNetPython.DigitalSignatureFieldIterator_swigregister(DigitalSignatureFieldIterator)
[docs] class ContentNodeIterator(object): r"""Supports a simple iteration over a generic collection.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_ContentNodeIterator
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.ContentNodeIterator_Destroy(self)
[docs] def Next(self): r""" Note: HasNext() must be true before calling Next() Advances the iterator to the next element of the collection. """ return _PDFNetPython.ContentNodeIterator_Next(self)
[docs] def Current(self): r""" Note: HasNext() must be true before calling Current() :rtype: :py:class:`ContentElement` :return: the current element in the collection """ return _PDFNetPython.ContentNodeIterator_Current(self)
[docs] def HasNext(self): r""" :rtype: boolean :return: true if the iterator can be successfully advanced to the next element; false if the iterator is no longer valid. """ return _PDFNetPython.ContentNodeIterator_HasNext(self)
def __init__(self, args): _PDFNetPython.ContentNodeIterator_swiginit(self, _PDFNetPython.new_ContentNodeIterator(args)) mp_impl = property(_PDFNetPython.ContentNodeIterator_mp_impl_get, _PDFNetPython.ContentNodeIterator_mp_impl_set)
# Register ContentNodeIterator in _PDFNetPython: _PDFNetPython.ContentNodeIterator_swigregister(ContentNodeIterator)
[docs] class Filter(object): r""" Provides a generic view of a sequence of bytes. A Filter is the abstract base class of all filters. A filter is an abstraction of a sequence of bytes, such as a file, an input/output device, an inter-process communication pipe, or a TCP/IP socket. The Filter class and its derived classes provide a generic view of these different types of input and output, isolating the programmer from the specific details of the operating system and the underlying devices. Besides providing access to input/output sources Filters can be also to transform the data (e.g. to compress the data stream, to normalize the image data, to encrypt data, etc). Filters can also be attached to each other to form pipelines. For example, a filter used to open an image data file can be attached to a filter that decompresses the data, which is attached to another filter that will normalize the image data. Depending on the underlying data source or repository, filters might support only some of these capabilities. An application can query a stream for its capabilities by using the IsInputFilter() and CanSeek() properties. Notes: To read or write data to a filter, a user will typically use FilterReader/FilterWriter class. instead of using Filter methods For example: .. code-block:: c++ StdFile file("my_stream.txt", StdFile::e_read_mode); FilterReader reader(file); while (reader.Read(..)) ... """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_Filter def __nonzero__(self): return _PDFNetPython.Filter___nonzero__(self) __bool__ = __nonzero__
[docs] def AttachFilter(self, attach_filter): r""" Attaches a filter to the this filter. If this filter owns another filter it will be deleted. This filter then becomes the owner of the attached filter. :type attach_filter: :py:class:`Filter` :param attach_filter: filter object to attach """ return _PDFNetPython.Filter_AttachFilter(self, attach_filter)
[docs] def ReleaseAttachedFilter(self): r""" Release the ownership of the attached filter. After the attached filter is released this filter points to NULL filter. :rtype: :py:class:`Filter` :return: - Previously attached filter. """ return _PDFNetPython.Filter_ReleaseAttachedFilter(self)
[docs] def GetAttachedFilter(self): r""" :rtype: :py:class:`Filter` :return: - returns attached Filter or a NULL filter if no filter is attached. """ return _PDFNetPython.Filter_GetAttachedFilter(self)
[docs] def GetSourceFilter(self): r""" :rtype: :py:class:`Filter` :return: - returns the first filter in the chain (usually a file filter) """ return _PDFNetPython.Filter_GetSourceFilter(self)
[docs] def GetName(self): r""" :rtype: string :return: - descriptive name of the filter. """ return _PDFNetPython.Filter_GetName(self)
[docs] def GetDecodeName(self): r""" :rtype: string :return: - string representing the name of corresponding decode filter as it should appear in document (e.g. both ASCIIHexDecode and ASCIIHexEncode should return ASCIIHexDecode). """ return _PDFNetPython.Filter_GetDecodeName(self)
[docs] def Size(self): r""" :rtype: int :return: - the size of buffer returned by Begin(). If the Size() returns 0 end of data has been reached. """ return _PDFNetPython.Filter_Size(self)
[docs] def Consume(self, num_bytes): r""" Moves the Begin() pointer num_bytes forward. :type num_bytes: int :param num_bytes: - number of bytes to consume. num_bytes must be less than or equal to Size(). """ return _PDFNetPython.Filter_Consume(self, num_bytes)
[docs] def Count(self): r""" :rtype: int :return: - the number of bytes consumed since opening the filter or the last Seek operation """ return _PDFNetPython.Filter_Count(self)
[docs] def SetCount(self, new_count): r""" Sets a new counting point for the current filter. All subsequent Consume() operations will increment this counter. Make sure that the output filter is flushed before using SetCount(). :type new_count: int :param new_count: number to set the counting point of the filter to. :rtype: int :return: - the value of previous counter """ return _PDFNetPython.Filter_SetCount(self, new_count)
[docs] def SetStreamLength(self, bytes): r""" The functions specifies the length of the data stream. The default implementation doesn't do anything. For some derived filters such as file segment filter it may be useful to override this function in order to limit the stream length. :type bytes: int :param bytes: the length of stream in bytes """ return _PDFNetPython.Filter_SetStreamLength(self, bytes)
[docs] def Flush(self): r""" Forces any data remaining in the buffer to be written to input or output filter. """ return _PDFNetPython.Filter_Flush(self)
[docs] def FlushAll(self): r"""Forces any data remaining in the filter chain to the source or destination.""" return _PDFNetPython.Filter_FlushAll(self)
[docs] def IsInputFilter(self): r""" :rtype: boolean :return: - boolean indicating whether this is an input filter. """ return _PDFNetPython.Filter_IsInputFilter(self)
[docs] def CanSeek(self): r""" :rtype: boolean :return: - true if the stream supports seeking; otherwise, false. default is to return false. """ return _PDFNetPython.Filter_CanSeek(self)
e_begin = _PDFNetPython.Filter_e_begin e_end = _PDFNetPython.Filter_e_end e_cur = _PDFNetPython.Filter_e_cur
[docs] def Seek(self, offset, origin): r""" When overridden in a derived class, sets the position within the current stream. :type offset: ptrdiff_t :param offset: - A byte offset relative to origin. If offset is negative, the new position will precede the position specified by origin by the number of bytes specified by offset. If offset is zero, the new position will be the position specified by origin. If offset is positive, the new position will follow the position specified by origin by the number of bytes specified by offset. :type origin: int :param origin: - A value of type ReferencePos indicating the reference point used to obtain the new position Notes: - After each Seek() operation the number of consumed bytes (i.e. Count()) is set to 0. :raises: - throws FilterExc if the method is not implemented in derived class """ return _PDFNetPython.Filter_Seek(self, offset, origin)
[docs] def Tell(self): r""" Reports the current read position in the stream relative to the stream origin. :rtype: ptrdiff_t :return: - The current position in the stream :raises: - throws FilterExc if the method is not implemented in derived class """ return _PDFNetPython.Filter_Tell(self)
[docs] def Truncate(self, new_size): r""" Truncates the underlying data. This method is for a writeable, seekable filter only and will throw otherwise. Notes: For a filter representing a file, truncation would mean resizing the file. :type new_size: int :param new_size: - the number of bytes to resize the filter to :rtype: int :return: - The new size of the filter :raises: - throws FilterExc if the method is not implemented in derived class """ return _PDFNetPython.Filter_Truncate(self, new_size)
[docs] def CreateInputIterator(self): r""" Create Filter iterator. Filter iterator similar to a regular filter. However, there can be only one owner of the attached filter. Notes: - Derived classes should make sure that there is only one owner of the attached stream. Otherwise the attached stream may be deleted several times. :raises: - throws an exception if the method is not implemented in the derived class """ return _PDFNetPython.Filter_CreateInputIterator(self)
[docs] def GetFilePath(self): r""" :rtype: string :return: the file path to the underlying file stream. Default implementation returns empty string. """ return _PDFNetPython.Filter_GetFilePath(self)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.Filter_Destroy(self)
[docs] def WriteToFile(self, path, append): r""" Writes the entire filter, starting at current position, to specified filepath. Should only be called on an input filter. :type path: string :param path: the output filepath. :type append: boolean :param append: 'true' to append to existing file contents, 'false' to overwrite. """ return _PDFNetPython.Filter_WriteToFile(self, path, append)
m_impl = property(_PDFNetPython.Filter_m_impl_get, _PDFNetPython.Filter_m_impl_set) def __init__(self, args): _PDFNetPython.Filter_swiginit(self, _PDFNetPython.new_Filter(args)) m_owner = property(_PDFNetPython.Filter_m_owner_get, _PDFNetPython.Filter_m_owner_set)
# Register Filter in _PDFNetPython: _PDFNetPython.Filter_swigregister(Filter)
[docs] class ASCII85Encode(Filter): r""" ASCII85Encode filter can be used to encode any data stream into a stream that does not contain any binary characters. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, input_filter, line_width=72, buf_sz=256): r""" :type line_width: int :param line_width: specifies the width of the encoded line expressed in the number of characters. """ _PDFNetPython.ASCII85Encode_swiginit(self, _PDFNetPython.new_ASCII85Encode(input_filter, line_width, buf_sz)) __swig_destroy__ = _PDFNetPython.delete_ASCII85Encode
# Register ASCII85Encode in _PDFNetPython: _PDFNetPython.ASCII85Encode_swigregister(ASCII85Encode)
[docs] class FilterReader(object): r""" FilterReader is a utility class providing a convenient way to read data from an input filter (using Filter directly is not very intuitive). For example: .. code-block:: c++ StdFile file("my_stream.txt", StdFile::e_read_mode); FilterReader reader(file); while (reader.Read(...)) ... """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): _PDFNetPython.FilterReader_swiginit(self, _PDFNetPython.new_FilterReader(args)) __swig_destroy__ = _PDFNetPython.delete_FilterReader
[docs] def Get(self): r""" :rtype: int :return: - the next character from the stream or EOF (-1) if the end of file is reached. """ return _PDFNetPython.FilterReader_Get(self)
[docs] def Peek(self): r""" :rtype: int :return: - the next character without extracting it from the stream or or EOF (-1) if the end of file is reached. """ return _PDFNetPython.FilterReader_Peek(self)
[docs] def Read(self, buf_size): r""" :rtype: std::vector< unsigned char,std::allocator< unsigned char > > :return: - returns the number of bytes actually read and stored in buffer (buf), which may be less than buf_size if the end of the stream is encountered before reaching count. """ return _PDFNetPython.FilterReader_Read(self, buf_size)
[docs] def AttachFilter(self, filter): r""" Attaches a filter to the this FilterReader. :type filter: :py:class:`Filter` :param filter: filter object to attach """ return _PDFNetPython.FilterReader_AttachFilter(self, filter)
[docs] def GetAttachedFilter(self): r""" :rtype: :py:class:`Filter` :return: - The attached Filter or a NULL filter if no filter is attached. """ return _PDFNetPython.FilterReader_GetAttachedFilter(self)
[docs] def Seek(self, offset, origin): r""" Sets the position within the current stream. :type offset: ptrdiff_t :param offset: - A byte offset relative to origin. If offset is negative, the new position will precede the position specified by origin by the number of bytes specified by offset. If offset is zero, the new position will be the position specified by origin. If offset is positive, the new position will follow the position specified by origin by the number of bytes specified by offset. :type origin: int :param origin: - A value of type ReferencePos indicating the reference point used to obtain the new position Notes: - After each Seek() operation the number of consumed bytes (i.e. Count()) is set to 0. :raises: - throws an exception if the method is not implemented in the associated filter. """ return _PDFNetPython.FilterReader_Seek(self, offset, origin)
[docs] def Tell(self): r""" Reports the current read position in the stream relative to the stream origin. :rtype: ptrdiff_t :return: - The current position in the stream :raises: - throws an exception if the method is not implemented in the associated filter. """ return _PDFNetPython.FilterReader_Tell(self)
[docs] def Count(self): r""" :rtype: int :return: - the number of bytes consumed since opening the filter or since the last Seek operation. """ return _PDFNetPython.FilterReader_Count(self)
[docs] def Flush(self): r"""Forces any data remaining in the buffer to be written to input or output filter.""" return _PDFNetPython.FilterReader_Flush(self)
[docs] def FlushAll(self): r"""Forces any data remaining in the filter chain to the source or destination.""" return _PDFNetPython.FilterReader_FlushAll(self)
m_impl = property(_PDFNetPython.FilterReader_m_impl_get, _PDFNetPython.FilterReader_m_impl_set)
# Register FilterReader in _PDFNetPython: _PDFNetPython.FilterReader_swigregister(FilterReader)
[docs] class FilterWriter(object): r""" FilterWriter is a utility class providing a convenient way to write data to an output filter (using Filter directly is not very intuitive). For example: .. code-block:: c++ StdFile outfile("file.dat", StdFile::e_write_mode); FilterWriter fwriter(outfile); fwriter.WriteBuffer(buf, buf_sz); fwriter.Flush(); """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): _PDFNetPython.FilterWriter_swiginit(self, _PDFNetPython.new_FilterWriter(args)) __swig_destroy__ = _PDFNetPython.delete_FilterWriter
[docs] def WriteUChar(self, ch): r""" Write a single character to the output stream. :type ch: UChar :param ch: An unsigned character to write to the output stream. """ return _PDFNetPython.FilterWriter_WriteUChar(self, ch)
[docs] def WriteInt16(self, num): r""" Write an integer to the output stream. :type num: int :param num: An integer to write to the output stream. """ return _PDFNetPython.FilterWriter_WriteInt16(self, num)
[docs] def WriteUInt16(self, num): return _PDFNetPython.FilterWriter_WriteUInt16(self, num)
[docs] def WriteInt32(self, num): return _PDFNetPython.FilterWriter_WriteInt32(self, num)
[docs] def WriteUInt32(self, num): return _PDFNetPython.FilterWriter_WriteUInt32(self, num)
[docs] def WriteInt64(self, num): return _PDFNetPython.FilterWriter_WriteInt64(self, num)
[docs] def WriteUInt64(self, num): return _PDFNetPython.FilterWriter_WriteUInt64(self, num)
[docs] def WriteString(self, args): r""" Overload 1: Write a string to the output stream. :type str: string :param str: A string to write to the output stream. | Overload 2: Write a null terminated string :type str: string :param str: A terminated string string to write to the output stream. """ return _PDFNetPython.FilterWriter_WriteString(self, args)
[docs] def WriteFilter(self, reader): r""" Write the entire input stream to the output stream (i.e. to this FilterWriter). :type reader: :py:class:`FilterReader` :param reader: A FilterReader attached to an input stream. """ return _PDFNetPython.FilterWriter_WriteFilter(self, reader)
[docs] def WriteLine(self, line, eol=0x0D): r""" Write out a null terminated 'line' followed by a end of line character default end of line character is carriage return. :type line: string :param line: string to write out. :type eol: char :param eol: end of line character. Defaults to carriage return (0x0D). """ return _PDFNetPython.FilterWriter_WriteLine(self, line, eol)
[docs] def WriteBuffer(self, buf): r""" :type buf: std::vector< unsigned char,std::allocator< unsigned char > > :param buf: buffer object to write out. :rtype: int :return: - returns the number of bytes actually written to a stream. This number may less than buf_size if the stream is corrupted. """ return _PDFNetPython.FilterWriter_WriteBuffer(self, buf)
[docs] def AttachFilter(self, filter): r""" Attaches a filter to the this FilterWriter. :type filter: :py:class:`Filter` :param filter: filter object to attach """ return _PDFNetPython.FilterWriter_AttachFilter(self, filter)
[docs] def GetAttachedFilter(self): r""" :rtype: :py:class:`Filter` :return: - The attached Filter or a NULL filter if no filter is attached. """ return _PDFNetPython.FilterWriter_GetAttachedFilter(self)
[docs] def Seek(self, offset, origin): r""" Sets the position within the current stream. :type offset: ptrdiff_t :param offset: - A byte offset relative to origin. If offset is negative, the new position will precede the position specified by origin by the number of bytes specified by offset. If offset is zero, the new position will be the position specified by origin. If offset is positive, the new position will follow the position specified by origin by the number of bytes specified by offset. :type origin: int :param origin: - A value of type ReferencePos indicating the reference point used to obtain the new position Notes: - After each Seek() operation the number of consumed bytes (i.e. Count()) is set to 0. :raises: - throws an exception if the method is not implemented in the associated filter. """ return _PDFNetPython.FilterWriter_Seek(self, offset, origin)
[docs] def Tell(self): r""" Reports the current read position in the stream relative to the stream origin. :rtype: ptrdiff_t :return: - The current position in the stream :raises: - throws an exception if the method is not implemented in the associated filter. """ return _PDFNetPython.FilterWriter_Tell(self)
[docs] def Count(self): r""" :rtype: int :return: - the number of bytes consumed since opening the filter or since the last Seek operation. """ return _PDFNetPython.FilterWriter_Count(self)
[docs] def Flush(self): r"""Forces any data remaining in the buffer to be written to input or output filter.""" return _PDFNetPython.FilterWriter_Flush(self)
[docs] def FlushAll(self): r"""Forces any data remaining in the filter chain to the source or destination.""" return _PDFNetPython.FilterWriter_FlushAll(self)
m_impl = property(_PDFNetPython.FilterWriter_m_impl_get, _PDFNetPython.FilterWriter_m_impl_set)
# Register FilterWriter in _PDFNetPython: _PDFNetPython.FilterWriter_swigregister(FilterWriter)
[docs] class FlateEncode(Filter): r""" FlateEncode filter can be used to compress any data stream using Flate (i.e. ZIP) compression method. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, input_filter, compression_level=-1, buf_sz=256): r""" Constructor for Flate encoder. :type input_filter: :py:class:`Filter` :param input_filter: the input data stream :type compression_level: int :param compression_level: must be a number between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time), -1 requests a default compromise between speed and compression (currently equivalent to level 6). :type buf_sz: int :param buf_sz: filter buffer size (in bytes). """ _PDFNetPython.FlateEncode_swiginit(self, _PDFNetPython.new_FlateEncode(input_filter, compression_level, buf_sz)) __swig_destroy__ = _PDFNetPython.delete_FlateEncode
# Register FlateEncode in _PDFNetPython: _PDFNetPython.FlateEncode_swigregister(FlateEncode)
[docs] class MappedFile(Filter): r""" MappedFile is a utility class to read files on a file system. Because MappedFile file is derived from pdftron.Filters.Filter you can directly chain MappedFile objects to other 'pdftron.Filters'. MappedFile objects support random access to files using the Seek method. Seek allows the read/write position to be moved to any position within the file. This is done through a shared memory mapped chunk manager. The byte offset is relative to the seek reference point, which can be the beginning, the current position, or the end of the underlying file, as represented by the three properties of the Filter.ReferencePos class. MappedFile objects are thread-safe, meaning separate copies of a MappedFile can Seek to different locations in the file, without conflicting with one another. Disk files always support random access. At the time ofruction, the CanSeek() property value is set to true or false depending on the underlying file type. Notes: .NET or Java applications should explicitly Close() files when they are not needed. If the files are not closed or disposed this may lead to the resource exhaustion. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, filename): r"""Create a new instance of MappedFile class with the specified path""" _PDFNetPython.MappedFile_swiginit(self, _PDFNetPython.new_MappedFile(filename)) def __eq__(self, f): r""" Check is the two MappedFile-s refer to the same file on disc. :rtype: boolean :return: true if the two files share the same filename, false otherwise. """ return _PDFNetPython.MappedFile___eq__(self, f)
[docs] @staticmethod def Equivalent(ph1, ph2): r""" Check is the two file paths are equivalent (i.e. they refer to the same file on disc. :rtype: boolean :return: true if the two files share the same filename, false otherwise. """ return _PDFNetPython.MappedFile_Equivalent(ph1, ph2)
[docs] def FileSize(self): r""" :rtype: int :return: the size of the current file. """ return _PDFNetPython.MappedFile_FileSize(self)
__swig_destroy__ = _PDFNetPython.delete_MappedFile
# Register MappedFile in _PDFNetPython: _PDFNetPython.MappedFile_swigregister(MappedFile)
[docs] def MappedFile_Equivalent(ph1, ph2): r""" Check is the two file paths are equivalent (i.e. they refer to the same file on disc. :rtype: boolean :return: true if the two files share the same filename, false otherwise. """ return _PDFNetPython.MappedFile_Equivalent(ph1, ph2)
[docs] class MemoryFilter(Filter): r""" MemoryFilter is a memory buffer that can be used as a source or a sink Filter in the Filter pipeline. When a MemoryFilter is the source, other filters can read data stored in memory; When MemoryFilter is a sink, other filters generate data which is then pushed in a memory buffer owned by MemoryFilter (MemoryFilter makes sure that there is enough space to accommodate all data). """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, buf_sz, is_input): _PDFNetPython.MemoryFilter_swiginit(self, _PDFNetPython.new_MemoryFilter(buf_sz, is_input))
[docs] def GetBuffer(self): r""" Notes: MemoryFilter specific function. :rtype: UChar :return: a pointer to the beginning of the buffer. Use method Count() to determine the number of bytes written to or read from MemoryFilter. """ return _PDFNetPython.MemoryFilter_GetBuffer(self)
[docs] def SetAsInputFilter(self): r""" Notes: MemoryFilter specific function used to change filter mode from output to input. The utility function is useful in cases when and output data buffer should be converted to an input stream. The function has no effect on an input MemoryFilter. """ return _PDFNetPython.MemoryFilter_SetAsInputFilter(self)
__swig_destroy__ = _PDFNetPython.delete_MemoryFilter
# Register MemoryFilter in _PDFNetPython: _PDFNetPython.MemoryFilter_swigregister(MemoryFilter)
[docs] class DictIterator(object): r""" DictIterator is used to traverse key/value pairs in a dictionary. For example a DictIterator can be used to print out all the entries in a given Obj dictionary as follows: .. code-block:: c++ DictIterator itr = dict.GetDictIterator(); while (itr.HasNext()) { Obj key = itr.Key(); cout < key.GetName() < endl; Obj value = itr.Value(); // ... itr.Next() } """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def Next(self): r"""Advances the iterator to the next element of the collection.""" return _PDFNetPython.DictIterator_Next(self)
[docs] def Key(self): r""" :rtype: :py:class:`Obj` :return: the key of the current dictionary entry. """ return _PDFNetPython.DictIterator_Key(self)
[docs] def Value(self): r""" :rtype: :py:class:`Obj` :return: the value of the current dictionary entry. """ return _PDFNetPython.DictIterator_Value(self)
[docs] def HasNext(self): r""" :rtype: boolean :return: true if the iterator can be successfully advanced to the next element; false if the end collection is reached. """ return _PDFNetPython.DictIterator_HasNext(self)
__swig_destroy__ = _PDFNetPython.delete_DictIterator
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.DictIterator_Destroy(self)
def __init__(self, args): _PDFNetPython.DictIterator_swiginit(self, _PDFNetPython.new_DictIterator(args)) mp_impl = property(_PDFNetPython.DictIterator_mp_impl_get, _PDFNetPython.DictIterator_mp_impl_set)
# Register DictIterator in _PDFNetPython: _PDFNetPython.DictIterator_swigregister(DictIterator)
[docs] class SDFDoc(object): r""" SDFDoc is a low-level document representing a graph of SDF::Obj nodes that can be used to build higher-level document models such as PDF (Portable Document Format) or FDF (Forms Document Format). SDFDoc brings together document security, document utility methods, and all SDF objects. A SDF document can be created from scratch using a defaultructor: SDFDoc mydoc; Obj trailer = mydoc.GetTrailer(); SDF document can be also created from an existing file (e.g. an external PDF document): .. code-block:: c++ SDFDoc mydoc("in.pdf"); Obj trailer = mydoc.GetTrailer(); or from a memory buffer or some other Filter/Stream such as a HTTP Filter connection: .. code-block:: c++ MemoryFilter memory = .... SDFDoc mydoc(memory); Obj trailer = mydoc.GetTrailer(); Finally SDF document can be accessed from a high-level PDF document as follows: .. code-block:: c++ PDFDoc doc("in.pdf"); SDFDoc mydoc = doc.GetSDFDoc(); Obj trailer = mydoc.GetTrailer(); Note that the examples above used doc.GetTrailer() in order to access document trailer, the starting SDF object (root node) in every document. Following the trailer links, it is possible to visit all low-level objects in a document (e.g. all pages, outlines, fonts, etc). SDFDoc also provides utility methods used to import objects and object collections from one document to another. These methods can be useful for copy operations between documents such as a high-level page merge and document assembly. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_SDFDoc
[docs] def Close(self): r""" Close SDFDoc""" return _PDFNetPython.SDFDoc_Close(self)
[docs] def IsEncrypted(self): r""" :rtype: boolean :return: true if the document is/was originally encrypted false otherwise. """ return _PDFNetPython.SDFDoc_IsEncrypted(self)
[docs] def InitSecurityHandler(self): r""" Initializes document's SecurityHandler. This version of InitSecurityHandler() works with Standard and Custom PDF security and can be used in situations where the password is obtained dynamically via user feedback. See EncTest sample for example code. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized it can be later obtained using GetSecurityHandler() method. :raises: An exception is thrown if the matching handler for document's security was not found in the global SecurityManager. In this case, you need to register additional custom security handlers with the global SecurityManager (using SecurityManagerSingleton). :rtype: boolean :return: true if the SecurityHandler was successfully initialized (this may include authentication data collection, verification etc.), false otherwise. :param custom_data: An optional parameter used to specify custom data that should be passed in SecurityHandler::Initialize() callback. """ return _PDFNetPython.SDFDoc_InitSecurityHandler(self)
[docs] def InitStdSecurityHandler(self, args): r""" Overload 1: Initializes document's SecurityHandler using the supplied password. This version of InitSecurityHandler() assumes that document uses Standard security and that a password is specified directly. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized, it can be later obtained using GetSecurityHandler() method. :rtype: boolean :return: true if the given password successfully unlocked the document, false otherwise. :raises: An exception is thrown if the document's security Filter is not 'Standard'. In this case, you need to register additional custom security handlers with the global SecurityManager (SecurityManagerSingleton). :type password: string :param password: Specifies the password used to open the document without any user feedback. If you would like to dynamically obtain the password, you need to derive a custom class from StdSecurityHandler() and use InitSecurityHandler() without any parameters. See EncTest sample for example code. :type password_sz: int :param password_sz: An optional parameter used to specify the size of the password buffer, in bytes. If the 'password_sz' is 0, or if the parameter is not specified, the function assumes that the string is null terminated. Remarks: Deprecated. Use versions that accepts UString or buffer instead. | Overload 2: Initializes document's SecurityHandler using the supplied password. This version of InitSecurityHandler() assumes that document uses Standard security and that a password is specified directly. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized, it can be later obtained using GetSecurityHandler() method. :type password: string :param password: Specifies the password used to open the document without any user feedback. If you would like to dynamically obtain the password, you need to derive a custom class from StdSecurityHandler() and use InitSecurityHandler() without any parameters. See EncTest sample for example code. :rtype: boolean :return: true if the given password successfully unlocked the document, false otherwise. :raises: An exception is thrown if the document's security Filter is not 'Standard'. In this case, you need to register additional custom security handlers with the global SecurityManager (SecurityManagerSingleton). | Overload 3: Initializes document's SecurityHandler using the supplied password. This version of InitSecurityHandler() assumes that document uses Standard security and that a password is specified directly. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized, it can be later obtained using GetSecurityHandler() method. :type password_buf: std::vector< int,std::allocator< int > > :param password_buf: Specifies the password used to open the document without any user feedback. If you would like to dynamically obtain the password, you need to derive a custom class from StdSecurityHandler() and use InitSecurityHandler() without any parameters. See EncTest sample for example code. :rtype: boolean :return: true if the given password successfully unlocked the document, false otherwise. :raises: An exception is thrown if the document's security Filter is not 'Standard'. In this case, you need to register additional custom security handlers with the global SecurityManager (SecurityManagerSingleton). """ return _PDFNetPython.SDFDoc_InitStdSecurityHandler(self, args)
[docs] def IsModified(self): r""" :rtype: boolean :return: - true if document was modified, false otherwise """ return _PDFNetPython.SDFDoc_IsModified(self)
[docs] def HasRepairedXRef(self): r""" Checks whether or not the underlying file has an XRef table that had to be repaired when the file was opened. If the document had an invalid XRef table when opened, PDFNet will have repaired the XRef table for its working representation of the document. :rtype: boolean :return: - true if document was found to be corrupted, and was repaired, during opening and has not been saved since. Notes: - If this function returns true, it is not possible to incrementally save the document (see http://www.pdftron.com/kb_corrupt_xref) """ return _PDFNetPython.SDFDoc_HasRepairedXRef(self)
[docs] def IsFullSaveRequired(self): r""" :rtype: boolean :return: - true if the document requires full save. """ return _PDFNetPython.SDFDoc_IsFullSaveRequired(self)
[docs] def GetTrailer(self): r""" :rtype: :py:class:`Obj` :return: - A dictionary representing the root of the document (i.e. a document trailer dictionary) """ return _PDFNetPython.SDFDoc_GetTrailer(self)
[docs] def GetObj(self, obj_num): r""" :type obj_num: int :param obj_num: - object number of the object to retrieve. :rtype: :py:class:`Obj` :return: - the latest version of the object matching specified object number. :raises: - exception is thrown if the object is not found. """ return _PDFNetPython.SDFDoc_GetObj(self, obj_num)
[docs] def ImportObj(self, obj, deep_copy): r""" :type obj: :py:class:`Obj` :param obj: - an object to import. :type deep_copy: boolean :param deep_copy: - a boolean indicating whether to perform a deep or shallow copy. In case of shallow copy all indirect references will be set to null. If the object belongs to a document the function will perform deep or shallow clone depending whether deep_copy flag was specified. If the object does not belong to any document ImportObj does not take the object ownership. ImportObj copies the source object and it is users responsibility to delete free objects. :rtype: :py:class:`Obj` :return: - a pointer to the root indirect object in this document """ return _PDFNetPython.SDFDoc_ImportObj(self, obj, deep_copy)
[docs] def ImportObjs(self, args): r""" Overload 1: The function performs a deep copy of all objects specified in the 'obj_list'. If objects in the list are directly or indirectly referring to the same object/s, only one copy of the shared object/s will be copied. Therefore, unlike repeated calls to ImportObj, this method will import only one copy of shared objects (objects representing an intersection of graphs specified through 'obj_list' of root pointers. Notes: - All object in the import list must belong to the same source document. - The function does not perform the shallow copy since ImportObj() can be used instead. :type obj_list: std::vector< SDF::Obj,std::allocator< SDF::Obj > > :param obj_list: - a list of root objects to import. All directly or indirectly objects will be imported as well. :rtype: std::vector< SDF::Obj,std::allocator< SDF::Obj > > :return: - a list of imported root objects in this document. | Overload 2: The function performs a deep copy of all objects specified in the 'obj_list'. If objects in the list are directly or indirectly referring to the same object/s, only one copy of the shared object/s will be copied. Therefore, unlike repeated calls to ImportObj, this method will import only one copy of shared objects (objects representing an intersection of graphs specified through 'obj_list' of root pointers. Notes: - All object in the import list must belong to the same source document. - The function does not perform the shallow copy since ImportObj() can be used instead. :type obj_list: std::vector< SDF::Obj,std::allocator< SDF::Obj > > :param obj_list: - a list of root objects to import. All directly or indirectly objects will be imported as well. :type exclude_list: std::vector< SDF::Obj,std::allocator< SDF::Obj > > :param exclude_list: - a list of objects to not include in the deep copy. :rtype: std::vector< SDF::Obj,std::allocator< SDF::Obj > > :return: - a list of imported root objects in this document. """ return _PDFNetPython.SDFDoc_ImportObjs(self, args)
[docs] def XRefSize(self): r""" :rtype: int :return: - The size of cross reference table """ return _PDFNetPython.SDFDoc_XRefSize(self)
[docs] def ClearMarks(self): r"""Removes 'marked' flag from all objects in cross reference table.""" return _PDFNetPython.SDFDoc_ClearMarks(self)
e_incremental = _PDFNetPython.SDFDoc_e_incremental e_remove_unused = _PDFNetPython.SDFDoc_e_remove_unused e_hex_strings = _PDFNetPython.SDFDoc_e_hex_strings e_omit_xref = _PDFNetPython.SDFDoc_e_omit_xref e_linearized = _PDFNetPython.SDFDoc_e_linearized e_compatibility = _PDFNetPython.SDFDoc_e_compatibility
[docs] def Save(self, args): r""" Overload 1: Saves the document to a file. If a full save is requested to the original path, the file is saved to a file system-determined temporary file, the old file is deleted, and the temporary file is renamed to path. A full save with remove unused or linearization option may re-arrange object in the cross reference table. Therefore all pointers and references to document objects and resources should be re acquired in order to continue document editing. In order to use incremental save the specified path must match original path and e_incremental flag bit should be set. :type path: string :param path: - The full path name to which the file is saved. :type flags: int :param flags: - A bit field composed of an OR of the SDFDoc::SaveOptions values. :type header: string :param header: - File header. A new file header is set only during full save. :raises: - if the file can't be opened for saving or if there is a problem during Save an Exception object will be thrown. Notes: - Save will modify the SDFDoc object's internal representation. As such, the user should acquire a write lock before calling save. | Overload 2: Saves the document to a memory buffer. :type flags: int :param flags: - A bit field composed of an OR of the SDFDoc::SaveOptions values. Note that this method ignores e_incremental flag. :type header: string :param header: - File header. A new file header is set only during full save. :rtype: std::vector< unsigned char,std::allocator< unsigned char > > :return: the buffer containing the serialized version of the document. :raises: - if there is a problem during Save an Exception object will be thrown. Notes: - Save will modify the SDFDoc object's internal representation. As such, the user should acquire a write lock before calling save. | Overload 3: Saves the document to a stream. :type stream: :py:class:`Filter` :param stream: The output stream where to write data. :type flags: int :param flags: - A bit field composed of an OR of the SDFDoc::SaveOptions values. :type header: string :param header: - File header. A new file header is set only during full save. See also GetHeader() :raises: - if there is a problem during Save an Exception object will be thrown. Notes: - Save will modify the SDFDoc object's internal representation. As such, the user should acquire a write lock before calling save. """ return _PDFNetPython.SDFDoc_Save(self, args)
[docs] def GetHeader(self): r""" :rtype: string :return: the header string identifying the document version to which the file conforms. For a file conforming to PDF version 1.4, the header should be %PDF-1.4. In general header strings have the following syntax: %AAA-N.n where AAA identifies document specification (such as PDF, FDF, PJTF etc), N is the major version and n is the minor version. The new header string can be set during a full save (see SDFDoc::Save()). For a document that is not serialized the function returns an empty string. """ return _PDFNetPython.SDFDoc_GetHeader(self)
[docs] def GetSecurityHandler(self): r""" :rtype: :py:class:`SecurityHandler` :return: Currently selected SecurityHandler. Notes: InitSecurityHandler() should be called before GetSecurityHandler() in order to initialize the handler. Returned security handler can be modified in order to change the security settings of the existing document. Changes to the current handler will not invalidate the access to the original file and will take effect during document Save(). If the security handler is modified, document will perform a full save even if e_incremental was given as a flag in Save() method. """ return _PDFNetPython.SDFDoc_GetSecurityHandler(self)
[docs] def SetSecurityHandler(self, handler): r""" The function sets a new SecurityHandler as the current security handler. :type handler: :py:class:`SecurityHandler` :param handler: - new SecurityHandler Notes: Setting a new security handler will not invalidate the access to the original file and will take effect during document Save(). If the security handler is modified, document will perform a full save even if e_incremental was given as a flag in Save() method. """ return _PDFNetPython.SDFDoc_SetSecurityHandler(self, handler)
[docs] def RemoveSecurity(self): r"""This function removes document security.""" return _PDFNetPython.SDFDoc_RemoveSecurity(self)
[docs] def Swap(self, obj_num1, obj_num2): r""" Sometimes it is desirable to modify all indirect references to a given indirect object. It would be inefficient to manually search for all indirect references to a given indirect object. A more efficient and less error prone method is to replace the indirect object in the cross reference table with a new object. This way the object that is referred to is modified (or replaced) and indirect references do not have to be changed. :type obj_num1: int :param obj_num1: - object number of first object to be swapped. :type obj_num2: int :param obj_num2: - object number of second object to be swapped. :raises: the function throws exception in case the swap can't be performed. """ return _PDFNetPython.SDFDoc_Swap(self, obj_num1, obj_num2)
[docs] def CreateIndirectName(self, name): r""" Used to create SDF/Cos indirect object. Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects they can be shared). :type name: string :param name: - indirectchar object to create. Notes: In C++ doc.CreateIndirect???(...) is equivalent to ???::CreateIndirect(...). """ return _PDFNetPython.SDFDoc_CreateIndirectName(self, name)
[docs] def CreateIndirectArray(self): r""" Used to create SDF/Cos indirect object. Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects they can be shared). Notes: In C++ doc.CreateIndirect???(...) is equivalent to ???::CreateIndirect(...). """ return _PDFNetPython.SDFDoc_CreateIndirectArray(self)
[docs] def CreateIndirectBool(self, value): r""" Used to create SDF/Cos indirect object. Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects they can be shared). :type value: boolean :param value: - indirect boolean to create. Notes: In C++ doc.CreateIndirect???(...) is equivalent to ???::CreateIndirect(...). """ return _PDFNetPython.SDFDoc_CreateIndirectBool(self, value)
[docs] def CreateIndirectDict(self): return _PDFNetPython.SDFDoc_CreateIndirectDict(self)
[docs] def CreateIndirectNull(self): return _PDFNetPython.SDFDoc_CreateIndirectNull(self)
[docs] def CreateIndirectNumber(self, value): return _PDFNetPython.SDFDoc_CreateIndirectNumber(self, value)
[docs] def CreateIndirectString(self, args): return _PDFNetPython.SDFDoc_CreateIndirectString(self, args)
[docs] def CreateIndirectStream(self, args): return _PDFNetPython.SDFDoc_CreateIndirectStream(self, args)
[docs] def IsLinearized(self): r""" Call this function to determine whether the document is represented in linearized (fast web view) format. :rtype: boolean :return: - true if document is stored in fast web view format, false otherwise. Notes: any changes to the document can invalidate linearization. The function will return 'true' only if the original document is linearized and if it is not modified. In order to provide good performance over relatively slow communication links, PDFNet can generate PDF documents with linearized objects and hint tables that can allow a PDF viewer application to download and view one page of a PDF file at a time, rather than requiring the entire file (including fonts and images) to be downloaded before any of it can be viewed. To save a document in linearized (fast web view) format you only need to pass 'SDFDoc.SaveOptions.e_linearized' flag in the Save method. """ return _PDFNetPython.SDFDoc_IsLinearized(self)
[docs] def GetLinearizationDict(self): r""" Returns document's initial linearization dictionary if it is available. :rtype: :py:class:`Obj` :return: - the linearization dictionary of the original document or NULL if the dictionary is not available. """ return _PDFNetPython.SDFDoc_GetLinearizationDict(self)
[docs] def GetHintStream(self): r""" Returns document's initial linearization hint stream if it is available. :rtype: :py:class:`Obj` :return: - the linearization hint stream of the original document or NULL if the hint stream is not available. """ return _PDFNetPython.SDFDoc_GetHintStream(self)
[docs] def Lock(self): r""" Locks the document to prevent competing threads from accessing the document at the same time. Threads attempting to access the document will wait in suspended state until the thread that owns the lock calls doc.Unlock(). """ return _PDFNetPython.SDFDoc_Lock(self)
[docs] def Unlock(self): r"""Removes the lock from the document.""" return _PDFNetPython.SDFDoc_Unlock(self)
[docs] def TryLock(self, milliseconds=0): r""" Try locking the document, waiting no longer than specified number of milliseconds. :type milliseconds: int :param milliseconds: - max number of milliseconds to wait for the document to lock :rtype: boolean :return: true if the document is locked for multi-threaded access, false otherwise. """ return _PDFNetPython.SDFDoc_TryLock(self, milliseconds)
[docs] def LockRead(self): r""" Locks the document to prevent competing write threads (using Lock()) from accessing the document at the same time. Other reader threads however, will be allowed to access the document. Threads attempting to obtain write access to the document will wait in suspended state until the thread that owns the lock calls doc.UnlockRead(). Note: To avoid deadlocks obtaining a write lock while holding a read lock is not permitted and will throw an exception. If this situation is encountered please either unlock the read lock before the write lock is obtained or acquire a write lock (rather than read lock) in the first place. """ return _PDFNetPython.SDFDoc_LockRead(self)
[docs] def UnlockRead(self): r"""Removes the lock from the document.""" return _PDFNetPython.SDFDoc_UnlockRead(self)
[docs] def TryLockRead(self, milliseconds=0): r""" Try locking the document, waiting no longer than specified number of milliseconds. :type milliseconds: int :param milliseconds: - max number of milliseconds to wait for the document to lock :rtype: boolean :return: true if the document is locked for multi-threaded access, false otherwise. """ return _PDFNetPython.SDFDoc_TryLockRead(self, milliseconds)
[docs] def GetFileName(self): r""" :rtype: string :return: The filename of the document if the document is loaded from disk, or empty string if the document is not yet saved or is loaded from a memory buffer. """ return _PDFNetPython.SDFDoc_GetFileName(self)
[docs] def EnableDiskCaching(self, use_cache_flag): r""" A document uses a temporary file which is used to cache the contents of any new stream object created in the document (that is the default behavior). :type use_cache_flag: boolean :param use_cache_flag: - true to enable caching, false to disable caching. Use this function to enable or disable this feature dynamically. """ return _PDFNetPython.SDFDoc_EnableDiskCaching(self, use_cache_flag)
[docs] @staticmethod def CreateInternal(impl): return _PDFNetPython.SDFDoc_CreateInternal(impl)
[docs] def GetHandleInternal(self): return _PDFNetPython.SDFDoc_GetHandleInternal(self)
def __init__(self, args): _PDFNetPython.SDFDoc_swiginit(self, _PDFNetPython.new_SDFDoc(args)) mp_doc = property(_PDFNetPython.SDFDoc_mp_doc_get, _PDFNetPython.SDFDoc_mp_doc_set)
# Register SDFDoc in _PDFNetPython: _PDFNetPython.SDFDoc_swigregister(SDFDoc)
[docs] def SDFDoc_CreateInternal(impl): return _PDFNetPython.SDFDoc_CreateInternal(impl)
[docs] class NameTree(object): r""" A NameTree is a common data structure in PDF. See section 3.8.5 'Name Trees' in PDF Reference Manual for more details. A name tree serves a similar purpose to a dictionary - associating keys and values - but by different means. NameTrees allow efficient storage of very large association collections (string/Obj maps). A NameTree can have many more entries than a SDF/Cos dictionary can. NameTree-s use SDF/Cos-style strings (not null-terminated C strings), which may use Unicode encoding etc. .. code-block:: c++ PDFDoc doc("../Data/PDFReference.pdf"); NameTree dests = NameTree::Find(doc.GetSDFDoc(), "Dests"); if (dests.IsValid()) { // Traversing the NameTree UString key; for (DictIterator i = dests.GetIterator(); i.HasNext(); i.Next()) i.Key().GetAsPDFText(key); // ... } """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, name): r""" Retrieves the NameTree inside the '/Root/Names' dictionary with the specified key name, or creates it if it does not exist. :type doc: :py:class:`SDFDoc` :param doc: - The document in which the name tree is created. :type name: string :param name: - The name of the NameTree to create. :rtype: :py:class:`NameTree` :return: The newly created NameTree for the doc or an existing tree with the same key name. Notes: although it is possible to create a name tree anywhere in the document the convention is that all trees are located under '/Root/Names' dictionary. """ return _PDFNetPython.NameTree_Create(doc, name)
[docs] @staticmethod def Find(doc, name): r""" Retrieves a name tree, with the given key name, from the '/Root/Names' dictionary of the doc. :type doc: :py:class:`SDFDoc` :param doc: - The document in which to search for the name. :type name: string :param name: - The name of the name tree to find. :rtype: :py:class:`NameTree` :return: The requested NameTree. If the requested NameTree exists NameTree.IsValid() will return true, and false otherwise. """ return _PDFNetPython.NameTree_Find(doc, name)
def __init__(self, args): r""" Overload 1: Create a high level NameTree wrapper around an existing SDF/Cos NameTree. This does not copy the object. :type name_tree: :py:class:`Obj` :param name_tree: SDF/Cos root of the NameTree object. | Overload 2: Copyructor """ _PDFNetPython.NameTree_swiginit(self, _PDFNetPython.new_NameTree(args))
[docs] def IsValid(self): r""" :rtype: boolean :return: whether this is a valid (non-null) NameTree. If the function returns false the underlying SDF/Cos object is null and the NameTree object should be treated as null as well. """ return _PDFNetPython.NameTree_IsValid(self)
[docs] def GetIterator(self, args): r""" Overload 1: Search for the specified key in the NameTree. :rtype: :py:class:`NameTreeIterator` :return: If the key is present the function returns a NameTreeIterator the points to the given Key/Value pair. If the key is not found the function returns End() (a non-valid) iterator. :type key: UChar :param key: data buffer representing the key to be found. :type key_sz: int :param key_sz: The size (in bytes) of the key. .. code-block:: c++ DictIterator i = dests.Find("MyKey", 5); if (i.HasNext()) { UString key; i.GetKey().GetAsPDFText(key); // ... cout < "Value: " < i.GetValue().GetType() < endl; } | Overload 2: :rtype: :py:class:`NameTreeIterator` :return: an iterator that addresses the first element in the NameTree. The iterator can be used to traverse all entries stored in the NameTree. .. code-block:: c++ UString key; for (NameTreeIterator i = dests.GetIterator(); i.HasNext(); i.Next()) { i.GetKey().GetAsPDFText(key); // ... } """ return _PDFNetPython.NameTree_GetIterator(self, args)
[docs] def GetValue(self, key, key_sz): r""" Search the NameTree for a given key. :type key: UChar :param key: - a key to search for in the dictionary :type key_sz: int :param key_sz: - the buffer size used to store the key. :rtype: :py:class:`Obj` :return: null if the tree does not contain the specified key, otherwise return the corresponding value. """ return _PDFNetPython.NameTree_GetValue(self, key, key_sz)
[docs] def Put(self, key, key_sz, value): r""" Puts a new entry in the name tree. If an entry with this key is already in the tree, it is replaced. :type key: UChar :param key: data buffer representing the key of the new entry. :type key_sz: int :param key_sz: The size (in bytes) of the key. :type value: :py:class:`Obj` :param value: the value associated with the key. It can be any SDF::Obj. """ return _PDFNetPython.NameTree_Put(self, key, key_sz, value)
[docs] def Erase(self, args): r""" Overload 1: Removes the specified object from the tree. Does nothing if no object with that name exists. :type key: UChar :param key: data buffer representing the key of the entry to be removed. :type key_sz: int :param key_sz: The size (in bytes) of the key. | Overload 2: Removes the NameTree entry pointed by the iterator. :type pos: :py:class:`DictIterator` :param pos: ditionary iterator object that points to the NameTree entry to be removed. """ return _PDFNetPython.NameTree_Erase(self, args)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: the object to the underlying SDF/Cos object. If the NameTree.IsValid() returns false the SDF/Cos object is NULL. """ return _PDFNetPython.NameTree_GetSDFObj(self)
__swig_destroy__ = _PDFNetPython.delete_NameTree
# Register NameTree in _PDFNetPython: _PDFNetPython.NameTree_swigregister(NameTree)
[docs] def NameTree_Create(doc, name): r""" Retrieves the NameTree inside the '/Root/Names' dictionary with the specified key name, or creates it if it does not exist. :type doc: :py:class:`SDFDoc` :param doc: - The document in which the name tree is created. :type name: string :param name: - The name of the NameTree to create. :rtype: :py:class:`NameTree` :return: The newly created NameTree for the doc or an existing tree with the same key name. Notes: although it is possible to create a name tree anywhere in the document the convention is that all trees are located under '/Root/Names' dictionary. """ return _PDFNetPython.NameTree_Create(doc, name)
[docs] def NameTree_Find(doc, name): r""" Retrieves a name tree, with the given key name, from the '/Root/Names' dictionary of the doc. :type doc: :py:class:`SDFDoc` :param doc: - The document in which to search for the name. :type name: string :param name: - The name of the name tree to find. :rtype: :py:class:`NameTree` :return: The requested NameTree. If the requested NameTree exists NameTree.IsValid() will return true, and false otherwise. """ return _PDFNetPython.NameTree_Find(doc, name)
[docs] class NumberTree(object): r""" A NumberTree is a common data structure in PDF. See section 3.8.6 'Number Trees' in PDF Reference Manual for more details. A number tree serves a similar purpose to a dictionary - associating keys and values - but by different means. NumberTrees allow efficient storage of very large association collections (number/Obj maps). A NumberTree can have many more entries than a SDF/Cos dictionary can. Sample code: .. code-block:: c++ PDFDoc doc("../Data/test.pdf"); NumberTree labels(doc.GetRoot().Get("PageLabels").Value()); if (labels.IsValid()) { // Traversing the NumberTree for (NumberTreeIterator i = labels.GetIterator(); i.HasNext(); i.Next()) cout < "Key: " < i.Key().GetNumber() < endl; } """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): r""" Overload 1: Create a high level NumberTree wrapper around an existing SDF/Cos NumberTree. This does not copy the object. :type number_tree: :py:class:`Obj` :param number_tree: SDF/Cos root of the NumberTree object. | Overload 2: Copyructor """ _PDFNetPython.NumberTree_swiginit(self, _PDFNetPython.new_NumberTree(args))
[docs] def IsValid(self): r""" :rtype: boolean :return: whether this is a valid (non-null) NumberTree. If the function returns false the underlying SDF/Cos object is null and the NumberTree object should be treated as null as well. """ return _PDFNetPython.NumberTree_IsValid(self)
[docs] def GetIterator(self, args): r""" Overload 1: Search for the specified key in the NumberTree. :rtype: :py:class:`NumberTreeIterator` :return: If the key is present the function returns a NumberTreeIterator the points to the given Key/Value pair. If the key is not found the function returns End() (a non-valid) iterator. :type key: int :param key: the number representing the key to be found. Sample code: NumberTreeIterator i = dests.Find(5); if (i.HasNext()) { cout << "Key: " << i.GetKey()->GetNumber() << endl; cout << "Value: " << i.GetValue()->GetType() << endl; } | Overload 2: :rtype: :py:class:`NumberTreeIterator` :return: an iterator to the first key/value pair (i.e. NNTreeData) in the document. You can use the Next method on the returned iterator to traverse all entries stored under the NumberTree. Sample code: for (NumberTreeIterator i = dests.GetIterator(); i.HasNext(); i.Next()) cout << "Key: " << i.GetKey().GetNumber() << endl; """ return _PDFNetPython.NumberTree_GetIterator(self, args)
[docs] def GetValue(self, key): return _PDFNetPython.NumberTree_GetValue(self, key)
[docs] def Put(self, key, value): r""" Puts a new entry in the name tree. If an entry with this number is already in the tree, it is replaced. :type key: int :param key: A number representing the key of the new entry. :type value: :py:class:`Obj` :param value: the value associated with the key. It can be any SDF::Obj. """ return _PDFNetPython.NumberTree_Put(self, key, value)
[docs] def Erase(self, args): r""" Overload 1: Removes the specified object from the tree. Does nothing if no object with that number exists. :type key: int :param key: A number representing the key of the entry to be removed. | Overload 2: Removes the NumberTree entry pointed by the iterator. :type pos: :py:class:`DictIterator` :param pos: dictionary iterator object that points to the NumberTree entry to be removed """ return _PDFNetPython.NumberTree_Erase(self, args)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: the object to the underlying SDF/Cos object. If the NumberTree.IsValid() returns false the SDF/Cos object is NULL. """ return _PDFNetPython.NumberTree_GetSDFObj(self)
__swig_destroy__ = _PDFNetPython.delete_NumberTree
# Register NumberTree in _PDFNetPython: _PDFNetPython.NumberTree_swigregister(NumberTree)
[docs] class Obj(object): r""" Obj is a concrete class for all SDF/Cos objects. Obj hierarchy implements the composite design pattern. As a result, you can invoke a member function of any 'derived' object through Obj interface. If the member function is not supported (e.g. if you invoke Obj::GetNumber() on a boolean object) an Exception will be thrown. You can use GetType() or obl.Is???() member functions to find out type-information at run time, however most of the time the type can be inferred from the PDF specification. Therefore when you call Doc::GetTrailer() you can assume that returned object is a dictionary. If there is any ambiguity use Is???() methods. Objects can't be shared across documents, however you can use Doc::ImportObj() to copy objects from one document to another. Objects can be shared within a document provided that they are created as indirect. Indirect objects are the ones that are referenced in cross-reference table. To create an object as indirect use doc.CreateIndirect???() (where ? is the Object type). """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_null = _PDFNetPython.Obj_e_null e_bool = _PDFNetPython.Obj_e_bool e_number = _PDFNetPython.Obj_e_number e_name = _PDFNetPython.Obj_e_name e_string = _PDFNetPython.Obj_e_string e_dict = _PDFNetPython.Obj_e_dict e_array = _PDFNetPython.Obj_e_array e_stream = _PDFNetPython.Obj_e_stream
[docs] def GetType(self): r""" :rtype: int :return: the object type. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_GetType(self)
[docs] def IsBool(self): r""" :rtype: boolean :return: true if this is a Bool object, false otherwise. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_IsBool(self)
[docs] def IsNumber(self): r""" :rtype: boolean :return: true if this is a Number object, false otherwise. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_IsNumber(self)
[docs] def IsNull(self): r""" :rtype: boolean :return: true if this is a Null object, false otherwise. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_IsNull(self)
[docs] def IsString(self): r""" :rtype: boolean :return: true if this is a Str (String) object, false otherwise. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_IsString(self)
[docs] def IsName(self): r""" :rtype: boolean :return: true if this is Name, false otherwise. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_IsName(self)
[docs] def IsIndirect(self): r""" :rtype: boolean :return: true if this is Indirect object (i.e. object referenced in the cross-reference table), false otherwise. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_IsIndirect(self)
[docs] def IsContainer(self): r""" :rtype: boolean :return: true if this is a Container (a dictionary, array, or a stream), false otherwise. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_IsContainer(self)
[docs] def IsDict(self): r""" :rtype: boolean :return: true if this is a dictionary (i.e. Dict), false otherwise. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_IsDict(self)
[docs] def IsArray(self): r""" :rtype: boolean :return: true if this is an Array, false otherwise. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_IsArray(self)
[docs] def IsStream(self): r""" :rtype: boolean :return: true if this is a Stream, false otherwise. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_IsStream(self)
[docs] def GetDoc(self): r""" :rtype: :py:class:`SDFDoc` :return: the document to which this object belongs. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_GetDoc(self)
[docs] def Write(self, stream): r""" The function writes the Obj to the output stream :type stream: :py:class:`FilterWriter` :param stream: - the input stream where the Obj will be written Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_Write(self, stream)
[docs] def Size(self): r""" :rtype: int :return: the 'size' of the object. The definition of 'size' depends on the object type. In particular: - For a dictionary or a stream object, the method will return the number of key/value pairs in the dictionary. - For an array object the method will return the number of Obj entries in the array. - For a string object the method will return the number of bytes in the string buffer. - For any other object the method will always return 1. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_Size(self)
[docs] def GetObjNum(self): r""" :rtype: int :return: object number. If this is not an Indirect object, object number of a containing indirect object is returned. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_GetObjNum(self)
[docs] def GetGenNum(self): r""" :rtype: int :return: generation number. If this is not an Indirect object, generation number of a containing indirect object is returned. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_GetGenNum(self)
[docs] def GetOffset(self): r""" :rtype: int :return: object offset from the beginning of the file. If this is not an Indirect object, offset of a containing indirect object is returned. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_GetOffset(self)
[docs] def IsFree(self): r""" :rtype: boolean :return: true if the object is in use or is marked as free. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_IsFree(self)
[docs] def SetMark(self, mark): r""" Set the object mark. Mark is a boolean value that can be associated with every indirect object. This is especially useful when an object graph should be traversed and an operation should be performed on each node only once. :type mark: boolean :param mark: boolean value that the object's mark should be set to. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_SetMark(self, mark)
[docs] def IsMarked(self): r""" :rtype: boolean :return: true if the object is marked. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_IsMarked(self)
[docs] def IsLoaded(self): r""" :rtype: boolean :return: true if the object is loaded in memory. Notes: this method can be invoked on any Obj. """ return _PDFNetPython.Obj_IsLoaded(self)
[docs] def IsValid(self): r""" :rtype: boolean :return: true if this is a valid object, false otherwise. If the function returns false then the underlying SDF/Cos object is null or is not valid. """ return _PDFNetPython.Obj_IsValid(self)
[docs] def GetBool(self): r""" :rtype: boolean :return: bool value if this is Bool. :raises: Exception is thrown if the object is not Obj::Type::e_bool """ return _PDFNetPython.Obj_GetBool(self)
[docs] def SetBool(self, b): r""" :type b: boolean :param b: - bool value used to set Bool object. :raises: An Exception is thrown if this is not a Obj::Type::e_bool """ return _PDFNetPython.Obj_SetBool(self, b)
[docs] def GetNumber(self): r""" :rtype: double :return: value, if this is Number. :raises: An Exception is thrown if the object is not a Obj::Type::e_number """ return _PDFNetPython.Obj_GetNumber(self)
[docs] def SetNumber(self, n): r""" :type n: double :param n: - value used to set Number object. :raises: An Exception is thrown if this is not a Obj::Type::e_number """ return _PDFNetPython.Obj_SetNumber(self, n)
[docs] def GetBuffer(self): r""" :rtype: std::vector< unsigned char,std::allocator< unsigned char > > :return: a pointer to the string buffer. Please note that the string may not be NULL terminated and that it may not be represented in ASCII or Unicode encoding. For more information on SDF/Cos String objects, please refer to section 3.2.3 'String Objects' in PDF Reference Manual. Notes: if SDF/Cos String object is represented as 'PDF Text' (Section 3.8.1 'Text Strings' in PDF Reference) you can use GetAsPDFText method to obtain Unicode representation of the string. use Size() member function in order to obtain the number of bytes in string buffer. :raises: Exception is thrown if this is not a Obj::Type::e_string. """ return _PDFNetPython.Obj_GetBuffer(self)
[docs] def GetRawBuffer(self): r""" :rtype: std::vector< unsigned char,std::allocator< unsigned char > > :return: a vector containing the encrypted string buffer. Notes: Similar in behaviour to GetBuffer except that no decryption is done. If the file is not encrypted the result should be the same as GetBuffer :raises: Exception is thrown if this is not a Obj::Type::e_string. """ return _PDFNetPython.Obj_GetRawBuffer(self)
[docs] def GetAsPDFText(self): r""" Convert the SDF/Cos String object to 'PDF Text String' (a Unicode string). PDF Text Strings are not used to represent page content, however they are used in text annotations, bookmark names, article names, document information etc. These strings are encoded in either PDFDocEncoding or Unicode character encoding. For more information on PDF Text Strings, please refer to section 3.8.1 'Text Strings' in PDF Reference. Notes: Not all SDF/Cos String objects are used to represent 'PDF Text'. PDF Reference indicates (on a case by case basis ) where an SDF/Cos String object can be used as 'PDF Text'. :raises: An Exception is thrown if this is not a Obj::Type::e_string. """ return _PDFNetPython.Obj_GetAsPDFText(self)
[docs] def SetString(self, args): r""" Overload 1: Sets the string object value. :type value: UChar :param value: - character buffer. :type size: int :param size: - the size of character buffer. :raises: An Exception is thrown if this is not a Obj::Type::e_string | Overload 2: Sets the string object value. :type str: string :param str: - A Unicode string value. :raises: An Exception is thrown if this is not a Obj::Type::e_string """ return _PDFNetPython.Obj_SetString(self, args)
[docs] def GetName(self): r""" :rtype: string :return: string representing the Name object. :raises: An Exception is thrown if this is not a Obj::Type::e_name """ return _PDFNetPython.Obj_GetName(self)
[docs] def SetName(self, name): r""" :type name: string :param name: - value used to set Name object. :raises: An Exception is thrown if this is not a Obj::Type::e_name """ return _PDFNetPython.Obj_SetName(self, name)
[docs] def GetDictIterator(self): r""" :rtype: :py:class:`DictIterator` :return: an iterator that addresses the first element in the dictionary. :raises: An Exception is thrown if this is not a dictionary object (Dict). Sample code used to traverse all entries in the dictionary: .. code-block:: c++ DictIterator itr = dict.GetDictIterator(); while (itr.HasNext()) { Obj key = itr.Key(); Obj value = itr.Value(); // ... itr.Next() } """ return _PDFNetPython.Obj_GetDictIterator(self)
[docs] def Find(self, key): r""" Search the dictionary for a given key. :type key: string :param key: - a key to search for in the dictionary :rtype: :py:class:`DictIterator` :return: The iterator to the matching key/value pair or invalid iterator (i.e. itr.HasNext()==fase) if the if the dictionary does not contain the given key. Notes: A dictionary entry whose value is Obj::Null is equivalent to an absent entry. :raises: Exception is thrown if this is not a dictionary or a stream Sample code used to search a dictionary for a given key: .. code-block:: c++ DictIterator itr = info_dict.Find("Info"); if (itr.HasNext()) { Obj info = itr.Value(); if (info.IsDict()) info.PutString("Producer", "PDFTron PDFNet SDK"); } """ return _PDFNetPython.Obj_Find(self, key)
[docs] def FindObj(self, key): r""" Search the dictionary for a given key. :type key: string :param key: - a key to search for in the dictionary :rtype: :py:class:`Obj` :return: NULL if the dictionary does not contain the specified key. Otherwise return the corresponding value. Notes: A dictionary entry whose value is Obj::Null is equivalent to an absent entry. :raises: Exception is thrown if this is not a dictionary or a stream """ return _PDFNetPython.Obj_FindObj(self, key)
[docs] def Get(self, key): r""" Search the dictionary for a given key and throw an exception if the key is not found. :type key: string :param key: - a key to search for in the dictionary :rtype: :py:class:`DictIterator` :return: Obj::Null object if the value matching specified key is a Obj::Null object. otherwise return the iterator to the matching key/value pair. :raises: An Exception is thrown if the dictionary does not contain the specified key. :raises: An Exception is thrown if this is not a Obj::Type::e_dict or a stream. """ return _PDFNetPython.Obj_Get(self, key)
[docs] def PutName(self, key, name): r""" Inserts a <key, Obj::Type::e_name> pair in the dictionary. :type key: string :param key: The key of the value to set. :type name: string :param name: The value of the Obj::Type::e_name object to be inserted into the dictionary. :rtype: :py:class:`Obj` :return: A newly created name object. :raises: An Exception is thrown if this is not a dictionary or a stream object. Notes: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated. """ return _PDFNetPython.Obj_PutName(self, key, name)
[docs] def PutArray(self, key): r""" Inserts a <key, Obj::Type::e_array> pair in the dictionary. :type key: string :param key: The key of the value to set. :rtype: :py:class:`Obj` :return: A newly created array object. :raises: An Exception is thrown if this is not a dictionary or a stream object. Notes: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated. """ return _PDFNetPython.Obj_PutArray(self, key)
[docs] def PutBool(self, key, value): r""" Inserts a <key, Obj::Type::e_bool> pair in the dictionary. :type key: string :param key: The key of the value to set. :type value: boolean :param value: The value of the Obj::Type::e_bool object to be inserted into the dictionary. :rtype: :py:class:`Obj` :return: A newly created boolean object. :raises: An Exception is thrown if this is not a dictionary or a stream object. Notes: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated. """ return _PDFNetPython.Obj_PutBool(self, key, value)
[docs] def PutDict(self, key): r""" Inserts a <key, Obj::Type::e_dict> pair in the dictionary. :type key: string :param key: The key of the value to set. :rtype: :py:class:`Obj` :return: A newly created dictionary. :raises: An Exception is thrown if this is not a dictionary or a stream object. Notes: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated. """ return _PDFNetPython.Obj_PutDict(self, key)
[docs] def PutNumber(self, key, value): r""" Inserts a <key, Obj::Type::e_number> pair in the dictionary. :type key: string :param key: The key of the value to set. :type value: double :param value: The value of the Obj::Type::e_number object to be inserted into the dictionary. :rtype: :py:class:`Obj` :return: A newly created number object. :raises: An Exception is thrown if this is not a dictionary or a stream object. Notes: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated. """ return _PDFNetPython.Obj_PutNumber(self, key, value)
[docs] def PutString(self, args): r""" Overload 1: Inserts a <key, Obj::Type::e_string> pair in the dictionary. :type key: string :param key: The key of the value to set. :type value: string :param value: The value of the Obj::Type::e_string object to be inserted into the dictionary. :rtype: :py:class:`Obj` :return: A newly created string object. :raises: An Exception is thrown if this is not a dictionary or a stream object. Notes: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated. | Overload 2: Inserts a <key, Obj::Type::e_string> pair in the dictionary. :type key: string :param key: The key of the value to set. :type value: string :param value: The buffer used to set the value of the Obj::Type::e_string object to be inserted into the dictionary. :type size: int :param size: The number of bytes to copy from the 'value' buffer parameter. :rtype: :py:class:`Obj` :return: A newly created string object. :raises: An Exception is thrown if this is not a dictionary or a stream object. Notes: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated. """ return _PDFNetPython.Obj_PutString(self, args)
[docs] def PutText(self, key, value): r""" Inserts a <key, Obj::Type::e_string> pair in the dictionary. :type key: string :param key: The key of the value to set. :type value: string :param value: The value of the Obj::Type::e_string object to be inserted into the dictionary. Notes: PutText will create the string object as a 'PDF Text' object. :rtype: :py:class:`Obj` :return: A newly created string object. :raises: An Exception is thrown if this is not a dictionary or a stream object. If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated. """ return _PDFNetPython.Obj_PutText(self, key, value)
[docs] def PutNull(self, key): r""" Inserts a <key, Obj::Type::e_null> pair in the dictionary. :type key: string :param key: The key of the value to set. :raises: An Exception is thrown if this is not a dictionary or a stream object. Notes: The effect of calling this method is essentially the same as dict.Erase(key) . """ return _PDFNetPython.Obj_PutNull(self, key)
[docs] def Put(self, key, obj): r""" Inserts a <key, Obj> pair in the dictionary. :type key: string :param key: The key of the value to set. :type obj: :py:class:`Obj` :param obj: The value to be inserted into the dictionary. If 'obj' is indirect (i.e. is a shared) object it will be inserted by reference, otherwise the object will be cloned and then inserted into the dictionary. :rtype: :py:class:`Obj` :return: A newly inserted object. :raises: An Exception is thrown if this is not a dictionary or a stream object. """ return _PDFNetPython.Obj_Put(self, key, obj)
[docs] def PutRect(self, key, x1, y1, x2, y2): r""" Inserts a <key, [x1,y1,x2,y2]> pair in the dictionary. :type key: string :param key: The key of the value to set. :type x1: double :param x1: The bottom left x value of the rect to be inserted :type y1: double :param y1: The bottom left y value of the rect to be inserted :type x2: double :param x2: The top right x value of the rect to be inserted :type y2: double :param y2: The top right y value of the rect to be inserted :rtype: :py:class:`Obj` :return: A newly created array object. :raises: An Exception is thrown if this is not a dictionary or a stream object. Notes: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated. """ return _PDFNetPython.Obj_PutRect(self, key, x1, y1, x2, y2)
[docs] def PutMatrix(self, key, value): r""" Inserts a <key, [a,b,c,d,h,v]> pair in the dictionary. :type key: string :param key: The key of the value to set. :type value: :py:class:`Matrix2D` :param value: - A matrix used to set the values in an array of six numbers. The resulting array will be inserted into the dictionary. :rtype: :py:class:`Obj` :return: A newly created array object. :raises: An Exception is thrown if this is not a dictionary or a stream object. Notes: If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated. """ return _PDFNetPython.Obj_PutMatrix(self, key, value)
[docs] def Erase(self, args): r""" Overload 1: Removes an element in the dictionary that matches the given key. :type key: string :param key: A string representing the key value of the element to remove. :raises: An Exception is thrown if this is not a dictionary or a stream. | Overload 2: Removes an element in the dictionary from specified position. :type pos: :py:class:`DictIterator` :param pos: A dictionary iterator indicating the position of the element to remove. :raises: An Exception is thrown if this is not a dictionary or a stream. """ return _PDFNetPython.Obj_Erase(self, args)
[docs] def Rename(self, old_key, new_key): r""" Change the key value of a dictionary entry. The key can't be renamed if another key with the same name already exists in the dictionary. In this case Rename returns false. :type old_key: string :param old_key: A string representing the key value to be changed. :type new_key: string :param new_key: A string representing the key value that the old key is changed into. :raises: An Exception is thrown if this is not a dictionary or a stream. """ return _PDFNetPython.Obj_Rename(self, old_key, new_key)
[docs] def GetAt(self, index): r""" :type index: int :param index: - The array element to obtain. The first element in an array has an index of zero. :raises: throws an Exception if index is outside the array bounds. :raises: An Exception is thrown if this is not an Obj::Type::e_array. """ return _PDFNetPython.Obj_GetAt(self, index)
[docs] def InsertName(self, pos, name): r""" Inserts an Obj::Type::e_name object in the array. :rtype: :py:class:`Obj` :return: A newly created name object. :type pos: int :param pos: - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array. :type name: string :param name: The value of the Obj::Type::e_name object to be inserted. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_InsertName(self, pos, name)
[docs] def InsertArray(self, pos): r""" Inserts an Obj::Type::e_array object in the array. :rtype: :py:class:`Obj` :return: A newly created array object. :type pos: int :param pos: - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_InsertArray(self, pos)
[docs] def InsertBool(self, pos, value): r""" Inserts an Obj::Type::e_bool object in the array. :rtype: :py:class:`Obj` :return: A newly created boolean object. :type pos: int :param pos: - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array. :type value: boolean :param value: The value of the Obj::Type::e_bool object to be inserted. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_InsertBool(self, pos, value)
[docs] def InsertDict(self, pos): r""" Inserts an Obj::Type::e_dict object in the array. :rtype: :py:class:`Obj` :return: A newly created dictionary object. :type pos: int :param pos: - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_InsertDict(self, pos)
[docs] def InsertNumber(self, pos, value): r""" Inserts an Obj::Type::e_number object in the array. :rtype: :py:class:`Obj` :return: A newly created number object. :type pos: int :param pos: - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array. :type value: double :param value: The value of the Obj::Type::e_number object to be inserted. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_InsertNumber(self, pos, value)
[docs] def InsertString(self, args): r""" Overload 1: Inserts an Obj::Type::e_string object in the array. :rtype: :py:class:`Obj` :return: A newly created string object. :type pos: int :param pos: - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array. :type value: string :param value: The value of the Obj::Type::e_string object to be inserted. :raises: An Exception is thrown if this is not an Obj::Type::e_array | Overload 2: Inserts an Obj::Type::e_string object in the array. :rtype: :py:class:`Obj` :return: A newly created string object. :type pos: int :param pos: - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array. :type value: string :param value: The buffer used to set the value of the Obj::Type::e_string object to be inserted. :type size: int :param size: The number of bytes to copy from the 'value' buffer parameter. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_InsertString(self, args)
[docs] def InsertText(self, pos, value): r""" Inserts an Obj::Type::e_string object in the array. :rtype: :py:class:`Obj` :return: A newly created string object. :type pos: int :param pos: - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array. :type value: string :param value: The value of the Obj::Type::e_string object to be inserted. Notes: InsertText will create the string object as a 'PDF Text' object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_InsertText(self, pos, value)
[docs] def InsertNull(self, pos): r""" Inserts an Obj::Type::e_null object in the array. :rtype: :py:class:`Obj` :return: A newly created null object. :type pos: int :param pos: - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_InsertNull(self, pos)
[docs] def Insert(self, pos, obj): r""" Inserts an existing Obj in this array. :type pos: int :param pos: - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array. :type obj: :py:class:`Obj` :param obj: The value to be inserted into the dictionary. If 'obj' is indirect (i.e. is a shared) object it will be inserted by reference, otherwise the object will be cloned and then inserted. :rtype: :py:class:`Obj` :return: A newly inserted object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_Insert(self, pos, obj)
[docs] def InsertRect(self, pos, x1, y1, x2, y2): r""" Inserts an array of 4 numbers in this array. :type pos: int :param pos: - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array. :type x1: double :param x1: The bottom left x value of the rect to be inserted :type y1: double :param y1: The bottom left y value of the rect to be inserted :type x2: double :param x2: The top right x value of the rect to be inserted :type y2: double :param y2: The top right y value of the rect to be inserted :rtype: :py:class:`Obj` :return: A newly created array object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_InsertRect(self, pos, x1, y1, x2, y2)
[docs] def InsertMatrix(self, pos, value): r""" Inserts an array of 6 numbers in this array. :type pos: int :param pos: - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array. :type value: :py:class:`Matrix2D` :param value: - A matrix used to set the values in an array of six numbers. The resulting array will be then inserted in this array. :rtype: :py:class:`Obj` :return: A newly created array object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_InsertMatrix(self, pos, value)
[docs] def PushBackName(self, name): r""" Appends a new Obj::Type::e_name object at the end of the array. :rtype: :py:class:`Obj` :return: The new array object. :type name: string :param name: - The value of the Obj::Type::e_name object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_PushBackName(self, name)
[docs] def PushBackArray(self): r""" Appends a new Obj::Type::e_array object at the end of the array. :rtype: :py:class:`Obj` :return: The new array object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_PushBackArray(self)
[docs] def PushBackBool(self, value): r""" Appends a new Obj::Type::e_bool object at the end of the array. :rtype: :py:class:`Obj` :return: The new boolean object. :type value: boolean :param value: - The value of the Obj::Type::e_bool object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_PushBackBool(self, value)
[docs] def PushBackDict(self): r""" Appends a new Obj::Type::e_dict object at the end of the array. :rtype: :py:class:`Obj` :return: The new dictionary object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_PushBackDict(self)
[docs] def PushBackNumber(self, value): r""" Appends a new Obj::Type::e_number object at the end of the array. :rtype: :py:class:`Obj` :return: The new number object. :type value: double :param value: - The value of the Obj::Type::e_number object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_PushBackNumber(self, value)
[docs] def PushBackString(self, args): r""" Overload 1: Appends a new Obj::Type::e_string object at the end of the array. :rtype: :py:class:`Obj` :return: The new string object. :type value: string :param value: - The value of the Obj::Type::e_string object. :raises: An Exception is thrown if this is not an Obj::Type::e_array | Overload 2: Appends a new Obj::Type::e_string object at the end of the array. :rtype: :py:class:`Obj` :return: The new string object. :type value: string :param value: The buffer used to set the value of the Obj::Type::e_string object to be inserted. :type size: int :param size: The number of bytes to copy from the 'value' buffer parameter. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_PushBackString(self, args)
[docs] def PushBackText(self, value): r""" Appends a new Obj::Type::e_string object at the end of the array. :rtype: :py:class:`Obj` :return: The new string object. :type value: string :param value: The value of the Obj::Type::e_string object to be inserted. Notes: InsertText will create the string object as a 'PDF Text' object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_PushBackText(self, value)
[docs] def PushBackNull(self): r""" Appends a new Obj::Type::e_null object at the end of the array. :rtype: :py:class:`Obj` :return: The new null object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_PushBackNull(self)
[docs] def PushBack(self, obj): r""" Appends an existing Obj at the end of the array. :type obj: :py:class:`Obj` :param obj: The value to be inserted into the dictionary. If 'obj' is indirect (i.e. is a shared) object it will be inserted by reference, otherwise the object will be cloned and then appended. :rtype: :py:class:`Obj` :return: A newly appended object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_PushBack(self, obj)
[docs] def PushBackRect(self, x1, y1, x2, y2): r""" Appends an array of 4 numbers at the end of the array. :type x1: double :param x1: The bottom left x value of the rect to be inserted :type y1: double :param y1: The bottom left y value of the rect to be inserted :type x2: double :param x2: The top right x value of the rect to be inserted :type y2: double :param y2: The top right y value of the rect to be inserted :rtype: :py:class:`Obj` :return: A newly appended array object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_PushBackRect(self, x1, y1, x2, y2)
[docs] def PushBackMatrix(self, value): r""" Appends an array of 6 numbers at the end of the array. :type value: :py:class:`Matrix2D` :param value: - A matrix used to set the values in an array of six numbers. The resulting array will be then inserted in this array. :rtype: :py:class:`Obj` :return: A newly appended array object. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_PushBackMatrix(self, value)
[docs] def EraseAt(self, pos): r""" Checks whether the position is within the array bounds and then removes it from the array and moves each subsequent element to the slot with the next smaller index and decrements the arrays length by 1. :type pos: int :param pos: The index for the array member to remove. Array indexes start at 0. :raises: An Exception is thrown if this is not an Obj::Type::e_array """ return _PDFNetPython.Obj_EraseAt(self, pos)
[docs] def GetRawStreamLength(self): r""" :rtype: int :return: the length of the raw/encoded stream equal to the Length parameter :raises: An Exception is thrown if this is not a Obj::Type::e_stream """ return _PDFNetPython.Obj_GetRawStreamLength(self)
[docs] def GetRawStream(self, decrypt): r""" :type decrypt: boolean :param decrypt: - If true decrypt the stream if the stream is encrypted. :rtype: :py:class:`Filter` :return: - A filter to the encoded stream :raises: An Exception is thrown if this is not a Obj::Type::e_stream """ return _PDFNetPython.Obj_GetRawStream(self, decrypt)
[docs] def GetDecodedStream(self): r""" :rtype: :py:class:`Filter` :return: - A filter to the decoded stream :raises: An Exception is thrown if this is not a Obj::Type::e_stream """ return _PDFNetPython.Obj_GetDecodedStream(self)
[docs] def SetStreamData(self, args): r""" allows to replace the content stream with a new one without creating a new object """ return _PDFNetPython.Obj_SetStreamData(self, args)
def __nonzero__(self): return _PDFNetPython.Obj___nonzero__(self) __bool__ = __nonzero__
[docs] def IsEqual(self, to): r""" :rtype: boolean :return: true if two Obj's point to the same object. This method does not compare object content. For this operation use IsEqualValue() instead. :type to: :py:class:`Obj` :param to: - Obj to compare to """ return _PDFNetPython.Obj_IsEqual(self, to)
def __eq__(self, to): return _PDFNetPython.Obj___eq__(self, to) def __lt__(self, to): return _PDFNetPython.Obj___lt__(self, to)
[docs] @staticmethod def CreateInternal(impl): return _PDFNetPython.Obj_CreateInternal(impl)
[docs] def GetHandleInternal(self): return _PDFNetPython.Obj_GetHandleInternal(self)
def __init__(self, args): _PDFNetPython.Obj_swiginit(self, _PDFNetPython.new_Obj(args)) mp_obj = property(_PDFNetPython.Obj_mp_obj_get, _PDFNetPython.Obj_mp_obj_set) __swig_destroy__ = _PDFNetPython.delete_Obj
# Register Obj in _PDFNetPython: _PDFNetPython.Obj_swigregister(Obj)
[docs] def Obj_CreateInternal(impl): return _PDFNetPython.Obj_CreateInternal(impl)
[docs] class ObjSet(object): r"""ObjSet is a lightweight container that can hold a collection of SDF objects.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_ObjSet def __init__(self, args): _PDFNetPython.ObjSet_swiginit(self, _PDFNetPython.new_ObjSet(args))
[docs] def CreateName(self, name): r""" Create a new name object in this object set. :type name: string :param name: The name of the object to create """ return _PDFNetPython.ObjSet_CreateName(self, name)
[docs] def CreateArray(self): r"""Create a new array object in this object set.""" return _PDFNetPython.ObjSet_CreateArray(self)
[docs] def CreateBool(self, value): r""" Create a new boolean object in this object set. :type value: boolean :param value: The boolean value of the object to create """ return _PDFNetPython.ObjSet_CreateBool(self, value)
[docs] def CreateDict(self): r"""Create a new dictionary object in this object set.""" return _PDFNetPython.ObjSet_CreateDict(self)
[docs] def CreateNull(self): r"""Create a new null object in this object set.""" return _PDFNetPython.ObjSet_CreateNull(self)
[docs] def CreateNumber(self, value): r""" Create a new number object in this object set. :type value: double :param value: The numeric value of the number object to create. """ return _PDFNetPython.ObjSet_CreateNumber(self, value)
[docs] def CreateString(self, value): r""" Create a new string object in this object set. The unsigned string value of the string object to create. """ return _PDFNetPython.ObjSet_CreateString(self, value)
[docs] def CreateFromJson(self, value): r""" parses a json string to create either a Dictionary or an Array in ObjSet. return the created object as Obj """ return _PDFNetPython.ObjSet_CreateFromJson(self, value)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.ObjSet_Destroy(self)
# Register ObjSet in _PDFNetPython: _PDFNetPython.ObjSet_swigregister(ObjSet)
[docs] class SecurityHandler(object): r"""Standard Security Handler is a standard password-based security handler.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_owner = _PDFNetPython.SecurityHandler_e_owner r""" the user has 'owner' rights (e.g. rights to change the document's security settings).""" e_doc_open = _PDFNetPython.SecurityHandler_e_doc_open r""" open and decrypt the document.""" e_doc_modify = _PDFNetPython.SecurityHandler_e_doc_modify r""" edit the document more than adding or modifying text notes.""" e_print = _PDFNetPython.SecurityHandler_e_print r""" print the document. """ e_print_high = _PDFNetPython.SecurityHandler_e_print_high r""" high resolution print.""" e_extract_content = _PDFNetPython.SecurityHandler_e_extract_content r""" enable content extraction""" e_mod_annot = _PDFNetPython.SecurityHandler_e_mod_annot r""" allow modifications to annotations""" e_fill_forms = _PDFNetPython.SecurityHandler_e_fill_forms r""" allow changes to fill in forms""" e_access_support = _PDFNetPython.SecurityHandler_e_access_support r""" content access for the visually impaired.""" e_assemble_doc = _PDFNetPython.SecurityHandler_e_assemble_doc r""" allow document assembly"""
[docs] def GetPermission(self, p): r""" :rtype: boolean :return: true if the SecurityHandler permits the specified action (Permission p) on the document, or false if the permission was not granted. :type p: int :param p: A Permission to be granted. Notes: in order to check for permission the method will repeatedly (up to three times) attempt to GetAuthorizationData() and Authorize() permission. If the permission is not granted AuthorizeFailed() callback will be called. This callback method allows derived class to provide UI feedback for failed authorization. """ return _PDFNetPython.SecurityHandler_GetPermission(self, p)
[docs] def GetKeyLength(self): r""" :rtype: int :return: The length of the encryption key in bytes. Notes: The returned key length is given in bytes. """ return _PDFNetPython.SecurityHandler_GetKeyLength(self)
[docs] def GetEncryptionAlgorithmID(self): r""" :rtype: int :return: The encryption algorithm identifier. A code specifying the algorithm to be used in encrypting and decrypting the document. Returned number corresponds to V entry in encryption dictionary. Currently allowed values are from 0-4. See PDF Reference Manual for more details. """ return _PDFNetPython.SecurityHandler_GetEncryptionAlgorithmID(self)
[docs] def GetHandlerDocName(self): r""" :rtype: string :return: The name of the security handler as it appears in the serialized file as the value of /Filter key in /Encrypt dictionary. """ return _PDFNetPython.SecurityHandler_GetHandlerDocName(self)
[docs] def IsModified(self): r""" :rtype: boolean :return: - true if the SecurityHandler was modified (by calling SetModified()) or false otherwise. If the user changes SecurityHandler's settings (e.g. by changing a password), IsModified() should return true. """ return _PDFNetPython.SecurityHandler_IsModified(self)
[docs] def IsValid(self): r""" :rtype: boolean :return: - true if the SecurityHandler is valid. """ return _PDFNetPython.SecurityHandler_IsValid(self)
[docs] def SetModified(self, is_modified=True): r""" The method allows derived classes to set SecurityHandler is modified flag. This method should be called whenever there are changes (e.g. a password change) to the SecurityHandler :type is_modified: boolean :param is_modified: Value to set the SecurityHandler's is modified flag to """ return _PDFNetPython.SecurityHandler_SetModified(self, is_modified)
e_RC4_40 = _PDFNetPython.SecurityHandler_e_RC4_40 r""" 40-bit RC4 algorithm.""" e_RC4_128 = _PDFNetPython.SecurityHandler_e_RC4_128 r""" 128-bit RC4 algorithm.""" e_AES = _PDFNetPython.SecurityHandler_e_AES r""" Use Crypt filters with 128-bit AES (Advanced Encryption Standard) algorithm.""" e_AES_256 = _PDFNetPython.SecurityHandler_e_AES_256 r""" Use Crypt filters with 256-bit AES (Advanced Encryption Standard) algorithm.""" __swig_destroy__ = _PDFNetPython.delete_SecurityHandler
[docs] def ChangeUserPasswordASCII(self, password): r""" Set the new user password to an ASCII text string :type password: string :param password: the new user password Remarks: Deprecated. Use versions that accepts UString or buffer instead.. """ return _PDFNetPython.SecurityHandler_ChangeUserPasswordASCII(self, password)
[docs] def ChangeUserPassword(self, args): r""" Overload 1: Set the new user password to a binary string :type password: string :param password: the new user password Remarks: Deprecated. Use versions that accepts UString or buffer instead. | Overload 2: Sets the new user password. :type password: string :param password: The new user password. | Overload 3: Sets the new user password. :type password_buf: std::vector< int,std::allocator< int > > :param password_buf: The new user password. """ return _PDFNetPython.SecurityHandler_ChangeUserPassword(self, args)
[docs] def GetUserPassword(self): r""" :rtype: string :return: Current user password. """ return _PDFNetPython.SecurityHandler_GetUserPassword(self)
[docs] def GetUserPasswordSize(self): r""" :rtype: int :return: Length of the current user password string. This has to be used when password is a non-ASCII string that may contain '' bytes. """ return _PDFNetPython.SecurityHandler_GetUserPasswordSize(self)
[docs] def ChangeMasterPasswordASCII(self, password): r""" Set the new master password to an ASCII text string :type password: string :param password: the new master/owner password Remarks: Deprecated. Use versions that accepts UString or buffer instead. """ return _PDFNetPython.SecurityHandler_ChangeMasterPasswordASCII(self, password)
[docs] def ChangeMasterPassword(self, args): r""" Overload 1: Set the new master password to a binary string :type password: string :param password: the new user password Remarks: Deprecated. Use versions that accepts UString or buffer instead. | Overload 2: Sets the new master/owner password. :type password: string :param password: The new master/owner password. | Overload 3: Sets the new master/owner password. :type password_buf: std::vector< int,std::allocator< int > > :param password_buf: The new master/owner password. """ return _PDFNetPython.SecurityHandler_ChangeMasterPassword(self, args)
[docs] def GetMasterPassword(self): r""" :rtype: string :return: Current master (owner) password. """ return _PDFNetPython.SecurityHandler_GetMasterPassword(self)
[docs] def GetMasterPasswordSize(self): r""" :rtype: int :return: Length of the current owner password string. This has to be used when password is a non-ASCII string that may contain '' bytes. """ return _PDFNetPython.SecurityHandler_GetMasterPasswordSize(self)
[docs] def SetPermission(self, perm, value): r""" Set the permission setting of the StdSecurityHandler. :type perm: int :param perm: indicates a permission to set or clear. It can be any of the following values: e_print // print the document. e_doc_modify // edit the document more than adding or modifying text notes. e_extract_content // enable content extraction e_mod_annot // allow modifications to annotations e_fill_forms // allow changes to fill in forms e_access_support // content access for the visually impaired. e_assemble_doc // allow document assembly e_print_high // high resolution print. :type value: boolean :param value: true if the permission/s should be granted, false otherwise. """ return _PDFNetPython.SecurityHandler_SetPermission(self, perm, value)
[docs] def ChangeRevisionNumber(self, rev_num): r""" Change the revision number and the encryption algorithm of the standard security handler. :type rev_num: int :param rev_num: the new revision number of the standard security algorithm. Currently allowed values for the revision number are (see Table 3.18 in PDF Reference Manual v1.6 for more details): - 2 : Encryption using 40-bit RC4 algorithm. - 3 : Encryption using 128-bit RC4 algorithm. Available in PDF 1.4 and above. - 4 : Encryption using Crypt filters and 128-bit AES (Advanced Encryption Standard) algorithm. Available in PDF 1.6 and above. """ return _PDFNetPython.SecurityHandler_ChangeRevisionNumber(self, rev_num)
[docs] def SetEncryptMetadata(self, encrypt_metadata): r""" Indicates whether the document-level metadata stream is to be encrypted. :type encrypt_metadata: boolean :param encrypt_metadata: true if metadata stream should be encrypted, false otherwise. Notes: EncryptMetadata flag affects only Crypt filters available in PDF 1.5 (Acrobat 6) and later. By default, metadata stream will be encrypted. """ return _PDFNetPython.SecurityHandler_SetEncryptMetadata(self, encrypt_metadata)
[docs] def GetRevisionNumber(self): r""" :rtype: int :return: the revision number of the standard security algorithm. """ return _PDFNetPython.SecurityHandler_GetRevisionNumber(self)
[docs] def IsUserPasswordRequired(self): r""" :rtype: boolean :return: true if the SecurityHandler requires a user password. """ return _PDFNetPython.SecurityHandler_IsUserPasswordRequired(self)
[docs] def IsMasterPasswordRequired(self): r""" :rtype: boolean :return: true if the SecurityHandler requires a master (owner) password. """ return _PDFNetPython.SecurityHandler_IsMasterPasswordRequired(self)
[docs] def IsAES(self, args): r""" Overload 1: :rtype: boolean :return: true is this security handler uses 128 bit AES (Advanced Encryption Standard) algorithm to encrypt strings or streams. | Overload 2: The following function can be used to verify whether a given stream is encrypted using AES. :rtype: boolean :return: true if the given stream is encrypted using AES encryption. :type stream: :py:class:`Obj` :param stream: A pointer to an SDF::Stream object """ return _PDFNetPython.SecurityHandler_IsAES(self, args)
[docs] def IsRC4(self): r""" :rtype: boolean :return: true is this security handler uses RC4 algorithm to encrypt strings or streams. """ return _PDFNetPython.SecurityHandler_IsRC4(self)
def __nonzero__(self): return _PDFNetPython.SecurityHandler___nonzero__(self) __bool__ = __nonzero__
[docs] def AuthorizeFailed(self): r""" A callback method indicating repeated failed authorization. Override this callback in order to provide a UI feedback for failed authorization. Default implementation returns immediately. """ return _PDFNetPython.SecurityHandler_AuthorizeFailed(self)
[docs] def Authorize(self, p): r""" The method is called when a user tries to set security for an encrypted document and when a user tries to open a file. It must decide, based on the contents of the authorization data structure, whether or not the user is permitted to open the file, and what permissions the user has for this file. Notes: - This callback must not obtain the authorization data (e.g. by displaying a user interface into which a user can type a password). This is handled by the security handler's GetAuthorizationData(), which must be called before this callback. Instead, Authorize() should work with authorization data it has access to. :type p: int :param p: - permission to authorize """ return _PDFNetPython.SecurityHandler_Authorize(self, p)
[docs] def GetAuthorizationData(self, req_opr): r""" This method is invoked in case Authorize() failed. The callback must determine the user's authorization properties for the document by obtaining authorization data (e.g. a password through a GUI dialog). The authorization data is subsequently used by the security handler's Authorize() to determine whether or not the user is authorized to open the file. :rtype: boolean :return: false if the operation was canceled, true otherwise. :type req_opr: int :param req_opr: - the permission for which authorization data is requested. """ return _PDFNetPython.SecurityHandler_GetAuthorizationData(self, req_opr)
[docs] def EditSecurityData(self, doc): r""" Called when the security handler should activate a dialog box with the current security settings that may be modified. :rtype: boolean :return: true if the operation was successful false otherwise. """ return _PDFNetPython.SecurityHandler_EditSecurityData(self, doc)
[docs] def FillEncryptDict(self, doc): r""" Called when an encrypted document is saved. Fills the document's Encryption dictionary with whatever information the security handler wants to store in the document. The sequence of events during creation of the encrypt_dict is as follows: - encrypt_dict is created (if it does not exist) - Filter attribute is added to the dictionary - call this method to allow the security handler to add its own attributes - call the GetCryptKey to get the algorithm version, key, and key length - checks if the V attribute has been added to the dictionary and, if not, then sets V to the algorithm version - set the Length attribute if V is 2 or greater - add the encrypt_dict to the document :type doc: :py:class:`SDFDoc` :param doc: - The document to save. :rtype: :py:class:`Obj` :return: - encrypt_dict Warning: - Unlike all other strings and streams, direct object elements of the encrypt_dict are not encrypted automatically. If you want them encrypted, you must encrypt them before inserting them into the dictionary. """ return _PDFNetPython.SecurityHandler_FillEncryptDict(self, doc)
[docs] def Clone(self, base): r""" :rtype: :py:class:`SecurityHandler` :return: A new, cloned instance of SecurityHandler. Notes: this method must be implemented in any derived class from SecurityHandler. """ return _PDFNetPython.SecurityHandler_Clone(self, base)
[docs] def InitPasswordASCII(self, password): r""" The method can be called in GetAuthorizationData() callback to specify user supplied ASCII password. Remarks: Deprecated. Use versions that accepts UString or buffer instead. """ return _PDFNetPython.SecurityHandler_InitPasswordASCII(self, password)
[docs] def InitPassword(self, args): r""" Overload 1: The method can be called in GetAuthorizationData() callback to specify user supplied non-ASCII password. Remarks: Deprecated. Use versions that accepts UString or buffer instead. | Overload 2: This method can be called in GetAuthorizationData() callback to specify user supplied password. | Overload 3: This method can be called in GetAuthorizationData() callback to specify user supplied password. """ return _PDFNetPython.SecurityHandler_InitPassword(self, args)
has_CloneProc = _PDFNetPython.SecurityHandler_has_CloneProc has_AuthProc = _PDFNetPython.SecurityHandler_has_AuthProc has_AuthFailedProc = _PDFNetPython.SecurityHandler_has_AuthFailedProc has_GetAuthDataProc = _PDFNetPython.SecurityHandler_has_GetAuthDataProc has_EditSecurDataProc = _PDFNetPython.SecurityHandler_has_EditSecurDataProc has_FillEncDictProc = _PDFNetPython.SecurityHandler_has_FillEncDictProc
[docs] def SetDerived(self, overloaded_funct): r""" This method informs base security handler which methods are overridden in the derived class. The only place this method needs to be invoked is in Create(name, key_len, enc_code) static factory method in the derived class. :type overloaded_funct: int :param overloaded_funct: A flag that specifies which functions are overloaded in the derived class. For example: SetDerived(SecurityHandler::has_Clone + SecurityHandler::has_FillEncDictProc); """ return _PDFNetPython.SecurityHandler_SetDerived(self, overloaded_funct)
[docs] def GetDerived(self): r""" :rtype: :py:class:`SecurityHandler` :return: The derived class or NULL for standard security handler. """ return _PDFNetPython.SecurityHandler_GetDerived(self)
def __init__(self, args): _PDFNetPython.SecurityHandler_swiginit(self, _PDFNetPython.new_SecurityHandler(args)) mp_handler = property(_PDFNetPython.SecurityHandler_mp_handler_get, _PDFNetPython.SecurityHandler_mp_handler_set) m_owner = property(_PDFNetPython.SecurityHandler_m_owner_get, _PDFNetPython.SecurityHandler_m_owner_set) m_derived_procs = property(_PDFNetPython.SecurityHandler_m_derived_procs_get, _PDFNetPython.SecurityHandler_m_derived_procs_set)
# Register SecurityHandler in _PDFNetPython: _PDFNetPython.SecurityHandler_swigregister(SecurityHandler)
[docs] class PDFTronCustomSecurityHandler(SecurityHandler): r"""This class represents PDFTron Custom Security handler that applies PDFTron's custom encryption method on save.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, custom_id): r""" ructor :type custom_id: int :param custom_id: the user's custom ID. A random ID is suggested to make the custom security unique to the application. Notes: Please refer to PDFNet::AddPDFTronCustomHandler(UInt32 custom_id) for more details. """ _PDFNetPython.PDFTronCustomSecurityHandler_swiginit(self, _PDFNetPython.new_PDFTronCustomSecurityHandler(custom_id)) __swig_destroy__ = _PDFNetPython.delete_PDFTronCustomSecurityHandler
# Register PDFTronCustomSecurityHandler in _PDFNetPython: _PDFNetPython.PDFTronCustomSecurityHandler_swigregister(PDFTronCustomSecurityHandler)
[docs] class DocSnapshot(object): r""" The class DocSnapshot. Represents a state of the document. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_DocSnapshot
[docs] def Destroy(self): return _PDFNetPython.DocSnapshot_Destroy(self)
[docs] def GetHash(self): r""" Returns a hash that is unique to particular document states. :rtype: int :return: A hash that is unique to particular document states. """ return _PDFNetPython.DocSnapshot_GetHash(self)
[docs] def IsValid(self): r""" Returns whether this snapshot is valid. :rtype: boolean :return: Whether this snapshot is valid. """ return _PDFNetPython.DocSnapshot_IsValid(self)
[docs] def Equals(self, snapshot): r""" Returns whether this snapshot's document state is equivalent to another. :type snapshot: :py:class:`DocSnapshot` :param snapshot: -- the other snapshot with which to compare. :rtype: boolean :return: Whether this snapshot's document state is equivalent to another. """ return _PDFNetPython.DocSnapshot_Equals(self, snapshot)
def __init__(self, args): _PDFNetPython.DocSnapshot_swiginit(self, _PDFNetPython.new_DocSnapshot(args)) m_impl = property(_PDFNetPython.DocSnapshot_m_impl_get, _PDFNetPython.DocSnapshot_m_impl_set)
# Register DocSnapshot in _PDFNetPython: _PDFNetPython.DocSnapshot_swigregister(DocSnapshot)
[docs] class ResultSnapshot(object): r""" The class ResultSnapshot. Represents a transition between two document states. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_ResultSnapshot
[docs] def Destroy(self): return _PDFNetPython.ResultSnapshot_Destroy(self)
[docs] def CurrentState(self): r""" Retrieves the document state to which this transition has transitioned. :rtype: :py:class:`DocSnapshot` :return: The current document state. """ return _PDFNetPython.ResultSnapshot_CurrentState(self)
[docs] def PreviousState(self): r""" Retrieves the document state from which this transition has transitioned. :rtype: :py:class:`DocSnapshot` :return: The previous document state. """ return _PDFNetPython.ResultSnapshot_PreviousState(self)
[docs] def IsOk(self): r""" Returns whether this transition is valid or a null transition. :rtype: boolean :return: Whether this transition is valid or a null transition. """ return _PDFNetPython.ResultSnapshot_IsOk(self)
[docs] def IsNullTransition(self): r""" Returns whether this transition is a null transition. :rtype: boolean :return: Whether this transition is a null transition. """ return _PDFNetPython.ResultSnapshot_IsNullTransition(self)
m_impl = property(_PDFNetPython.ResultSnapshot_m_impl_get, _PDFNetPython.ResultSnapshot_m_impl_set) def __init__(self, args): _PDFNetPython.ResultSnapshot_swiginit(self, _PDFNetPython.new_ResultSnapshot(args))
# Register ResultSnapshot in _PDFNetPython: _PDFNetPython.ResultSnapshot_swigregister(ResultSnapshot)
[docs] class UndoManager(object): r""" The class UndoManager. Undo-redo interface; one-to-one mapped to document """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_UndoManager
[docs] def Destroy(self): return _PDFNetPython.UndoManager_Destroy(self)
[docs] def DiscardAllSnapshots(self): r""" Forget all changes in this manager (without changing the document). :rtype: :py:class:`DocSnapshot` :return: An invalid DocSnapshot. """ return _PDFNetPython.UndoManager_DiscardAllSnapshots(self)
[docs] def Undo(self): r""" Restores to the previous snapshot point, if there is one. :rtype: :py:class:`ResultSnapshot` :return: The resulting snapshot id. """ return _PDFNetPython.UndoManager_Undo(self)
[docs] def CanUndo(self): r""" Returns whether it is possible to undo from the current snapshot. :rtype: boolean :return: Whether it is possible to undo from the current snapshot. """ return _PDFNetPython.UndoManager_CanUndo(self)
[docs] def GetNextUndoSnapshot(self): r""" Gets the previous state of the document. This state may be invalid if it is impossible to undo. :rtype: :py:class:`DocSnapshot` :return: The previous state of the document. This state may be invalid if it is impossible to undo. """ return _PDFNetPython.UndoManager_GetNextUndoSnapshot(self)
[docs] def Redo(self): r""" Restores to the next snapshot, if there is one. :rtype: :py:class:`ResultSnapshot` :return: A representation of the transition to the next snapshot, if there is one. """ return _PDFNetPython.UndoManager_Redo(self)
[docs] def CanRedo(self): r""" Returns a boolean indicating whether it is possible to redo from the current snapshot. :rtype: boolean :return: A boolean indicating whether it is possible to redo from the current snapshot. """ return _PDFNetPython.UndoManager_CanRedo(self)
[docs] def GetNextRedoSnapshot(self): r""" Gets the next state of the document. This state may be invalid if it is impossible to redo. :rtype: :py:class:`DocSnapshot` :return: The next state of the document. This state may be invalid if it is impossible to redo. """ return _PDFNetPython.UndoManager_GetNextRedoSnapshot(self)
[docs] def TakeSnapshot(self): r""" Creates a snapshot of document state, transitions to the new snapshot. :rtype: :py:class:`ResultSnapshot` :return: A representation of the transition. """ return _PDFNetPython.UndoManager_TakeSnapshot(self)
def __init__(self, args): _PDFNetPython.UndoManager_swiginit(self, _PDFNetPython.new_UndoManager(args)) m_impl = property(_PDFNetPython.UndoManager_m_impl_get, _PDFNetPython.UndoManager_m_impl_set)
# Register UndoManager in _PDFNetPython: _PDFNetPython.UndoManager_swigregister(UndoManager)
[docs] class ViewChangeCollection(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_ViewChangeCollection
[docs] def Destroy(self): return _PDFNetPython.ViewChangeCollection_Destroy(self)
[docs] @staticmethod def CreateInternal(impl): return _PDFNetPython.ViewChangeCollection_CreateInternal(impl)
[docs] def GetHandleInternal(self): return _PDFNetPython.ViewChangeCollection_GetHandleInternal(self)
def __init__(self, args): _PDFNetPython.ViewChangeCollection_swiginit(self, _PDFNetPython.new_ViewChangeCollection(args)) mp_collection = property(_PDFNetPython.ViewChangeCollection_mp_collection_get, _PDFNetPython.ViewChangeCollection_mp_collection_set)
# Register ViewChangeCollection in _PDFNetPython: _PDFNetPython.ViewChangeCollection_swigregister(ViewChangeCollection)
[docs] def ViewChangeCollection_CreateInternal(impl): return _PDFNetPython.ViewChangeCollection_CreateInternal(impl)
[docs] class Point(TRN_point): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): _PDFNetPython.Point_swiginit(self, _PDFNetPython.new_Point(args)) __swig_destroy__ = _PDFNetPython.delete_Point
# Register Point in _PDFNetPython: _PDFNetPython.Point_swigregister(Point)
[docs] class Function(object): r""" Although PDF is not a programming language it provides several types of function object that represent parameterized classes of functions, including mathematical formulas and sampled representations with arbitrary resolution. Functions are used in various ways in PDF, including device-dependent rasterization information for high-quality printing (halftone spot functions and transfer functions), color transform functions for certain color spaces, and specification of colors as a function of position for smooth shadings. Functions in PDF represent static, self-contained numerical transformations. PDF::Function represents a single, flat interface around all PDF function types. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_Function e_sampled = _PDFNetPython.Function_e_sampled e_exponential = _PDFNetPython.Function_e_exponential e_stitching = _PDFNetPython.Function_e_stitching e_postscript = _PDFNetPython.Function_e_postscript
[docs] def GetType(self): r""" :rtype: int :return: The function type """ return _PDFNetPython.Function_GetType(self)
[docs] def GetInputCardinality(self): r""" :rtype: int :return: the number of input components required by the function """ return _PDFNetPython.Function_GetInputCardinality(self)
[docs] def GetOutputCardinality(self): r""" :rtype: int :return: the number of output components returned by the function """ return _PDFNetPython.Function_GetOutputCardinality(self)
[docs] def Eval(self, in_arr): r""" Evaluate the function at a given point. Notes: that size of 'in' array must be greater than or equal to function input cardinality. and the size of 'out' array must be greater than or equal to function output cardinality. """ return _PDFNetPython.Function_Eval(self, in_arr)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: the underlying SDF/Cos object """ return _PDFNetPython.Function_GetSDFObj(self)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.Function_Destroy(self)
def __init__(self, args): _PDFNetPython.Function_swiginit(self, _PDFNetPython.new_Function(args)) mp_func = property(_PDFNetPython.Function_mp_func_get, _PDFNetPython.Function_mp_func_set)
# Register Function in _PDFNetPython: _PDFNetPython.Function_swigregister(Function)
[docs] class ColorPt(object): r""" ColorPt is an array of colorants (or tint values) representing a color point in an associated color space. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): _PDFNetPython.ColorPt_swiginit(self, _PDFNetPython.new_ColorPt(args)) __swig_destroy__ = _PDFNetPython.delete_ColorPt def __eq__(self, co): return _PDFNetPython.ColorPt___eq__(self, co)
[docs] def Set(self, args): r""" Overload 1: A utility method to set the first 4 tint values. For example, color.Set(red, green, blue) will initialize the ColorPt to given tint values. :type x: double :param x: initialized value of first color value (eg. red for rgb colorspace); :type y: double :param y: initialized value of second color value (eg. green for rgb colorspace); :type z: double :param z: initialized value of third color value (eg. blue for rgb colorspace); :type w: double :param w: initialized value of fourth color value (eg. when using CMYK); Notes: color.Set(gray) is equivalent to Set(0, gray); All colorants should be in the range [0..1], so colors in the range [0..255] should be divided by 255.0 first. | Overload 2: Sets a tint value at a given colorant index. :type colorant_index: int :param colorant_index: the color index. For example, for a color point associated with a Gray color space the only allowed value for index is 0. For a color point associated with a CMYK color space, the color_index can range from 0 (cyan) to 4 (black). :type colorant_value: double :param colorant_value: The new tint value. For example, the following snippet will initialize the color point to [red, green, blue]: .. code-block:: c++ color.SetColorantNum(3); color.Set(0, red); color.Set(1, green); color.Set(2, blue); The above code snippet is equivalent to the following line: color.Set(red, green, blue) Notes: If a color point has more than 4 colorants, SetColorantNum(num_colorants) must be called before getting or setting tint values. All colorants should be in the range [0..1], so colors in the range [0..255] should be divided by 255.0 first. """ return _PDFNetPython.ColorPt_Set(self, args)
[docs] def Get(self, colorant_index): r""" The number of colorants depends on the associated color space. To find how many colorant are associated with a given color space use color_space.GetComponentNum(). For example, if you have a color point in the RGB color space you can extract its colorants as follows: .. code-block:: c++ UInt8 rgb[3] = { UInt8(c.Get(0)255), UInt8(c.Get(1)255), UInt8(c.Get(2)255) }; :type colorant_index: int :param colorant_index: number representing the index of the color space to get the tint from :rtype: double :return: the tint value at a given colorant index. """ return _PDFNetPython.ColorPt_Get(self, colorant_index)
[docs] def SetColorantNum(self, num): r""" If a color point has more than 4 colorants, SetColorantNum(num_colorants) must be called before getting or setting tint values. The number of colorants depends on the associated color space. To find how many colorant are associated with a given color space use color_space.GetComponentNum(). """ return _PDFNetPython.ColorPt_SetColorantNum(self, num)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.ColorPt_Destroy(self)
m_c = property(_PDFNetPython.ColorPt_m_c_get, _PDFNetPython.ColorPt_m_c_set)
# Register ColorPt in _PDFNetPython: _PDFNetPython.ColorPt_swigregister(ColorPt)
[docs] class ColorSpace(object): r""" This abstract class is used to serve as a color space tag to identify the specific color space of a Color object. It contains methods that transform colors in a specific color space to/from several color space such as DeviceRGB and DeviceCMYK. For purposes of the methods in this class, colors are represented as arrays of color components represented as doubles in a normalized range defined by each ColorSpace. For many ColorSpaces (e.g. DeviceRGB), this range is 0.0 to 1.0. However, some ColorSpaces have components whose values have a different range. Methods are provided to inquire per component minimum and maximum normalized values. Notes: Note that in Pattern color space (i.e. for ColorSpace::e_pattern) 'color values' are PDF::PatternColor objects instead of the numeric component values (i.e. ColorPt) used with other spaces. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def CreateDeviceGray(): r"""Create a new DeviceGray ColorSpace object""" return _PDFNetPython.ColorSpace_CreateDeviceGray()
[docs] @staticmethod def CreateDeviceRGB(): r"""Create a new DeviceRGB ColorSpace object""" return _PDFNetPython.ColorSpace_CreateDeviceRGB()
[docs] @staticmethod def CreateDeviceCMYK(): r"""Create a new DeviceCMYK ColorSpace object""" return _PDFNetPython.ColorSpace_CreateDeviceCMYK()
[docs] @staticmethod def CreatePattern(): r"""Create a new Pattern ColorSpace object""" return _PDFNetPython.ColorSpace_CreatePattern()
[docs] @staticmethod def CreateICC(args): return _PDFNetPython.ColorSpace_CreateICC(args)
__swig_destroy__ = _PDFNetPython.delete_ColorSpace e_device_gray = _PDFNetPython.ColorSpace_e_device_gray e_device_rgb = _PDFNetPython.ColorSpace_e_device_rgb e_device_cmyk = _PDFNetPython.ColorSpace_e_device_cmyk e_cal_gray = _PDFNetPython.ColorSpace_e_cal_gray e_cal_rgb = _PDFNetPython.ColorSpace_e_cal_rgb e_lab = _PDFNetPython.ColorSpace_e_lab e_icc = _PDFNetPython.ColorSpace_e_icc e_indexed = _PDFNetPython.ColorSpace_e_indexed e_pattern = _PDFNetPython.ColorSpace_e_pattern e_separation = _PDFNetPython.ColorSpace_e_separation e_device_n = _PDFNetPython.ColorSpace_e_device_n e_null = _PDFNetPython.ColorSpace_e_null
[docs] def GetType(self): r""" :rtype: int :return: The type of this color space """ return _PDFNetPython.ColorSpace_GetType(self)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: the underlying SDF/Cos object """ return _PDFNetPython.ColorSpace_GetSDFObj(self)
[docs] def GetComponentNum(self): r""" :rtype: int :return: The number of colorants (tint components) used to represent color point in this color space """ return _PDFNetPython.ColorSpace_GetComponentNum(self)
[docs] def InitColor(self, out_colorants): r""" Set color to the initial value used for this color space. The initial value depends on the color space (see 4.5.7 in PDF Ref. Manual). :type out_colorants: :py:class:`ColorPt` :param out_colorants: ColorPt object to initialize. """ return _PDFNetPython.ColorSpace_InitColor(self, out_colorants)
[docs] def InitComponentRanges(self, out_decode_low, out_decode_range): r""" Initialize default ranges for each color component in the color space. For example, default ranges for DeviceRGB are [0 1 0 1 0 1] but for Lab the default values might be [0 100 -100 100 -100 100]. :type out_decode_low: std::vector< double,std::allocator< double > > :param out_decode_low: a vector of numbers representing the lower bound for each color component. :type out_decode_range: std::vector< double,std::allocator< double > > :param out_decode_range: a vector of numbers representing the difference between high and low bound for each color component. Notes: the size of resulting vectors will match the number of color components in this color space. """ return _PDFNetPython.ColorSpace_InitComponentRanges(self, out_decode_low, out_decode_range)
[docs] def Convert2Gray(self, in_color): r""" A convenience function used to convert color points from the current color space to DeviceGray color space. :type in_color: :py:class:`ColorPt` :param in_color: input color point in the current color space :param out_color: output color point in the DeviceGray color space Notes: the number to input colorants must match the number of colorants expected by the current color space. """ return _PDFNetPython.ColorSpace_Convert2Gray(self, in_color)
[docs] def Convert2RGB(self, in_color): r""" A convenience function used to convert color points from the current color space to DeviceRGB color space. :type in_color: :py:class:`ColorPt` :param in_color: input color point in the current color space :param out_color: output color point in the DeviceRGB color space Notes: the number to input colorants must match the number of colorants expected by the current color space. """ return _PDFNetPython.ColorSpace_Convert2RGB(self, in_color)
[docs] def Convert2CMYK(self, in_color): r""" A convenience function used to convert color points from the current color space to DeviceCMYK color space. :type in_color: :py:class:`ColorPt` :param in_color: input color point in the current color space :param out_color: output color point in the DeviceCMYK color space Notes: the number to input colorants must match the number of colorants expected by the current color space. """ return _PDFNetPython.ColorSpace_Convert2CMYK(self, in_color)
[docs] def GetAlternateColorSpace(self): r""" :rtype: :py:class:`ColorSpace` :return: the alternate color space if it is available or NULL otherwise. Color spaces that include alternate color space are e_separation, e_device_n, and e_icc. """ return _PDFNetPython.ColorSpace_GetAlternateColorSpace(self)
[docs] def GetBaseColorSpace(self): r""" :rtype: :py:class:`ColorSpace` :return: the base color space if this is an e_indexed or e_pattern with associated base color space; NULL otherwise. """ return _PDFNetPython.ColorSpace_GetBaseColorSpace(self)
[docs] def GetHighVal(self): r""" :rtype: int :return: the highest index for the color lookup table for Indexed color space. Since the color table is indexed from zero to highval, the actual number of entries is highval + 1. For color spaces other than indexed the method returns 0. Notes: for color spaces other than Indexed this method throws an exception. """ return _PDFNetPython.ColorSpace_GetHighVal(self)
[docs] def GetBaseColor(self, color_idx): r""" Get the base color given a component value (index) in Indexed color space. :type color_idx: UChar :param color_idx: color value represented in the index color space :param out_color: the color represented in the base (associated) color space Notes: for color spaces other than Indexed this method throws an exception. """ return _PDFNetPython.ColorSpace_GetBaseColor(self, color_idx)
[docs] def IsNone(self): r""" :rtype: boolean :return: True if Separation or DeviceN color space contains None colorants. For DeviceN the function returns true only if component colorant names are all None. Notes: for color spaces other than Separation or DeviceN this method throws an exception. """ return _PDFNetPython.ColorSpace_IsNone(self)
[docs] def IsAll(self): r""" :rtype: boolean :return: True if Separation color space contains the colorant All. Notes: for color spaces other than Separation this method throws an exception. """ return _PDFNetPython.ColorSpace_IsAll(self)
[docs] def GetTintFunction(self): r""" :rtype: :py:class:`Function` :return: the function that transforms tint values into color component values in the alternate color space. Notes: for color spaces other than Separation this method throws an exception. """ return _PDFNetPython.ColorSpace_GetTintFunction(self)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.ColorSpace_Destroy(self)
def __init__(self, args): _PDFNetPython.ColorSpace_swiginit(self, _PDFNetPython.new_ColorSpace(args)) mp_cs = property(_PDFNetPython.ColorSpace_mp_cs_get, _PDFNetPython.ColorSpace_mp_cs_set)
# Register ColorSpace in _PDFNetPython: _PDFNetPython.ColorSpace_swigregister(ColorSpace)
[docs] def ColorSpace_CreateDeviceGray(): r"""Create a new DeviceGray ColorSpace object""" return _PDFNetPython.ColorSpace_CreateDeviceGray()
[docs] def ColorSpace_CreateDeviceRGB(): r"""Create a new DeviceRGB ColorSpace object""" return _PDFNetPython.ColorSpace_CreateDeviceRGB()
[docs] def ColorSpace_CreateDeviceCMYK(): r"""Create a new DeviceCMYK ColorSpace object""" return _PDFNetPython.ColorSpace_CreateDeviceCMYK()
[docs] def ColorSpace_CreatePattern(): r"""Create a new Pattern ColorSpace object""" return _PDFNetPython.ColorSpace_CreatePattern()
[docs] def ColorSpace_CreateICC(args): return _PDFNetPython.ColorSpace_CreateICC(args)
[docs] class Rect(TRN_rect): r""" Rect is a utility class used to manipulate PDF rectangle objects (refer to section 3.8.3 of the PDF Reference Manual). Rect can be associated with a SDF/Cos rectangle array using Rect(Obj)ructor or later using Rect::Attach(Obj) or Rect::Update(Obj) methods. Rect keeps a local cache for rectangle points so it is necessary to call Rect::Update() method if the changes to the Rect should be saved in the attached Cos/SDF array. Notes: - Although rectangles are conventionally specified by their lower-left and upper-right corners, it is acceptable to specify any two diagonally opposite corners. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): _PDFNetPython.Rect_swiginit(self, _PDFNetPython.new_Rect(args))
[docs] def Attach(self, obj): r""" Attach the Cos/SDF object to the Rect. :type obj: :py:class:`Obj` :param obj: - underlying Cos/SDF object. Must be an SDF::Array with four SDF::Number elements. """ return _PDFNetPython.Rect_Attach(self, obj)
[docs] def Update(self, args): r""" Saves changes made to the Rect object in the attached (or specified) SDF/Cos rectangle. :type obj: :py:class:`Obj` :param obj: - an optional parameter indicating a SDF array that should be updated and attached to this Rect. If parameter rect is NULL or is omitted, update is performed on previously attached Cos/SDF rectangle. :rtype: boolean :return: true if the attached Cos/SDF rectangle array was successfully updated, false otherwise. """ return _PDFNetPython.Rect_Update(self, args)
[docs] def Set(self, x1, y1, x2, y2): r""" Set the coordinates of the rectangle :type x1: double :param x1: The left-most position of the rect. :type y1: double :param y1: The bottom-most position of the rect. :type x2: double :param x2: The right-most position of the rect. :type y2: double :param y2: The top-most position of the rect. The rect is not attached to any Cos/SDF object. """ return _PDFNetPython.Rect_Set(self, x1, y1, x2, y2)
[docs] def Width(self): r""" :rtype: double :return: rectangle's width """ return _PDFNetPython.Rect_Width(self)
[docs] def Height(self): r""" :rtype: double :return: rectangle's height """ return _PDFNetPython.Rect_Height(self)
[docs] def Contains(self, x, y): r""" Determines if the specified point is contained within the rectangular region defined by this Rectangle :type x: double :param x: horizontal x value of the point to check :type y: double :param y: vertical y value of the point to check :rtype: boolean :return: true is the point is in the rectangle, false otherwise. """ return _PDFNetPython.Rect_Contains(self, x, y)
[docs] def IntersectRect(self, rect1, rect2): r""" Makes a Rect equal to the intersection of two existing rectangles. :type rect1: :py:class:`Rect` :param rect1: - A Rect object that contains a source rectangle. :type rect2: :py:class:`Rect` :param rect2: - A Rect object that contains a source rectangle. :rtype: boolean :return: true if the intersection is not empty; 0 if the intersection is empty. Notes: The intersection is the largest rectangle contained in both existing rectangles. """ return _PDFNetPython.Rect_IntersectRect(self, rect1, rect2)
[docs] def Normalize(self): r""" Arrange the points in the rectangle so that the first point is the lower-left corner and the second point is the upper-right corner of the rectangle. Notes: Although rectangles are conventionally specified by their lower-left and upper-right corners, it is acceptable to specify any two diagonally opposite corners. """ return _PDFNetPython.Rect_Normalize(self)
[docs] def Inflate(self, args): r""" Overload 1: Expands the rectangle by the specified size, in all directions. :type amount: double :param amount: Specifies the amount to increase the rectangle in all directions. | Overload 2: Expands the rectangle by the specified size, in all directions. :type x: double :param x: Specifies the amount to increase the rectangle's Left (x1) and Right (x2) properties. :type y: double :param y: Specifies the amount to increase the rectangle's Top (y1) and Bottom (y2) properties. """ return _PDFNetPython.Rect_Inflate(self, args)
[docs] def GetX1(self): r""" :rtype: double :return: The horizontal value of lower-left point. """ return _PDFNetPython.Rect_GetX1(self)
[docs] def GetY1(self): r""" :rtype: double :return: The vertical value of lower-left point. """ return _PDFNetPython.Rect_GetY1(self)
[docs] def GetX2(self): r""" :rtype: double :return: The horizontal value of upper-right point. """ return _PDFNetPython.Rect_GetX2(self)
[docs] def GetY2(self): r""" :rtype: double :return: The vertical value of upper-right point. """ return _PDFNetPython.Rect_GetY2(self)
[docs] def SetX1(self, x1): r""" Set the horizontal value of lower-left point. :type x1: double :param x1: The left-most position of the rect. """ return _PDFNetPython.Rect_SetX1(self, x1)
[docs] def SetY1(self, y1): r""" Set the vertical value of lower-left point. :type y1: double :param y1: The bottom-most position of the rect. """ return _PDFNetPython.Rect_SetY1(self, y1)
[docs] def SetX2(self, x2): r""" Set the horizontal value of upper-right point. :type x2: double :param x2: The right-most position of the rect. """ return _PDFNetPython.Rect_SetX2(self, x2)
[docs] def SetY2(self, y2): r""" Set the vertical value of upper-right point. :type y2: double :param y2: The top-most position of the rect. """ return _PDFNetPython.Rect_SetY2(self, y2)
__swig_destroy__ = _PDFNetPython.delete_Rect
# Register Rect in _PDFNetPython: _PDFNetPython.Rect_swigregister(Rect)
[docs] class RectCollection(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): _PDFNetPython.RectCollection_swiginit(self, _PDFNetPython.new_RectCollection())
[docs] def AddRect(self, to_add): return _PDFNetPython.RectCollection_AddRect(self, to_add)
[docs] def GetRectAt(self, index): return _PDFNetPython.RectCollection_GetRectAt(self, index)
[docs] def GetNumRects(self): return _PDFNetPython.RectCollection_GetNumRects(self)
[docs] def Clear(self): return _PDFNetPython.RectCollection_Clear(self)
__swig_destroy__ = _PDFNetPython.delete_RectCollection
# Register RectCollection in _PDFNetPython: _PDFNetPython.RectCollection_swigregister(RectCollection)
[docs] class Page(object): r""" Page is a high-level class representing PDF page object (see 'Page Objects' in Section 3.6.2, 'Page Tree,' in PDF Reference Manual). Among other associated objects, a page object contains: - A series of objects representing the objects drawn on the page (See Element and ElementReader class for examples of how to extract page content). - A list of resources used in drawing the page - Annotations - Beads, private metadata, optional thumbnail image, etc. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def IsValid(self): r""" :rtype: boolean :return: true if this is a valid (non-null) page, false otherwise. If the function returns false the underlying SDF/Cos object is null or is not valid. """ return _PDFNetPython.Page_IsValid(self)
[docs] def GetIndex(self): r""" :rtype: int :return: the Page number indication the position of this Page in document's page sequence. Document's page sequence is indexed from 1. Page number 0 means that the page is not part of document's page sequence or that the page is not valid. """ return _PDFNetPython.Page_GetIndex(self)
e_media = _PDFNetPython.Page_e_media e_crop = _PDFNetPython.Page_e_crop e_bleed = _PDFNetPython.Page_e_bleed e_trim = _PDFNetPython.Page_e_trim e_art = _PDFNetPython.Page_e_art e_user_crop = _PDFNetPython.Page_e_user_crop
[docs] def GetBox(self, type): r""" :rtype: :py:class:`Rect` :return: the box specified for the page object intersected with the media box. :type type: int :param type: The type of the page bounding box. Possible values are: e_media, e_crop, e_bleed, e_trim, and e_art. If the value for 'type' is e_crop, this call is equivalent to GetCropBox(). If the value for 'type' is e_media, this call is equivalent to GetMediaBox(). """ return _PDFNetPython.Page_GetBox(self, type)
[docs] def SetBox(self, type, box): r""" Sets the page bounding box specified by 'page_region' for this page. :type type: int :param type: The type of the page bounding box. Possible values are: e_media, e_crop, e_bleed, e_trim, and e_art. :type box: :py:class:`Rect` :param box: A rectangle specifying the coordinates to set for the box. The coordinates are specified in user space units. """ return _PDFNetPython.Page_SetBox(self, type, box)
[docs] def GetCropBox(self): r""" :rtype: :py:class:`Rect` :return: the crop box for this page. The page dimensions are specified in user space coordinates. The crop box is the region of the page to display and print. Notes: this method is equivalent to GetBox(Page::e_crop) """ return _PDFNetPython.Page_GetCropBox(self)
[docs] def SetCropBox(self, box): r""" Sets the crop box for this page. The crop box is the region of the page to display and print. :type box: :py:class:`Rect` :param box: the new crop box for this page. The page dimensions are specified in user space coordinates. The crop box defines the region to which the contents of the page are to be clipped (cropped) when displayed or printed. Notes: this method is equivalent to SetBox(Page::e_crop) """ return _PDFNetPython.Page_SetCropBox(self, box)
[docs] def GetMediaBox(self): r""" :rtype: :py:class:`Rect` :return: the media box for this page. The page dimensions are specified in user space coordinates. The media box defines the boundaries of the physical medium on which the page is to be printed. It may include any extended area surrounding the finished page for bleed, printing marks, or other such purposes. Notes: this method is equivalent to GetBox(Page::e_media) :raises: if the page is missing media box the function throws Exception """ return _PDFNetPython.Page_GetMediaBox(self)
[docs] def SetMediaBox(self, box): r""" Sets the media box for this page. :type box: :py:class:`Rect` :param box: the new media box for this page. The page dimensions are specified in user space coordinates. The media box defines the boundaries of the physical medium on which the page is to be printed. It may include any extended area surrounding the finished page for bleed, printing marks, or other such purposes. Notes: this method is equivalent to SetBox(Page::e_media) """ return _PDFNetPython.Page_SetMediaBox(self, box)
[docs] def GetVisibleContentBox(self): r""" :rtype: :py:class:`Rect` :return: the bounding box for this page. The page dimensions are specified in user space coordinates. The bounding box is defined as the smallest rectangle that includes all the visible content on the page. """ return _PDFNetPython.Page_GetVisibleContentBox(self)
e_0 = _PDFNetPython.Page_e_0 e_90 = _PDFNetPython.Page_e_90 e_180 = _PDFNetPython.Page_e_180 e_270 = _PDFNetPython.Page_e_270
[docs] @staticmethod def AddRotations(r0, r1): r""" Rotate r0 clockwise by r1 :type r0: int :param r0: first rotation. :type r1: int :param r1: second rotation. :rtype: int :return: returns r0 + r1 """ return _PDFNetPython.Page_AddRotations(r0, r1)
[docs] @staticmethod def SubtractRotations(r0, r1): r""" Rotate r0 counter clockwise by r1. :type r0: int :param r0: first rotation. :type r1: int :param r1: second rotation. :rtype: int :return: returns r0 - r1 """ return _PDFNetPython.Page_SubtractRotations(r0, r1)
[docs] @staticmethod def RotationToDegree(r): r""" Convert a rotation to a number. :type r: int :param r: rotation to convert to number :rtype: int :return: one of four numbers; 0, 90, 180 or 270. """ return _PDFNetPython.Page_RotationToDegree(r)
[docs] @staticmethod def DegreeToRotation(r): r""" Convert a number that represents rotation in degrees to a rotation enum. :type r: int :param r: degree to convert to rotation. Valid numbers are multiples of 90. :rtype: int :return: one of four angles; e_0, e_90, e_180 or e_270. Returns e_0 if input is not a multiple 90. """ return _PDFNetPython.Page_DegreeToRotation(r)
[docs] def GetRotation(self): r""" :rtype: int :return: the rotation value for this page. """ return _PDFNetPython.Page_GetRotation(self)
[docs] def SetRotation(self, angle): r""" Sets the rotation value for this page. :type angle: int :param angle: Rotation value to be set for a given page. Must be one of the Page::Rotate values. """ return _PDFNetPython.Page_SetRotation(self, angle)
[docs] def GetPageWidth(self, args): r""" :rtype: double :return: the width for the given page region/box taking into account page rotation attribute (i.e. /Rotate entry in page dictionary). :type box_type: int :param box_type: indicates the page box/region to query for width. """ return _PDFNetPython.Page_GetPageWidth(self, args)
[docs] def GetPageHeight(self, args): r""" :rtype: double :return: the height for the given page region/box taking into account page rotation attribute (i.e. /Rotate entry in page dictionary). :type box_type: int :param box_type: indicates the page box/region to query for height. """ return _PDFNetPython.Page_GetPageHeight(self, args)
[docs] def GetDefaultMatrix(self, args): r""" :rtype: :py:class:`Matrix2D` :return: the matrix that transforms user space coordinates to rotated and cropped coordinates. The origin of this space is the bottom-left of the rotated, cropped page. :type flip_y: boolean :param flip_y: this parameter can be used to mirror the page. if 'flip_y' is true the Y axis is not flipped and it is increasing, otherwise Y axis is decreasing. :type box_type: int :param box_type: an optional parameter used to specify the page box/region that the matrix should map to. By default, the function transforms user space coordinates to cropped coordinates. :type angle: int :param angle: an optional parameter used to specify page rotation in addition to the rotation specified in the page dictionary. This parameter is usually used to rotate the page without modifying the document itself. """ return _PDFNetPython.Page_GetDefaultMatrix(self, args)
[docs] def GetAnnots(self): r""" Returns SDF/Cos array containing annotation dictionaries. See Section 8.4 in the PDF Reference for a description of the annotation array. :rtype: :py:class:`Obj` :return: an array of annotation dictionaries representing annotations associated with the page or NULL if page dictionary is not specified. """ return _PDFNetPython.Page_GetAnnots(self)
[docs] def GetNumAnnots(self): r""" Returns the number of annotations on a page. Widget annotations (form fields) are included in the count. :rtype: int :return: The number of annotations on a page. """ return _PDFNetPython.Page_GetNumAnnots(self)
[docs] def GetAnnot(self, index): r""" Returns the annotation on the page. :rtype: :py:class:`Annot` :return: Annotation object. If the index is out of range returned Annot object is not valid (i.e. annot.IsValid() returns false). :type index: int :param index: - The index of the annotation to get on a page. The first annotation on a page has an index of zero. """ return _PDFNetPython.Page_GetAnnot(self, index)
e_action_trigger_page_open = _PDFNetPython.Page_e_action_trigger_page_open e_action_trigger_page_close = _PDFNetPython.Page_e_action_trigger_page_close
[docs] def GetTriggerAction(self, trigger): r""" Get the Action associated with the selected Page Trigger event. :type trigger: int :param trigger: the type of trigger event to get :rtype: :py:class:`Obj` :return: the Action Obj if present, otherwise NULL """ return _PDFNetPython.Page_GetTriggerAction(self, trigger)
[docs] def AnnotInsert(self, pos, annot): r""" Adds an annotation at the specified location in a page's annotation array. :type pos: int :param pos: - The location in the array to insert the object. The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= GetNumAnnots(), the method appends the annotation to the array. :type annot: :py:class:`Annot` :param annot: - The annotation to add. """ return _PDFNetPython.Page_AnnotInsert(self, pos, annot)
[docs] def AnnotPushBack(self, annot): r""" Adds an annotation to the end of a page's annotation array. :type annot: :py:class:`Annot` :param annot: - The annotation to prepend in a page's annotation array. """ return _PDFNetPython.Page_AnnotPushBack(self, annot)
[docs] def AnnotPushFront(self, annot): r""" Adds an annotation to the beginning of a page's annotation array. :type annot: :py:class:`Annot` :param annot: - The annotation to append in a page's annotation array. """ return _PDFNetPython.Page_AnnotPushFront(self, annot)
[docs] def AnnotRemove(self, args): r""" Overload 1: Removes the given annotation from the page. Notes: Removing the annotation invalidates the given Annot object. :type annot: :py:class:`Annot` :param annot: The annotation to remove. | Overload 2: Removes the annotation at a given location. Notes: Removing the annotation invalidates any associated Annot object. :type index: int :param index: - A zero based index of the annotation to remove. """ return _PDFNetPython.Page_AnnotRemove(self, args)
[docs] def Scale(self, scale): r""" A utility method used to scale physical dimensions of the page including all page content. :type scale: double :param scale: A number greater than 0 which is used as a scale factor. For example, calling page.Scale(0.5) will reduce physical dimensions of the page to half its original size, whereas page.Scale(2) will double the physical dimensions of the page and will rescale all page content appropriately. Notes: Unlike SetUserUnitSize(unit_size) which is only supported in PDF 1.6 (i.e. Acrobat 7) and above, page.Scale(sc) supports all PDF versions. """ return _PDFNetPython.Page_Scale(self, scale)
[docs] def FlattenField(self, field_to_flatten): r""" Flatten/Merge existing form field appearances with the page content and remove widget annotation. Form 'flattening' refers to the operation that changes active form fields into a static area that is part of the PDF document, just like the other text and images in the document. A completely flattened PDF form does not have any widget annotations or interactive fields. :type field_to_flatten: :py:class:`Field` :param field_to_flatten: field to flatten Notes: An alternative approach to set the field as read only is using Field.SetFlag(Field::e_read_only, true) method. Unlike Field.SetFlag(...), the result of FlattenField() operation can not be programatically reversed. """ return _PDFNetPython.Page_FlattenField(self, field_to_flatten)
[docs] def HasTransition(self): r"""Tests whether this page has a transition.""" return _PDFNetPython.Page_HasTransition(self)
[docs] def GetUserUnitSize(self): r""" Returns the UserUnit value for the page. A UserUnit is a positive number giving the size of default user space units, in multiples of 1/72 inch. :rtype: double :return: the UserUnit value for the page. If the key is not present in the page dictionary the default of 1.0 is returned. """ return _PDFNetPython.Page_GetUserUnitSize(self)
[docs] def SetUserUnitSize(self, unit_size): r""" Sets the UserUnit value for a page. :type unit_size: double :param unit_size: A positive number giving the size of default user space units, in multiples of 1/72 inch. Notes: This is a PDF 1.6 feature. See the implementation note 171 in PDF Reference for details. """ return _PDFNetPython.Page_SetUserUnitSize(self, unit_size)
[docs] def GetResourceDict(self): r""" :rtype: :py:class:`Obj` :return: a pointer to the page resource dictionary. :raises: if the page is missing resource dictionary the function throws Exception """ return _PDFNetPython.Page_GetResourceDict(self)
[docs] def GetContents(self): r""" :rtype: :py:class:`Obj` :return: NULL if page is empty, otherwise a single stream or an array of streams. """ return _PDFNetPython.Page_GetContents(self)
[docs] def GetSDFObj(self): r""" Returns the page dictionary. :rtype: :py:class:`Obj` :return: the object to the underlying SDF/Cos object. """ return _PDFNetPython.Page_GetSDFObj(self)
[docs] def FindInheritedAttribute(self, attrib): r""" Some of the page attributes are designated as inheritable. If such an attribute is omitted from a page object, its value is inherited from an ancestor node in the page tree. If the attribute is a required one, a value must be supplied in an ancestor node; if it is optional and no inherited value is specified, the default value should be used. The function walks up the page inheritance tree in search for specified attribute. :type attrib: string :param attrib: A string representing the attribute to search for. :rtype: :py:class:`Obj` :return: if the attribute was found return a pointer to the value. Otherwise the function return NULL. Resources dictionary (Required; inheritable) MediaBox rectangle (Required; inheritable) CropBox rectangle (Optional; inheritable) Rotate integer (Optional; inheritable) """ return _PDFNetPython.Page_FindInheritedAttribute(self, attrib)
def __nonzero__(self): return _PDFNetPython.Page___nonzero__(self) __bool__ = __nonzero__
[docs] def GetThumb(self): r""" :rtype: :py:class:`Obj` :return: Object representing the Image thumbnail. """ return _PDFNetPython.Page_GetThumb(self)
def __init__(self, args): _PDFNetPython.Page_swiginit(self, _PDFNetPython.new_Page(args)) mp_page = property(_PDFNetPython.Page_mp_page_get, _PDFNetPython.Page_mp_page_set) __swig_destroy__ = _PDFNetPython.delete_Page
# Register Page in _PDFNetPython: _PDFNetPython.Page_swigregister(Page)
[docs] def Page_AddRotations(r0, r1): r""" Rotate r0 clockwise by r1 :type r0: int :param r0: first rotation. :type r1: int :param r1: second rotation. :rtype: int :return: returns r0 + r1 """ return _PDFNetPython.Page_AddRotations(r0, r1)
[docs] def Page_SubtractRotations(r0, r1): r""" Rotate r0 counter clockwise by r1. :type r0: int :param r0: first rotation. :type r1: int :param r1: second rotation. :rtype: int :return: returns r0 - r1 """ return _PDFNetPython.Page_SubtractRotations(r0, r1)
[docs] def Page_RotationToDegree(r): r""" Convert a rotation to a number. :type r: int :param r: rotation to convert to number :rtype: int :return: one of four numbers; 0, 90, 180 or 270. """ return _PDFNetPython.Page_RotationToDegree(r)
[docs] def Page_DegreeToRotation(r): r""" Convert a number that represents rotation in degrees to a rotation enum. :type r: int :param r: degree to convert to rotation. Valid numbers are multiples of 90. :rtype: int :return: one of four angles; e_0, e_90, e_180 or e_270. Returns e_0 if input is not a multiple 90. """ return _PDFNetPython.Page_DegreeToRotation(r)
[docs] class Date(TRN_date): r""" The Date class is a utility class used to simplify work with PDF date objects. PDF defines a standard date format, which closely follows international standard ASN.1 (Abstract Syntax Notation One), A date is a string of the form (D:YYYYMMDDHHmmSSOHH'mm'); See PDF Reference Manual for details. Date can be associated with a SDF/Cos date string using Date(Obj)ructor or later using Date::Attach(Obj) or Date::Update(Obj) methods. Date keeps a local date/time cache so it is necessary to call Date::Update() method if the changes to the Date should be saved in the attached Cos/SDF string. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): r""" Overload 1: Date defaultructor. | Overload 2: Create a Date and initialize it using given Cos/SDF string date object. String date object is attached to this Date. :type d: :py:class:`Obj` :param d: The Cos/SDF object to initialze the Date object with. | Overload 3: Create a Date and initialize it using specified parameters. The Date is not attached to any Cos/SDF object. :type year: int :param year: number representing the year to initialize the Date object to. :type month: char :param month: number representing the month to initialize the Date object to. :type day: char :param day: number representing the day to initialize the Date object to. :type hour: char :param hour: number representing the hour to initialize the Date object to. :type minute: char :param minute: number representing the minute to initialize the Date object to. :type second: char :param second: number representing the second to initialize the Date object to. | Overload 4: Copyructor """ _PDFNetPython.Date_swiginit(self, _PDFNetPython.new_Date(args))
[docs] def IsValid(self): r""" Indicates whether the Date is valid (non-null). :rtype: boolean :return: True if this is a valid (non-null) Date; otherwise false. Notes: If this method returns false the underlying SDF/Cos object is null and the Date object should be treated as null as well. """ return _PDFNetPython.Date_IsValid(self)
[docs] def SetCurrentTime(self): r""" Sets the date object to the current date and time. The method also updates associated SDF object. """ return _PDFNetPython.Date_SetCurrentTime(self)
[docs] def SetUT(self, ut): r""" Set the relationship of local time to Universal Time(UT), denoted by one of the characters +, -, or Z :type ut: char :param ut: the relationship of local time to Universal Time(UT), """ return _PDFNetPython.Date_SetUT(self, ut)
[docs] def SetUTHour(self, ut_hour): r""" Set the absolute value of the offset from UT in hours(00-23) :type ut_hour: Int8 :param ut_hour: the absolute value of the offset from UT in hours(00-23) """ return _PDFNetPython.Date_SetUTHour(self, ut_hour)
[docs] def SetUTMinutes(self, ut_minutes): r""" Set the absolute value of the offset from UT in minutes(00-59) :type ut_minutes: Int8 :param ut_minutes: the absolute value of the offset from UT in minutes(00-59) """ return _PDFNetPython.Date_SetUTMinutes(self, ut_minutes)
[docs] def Attach(self, d): r""" Attach the Cos/SDF object to the Date. :type d: :py:class:`Obj` :param d: - underlying Cos/SDF object. Must be an SDF::Str containing a PDF date object. """ return _PDFNetPython.Date_Attach(self, d)
[docs] def Update(self, d=0): r""" Saves changes made to the Date object in the attached (or specified) SDF/Cos string. :type d: :py:class:`Obj` :param d: - an optional parameter indicating a SDF string that should be updated and attached to this Date. If parameter d is NULL or is omitted, update is performed on previously attached Cos/SDF date. :rtype: boolean :return: true if the attached Cos/SDF string was successfully updated, false otherwise. """ return _PDFNetPython.Date_Update(self, d)
[docs] def GetYear(self): r""" :rtype: int :return: The year. """ return _PDFNetPython.Date_GetYear(self)
[docs] def GetMonth(self): return _PDFNetPython.Date_GetMonth(self)
[docs] def GetDay(self): return _PDFNetPython.Date_GetDay(self)
[docs] def GetHour(self): return _PDFNetPython.Date_GetHour(self)
[docs] def GetMinute(self): return _PDFNetPython.Date_GetMinute(self)
[docs] def GetSecond(self): return _PDFNetPython.Date_GetSecond(self)
[docs] def GetUT(self): return _PDFNetPython.Date_GetUT(self)
[docs] def GetUTHour(self): return _PDFNetPython.Date_GetUTHour(self)
[docs] def GetUTMin(self): return _PDFNetPython.Date_GetUTMin(self)
__swig_destroy__ = _PDFNetPython.delete_Date
# Register Date in _PDFNetPython: _PDFNetPython.Date_swigregister(Date)
[docs] class Field(object): r""" An interactive form (sometimes referred to as an AcroForm) is a collection of fields for gathering information interactively from the user. A PDF document may contain any number of Fields appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document. PDFNet fully supports reading, writing, and editing PDF forms and provides many utility methods so that work with forms is simple and efficient. Using PDFNet forms API arbitrary subsets of form fields can be imported or exported from the document, new forms can be created from scratch, and the appearance of existing forms can be modified. In PDFNet Fields are accessed through FieldIterator-s. The list of all Fields present in the document can be traversed as follows: .. code-block:: c++ FieldIterator itr = pdfdoc.GetFieldIterator(); for(; itr.HasNext(); itr.Next()) { Field field = itr.Current(); Console.WriteLine("Field name: {0}", field.GetName()); } For a full sample, please refer to 'InteractiveForms' sample project. To search field by name use FieldFind method. For example: .. code-block:: c++ FieldIterator itr = pdfdoc.FieldFind("name"); if (itr.HasNext()) { Console.WriteLine("Field name: {0}", itr.Current().GetName()); } else { ...field was not found... } If a given field name was not found or if the end of the field list was reached the iterator HasNext() will return false. If you have a valid iterator you can access the Field using Current() method. For example: Field field = itr.Current(); Using Flatten(...) method it is possible to merge field appearances with the page content. Form 'flattening' refers to the operation that changes active form fields into a static area that is part of the PDF document, just like the other text and images in the document. A completely flattened PDF form does not have any widget annotations or interactive fields. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_Field
[docs] def IsValid(self): r""" :rtype: boolean :return: whether this is a valid (non-null) Field. If the function returns false the underlying SDF/Cos object is null and the Field object should be treated as null as well. """ return _PDFNetPython.Field_IsValid(self)
e_button = _PDFNetPython.Field_e_button e_check = _PDFNetPython.Field_e_check e_radio = _PDFNetPython.Field_e_radio e_text = _PDFNetPython.Field_e_text e_choice = _PDFNetPython.Field_e_choice e_signature = _PDFNetPython.Field_e_signature e_null = _PDFNetPython.Field_e_null
[docs] def GetType(self): r""" :rtype: int :return: The field's value, whose type/format varies depending on the field type. See the descriptions of individual field types for further information. """ return _PDFNetPython.Field_GetType(self)
[docs] def GetValue(self): r""" :rtype: :py:class:`Obj` :return: the value of the Field (the value of its /V key) or NULL if the value is not specified. The format of field's value varies depending on the field type. """ return _PDFNetPython.Field_GetValue(self)
[docs] def GetValueAsString(self): return _PDFNetPython.Field_GetValueAsString(self)
[docs] def GetValueAsBool(self): r""" :rtype: boolean :return: Field value as a boolean. Notes: This method is usually for check-box and radio button fields. """ return _PDFNetPython.Field_GetValueAsBool(self)
e_action_trigger_keystroke = _PDFNetPython.Field_e_action_trigger_keystroke e_action_trigger_format = _PDFNetPython.Field_e_action_trigger_format e_action_trigger_validate = _PDFNetPython.Field_e_action_trigger_validate e_action_trigger_calculate = _PDFNetPython.Field_e_action_trigger_calculate
[docs] def SetValue(self, args): r""" Overload 1: Sets the value of the field (i.e. the value of the field's /V key). The format of field's value varies depending on the field type. :type value: string :param value: the new field value. Notes: in order to remove/erase the existing value use pass a SDF::Null object to SetValue(). In PDF, Field's value is separate from its annotation (i.e. how the field appears on the page). After you modify Field's value you need to refresh Field's appearance using RefreshAppearance() method. Alternatively, you can delete "AP" entry from the Widget annotation and set "NeedAppearances" flag in AcroForm dictionary (i.e. doc.GetAcroForm().Put("NeedAppearances", Obj.CreateBool(true)); ) This will force viewer application to auto-generate new field appearances every time the document is opened. Yet another option is to generate a custom annotation appearance using ElementBuilder and ElementWriter and then set the "AP" entry in the widget dictionary to the new appearance stream. This functionality is useful in applications that need advanced control over how the form fields are rendered. | Overload 2: Sets the value of a check-box or radio-button field. :type value: boolean :param value: If true, the filed will be set to 'True', if false the field will be set to 'False'. Notes: This method is usually for check-box and radio button fields. """ return _PDFNetPython.Field_SetValue(self, args)
[docs] def GetTriggerAction(self, trigger): r""" Get the Action associated with the selected Field Trigger event. :type trigger: int :param trigger: the type of trigger event to get :rtype: :py:class:`Obj` :return: the Action Obj if present, otherwise NULL """ return _PDFNetPython.Field_GetTriggerAction(self, trigger)
[docs] def RefreshAppearance(self): r""" Regenerates the appearance stream for the Widget Annotation containing variable text. Call this method if you modified field's value and would like to update field's appearance. Notes: If this field contains text, and has been added to a rotated page, the text in the field may be rotated. If RefreshAppearance is called after the field is added to a rotated page, then any text will be rotated in the opposite direction of the page rotation. If this method is called before the field is added to any rotated page, then no counter rotation will be applied. If you wish to call RefreshAppearance on a field already added to a rotated page, but you don't want the text to be rotated, you can do one of the following; temporarily un-rotate the page, or, temporarily remove the "P" object from the field. """ return _PDFNetPython.Field_RefreshAppearance(self)
[docs] def EraseAppearance(self): r"""Removes any appearances associated with the field.""" return _PDFNetPython.Field_EraseAppearance(self)
[docs] def GetDefaultValue(self): r""" :rtype: :py:class:`Obj` :return: The default value to which the field reverts when a reset-form action is executed or NULL if the default value is not specified. The format of field's value varies depending on the field type. """ return _PDFNetPython.Field_GetDefaultValue(self)
[docs] def GetDefaultValueAsString(self): return _PDFNetPython.Field_GetDefaultValueAsString(self)
[docs] def GetName(self): r""" :rtype: string :return: a string representing the fully qualified name of the field (e.g. "employee.name.first"). """ return _PDFNetPython.Field_GetName(self)
[docs] def GetPartialName(self): r""" :rtype: string :return: a string representing the partial name of the field (e.g. "first" when "employee.name.first" is fully qualified name). """ return _PDFNetPython.Field_GetPartialName(self)
[docs] def Rename(self, field_name): r""" Modifies the field name. :type field_name: string :param field_name: a string representing the fully qualified name of the field (e.g. "employee.name.first"). """ return _PDFNetPython.Field_Rename(self, field_name)
[docs] def IsAnnot(self): r""" :rtype: boolean :return: true if this Field is a Widget Annotation Determines whether or not this Field is an Annotation. """ return _PDFNetPython.Field_IsAnnot(self)
e_read_only = _PDFNetPython.Field_e_read_only e_required = _PDFNetPython.Field_e_required e_no_export = _PDFNetPython.Field_e_no_export e_pushbutton_flag = _PDFNetPython.Field_e_pushbutton_flag e_radio_flag = _PDFNetPython.Field_e_radio_flag e_toggle_to_off = _PDFNetPython.Field_e_toggle_to_off e_radios_in_unison = _PDFNetPython.Field_e_radios_in_unison e_multiline = _PDFNetPython.Field_e_multiline e_password = _PDFNetPython.Field_e_password e_file_select = _PDFNetPython.Field_e_file_select e_no_spellcheck = _PDFNetPython.Field_e_no_spellcheck e_no_scroll = _PDFNetPython.Field_e_no_scroll e_comb = _PDFNetPython.Field_e_comb e_rich_text = _PDFNetPython.Field_e_rich_text e_combo = _PDFNetPython.Field_e_combo e_edit = _PDFNetPython.Field_e_edit e_sort = _PDFNetPython.Field_e_sort e_multiselect = _PDFNetPython.Field_e_multiselect e_commit_on_sel_change = _PDFNetPython.Field_e_commit_on_sel_change
[docs] def GetFlag(self, flag): r""" :rtype: boolean :return: the value of given field flag """ return _PDFNetPython.Field_GetFlag(self, flag)
[docs] def SetFlag(self, flag, value): r""" Set the value of given FieldFlag. Notes: You can use this method to set the field as read-only. An alternative approach to set the field as read only is using Page.Flatten(...) method. Unlike Flatten(...), the result of SetFlag(...) can be programatically reversed. """ return _PDFNetPython.Field_SetFlag(self, flag, value)
e_left_justified = _PDFNetPython.Field_e_left_justified e_centered = _PDFNetPython.Field_e_centered e_right_justified = _PDFNetPython.Field_e_right_justified
[docs] def GetJustification(self): r""" :rtype: int :return: the form of quadding (justification) to be used in displaying the text fields. """ return _PDFNetPython.Field_GetJustification(self)
[docs] def SetJustification(self, j): r""" Sets the justification to be used in displaying the text field. :type j: int :param j: enum representing justification to set the text field to, options are e_left_justified, e_centered and e_right_justified Notes: This method is specific to a text field. """ return _PDFNetPython.Field_SetJustification(self, j)
[docs] def SetMaxLen(self, max_len): r""" Sets the maximum length of the field's text, in characters. :type max_len: int :param max_len: maximum length of a field's text. Notes: This method is specific to a text field. """ return _PDFNetPython.Field_SetMaxLen(self, max_len)
[docs] def GetOptCount(self): r"""Returns the total number of options in a list or combo box.""" return _PDFNetPython.Field_GetOptCount(self)
[docs] def GetOpt(self, index): r""" :type index: int :param index: index position of the option to retrieve. :rtype: string :return: The string of the option at the givent index. Notes: The index must be less than the value returned by GetOptCount(). """ return _PDFNetPython.Field_GetOpt(self, index)
[docs] def GetMaxLen(self): r""" :rtype: int :return: The maximum length of the field's text, in characters, or a negative number if the length is not limited. Notes: This method is specific to a text field. """ return _PDFNetPython.Field_GetMaxLen(self)
[docs] def GetDefaultAppearance(self): r""" :rtype: GState :return: The default graphics state that should be used in formatting the text. The state corresponds to /DA entry in the field dictionary. """ return _PDFNetPython.Field_GetDefaultAppearance(self)
[docs] def Flatten(self, page): r""" Flatten/Merge existing form field appearances with the page content and remove widget annotation. Form 'flattening' refers to the operation that changes active form fields into a static area that is part of the PDF document, just like the other text and images in the document. A completely flattened PDF form does not have any widget annotations or interactive fields. :type page: :py:class:`Page` :param page: page object to flatten Notes: an alternative approach to set the field as read only is using Field.SetFlag(Field::e_read_only, true) method. Unlike Field.SetFlag(...), the result of Flatten() operation can not be programatically reversed. """ return _PDFNetPython.Field_Flatten(self, page)
[docs] def GetUpdateRect(self): r""" :rtype: :py:class:`Rect` :return: The rectangle that should be refreshed after changing a field. """ return _PDFNetPython.Field_GetUpdateRect(self)
[docs] def FindInheritedAttribute(self, attrib): r""" Some of the Field attributes are designated as inheritable. If such an attribute is omitted from a Field object, its value is inherited from an ancestor node in the Field tree. If the attribute is a required one, a value must be supplied in an ancestor node; if it is optional and no inherited value is specified, the default value should be used. The function walks up the Field inheritance tree in search for specified attribute. :rtype: :py:class:`Obj` :return: The attribute value if the given attribute name was found or a NULL object if the given attribute name was not found. Resources dictionary (Required; inheritable) MediaBox rectangle (Required; inheritable) CropBox rectangle (Optional; inheritable) Rotate integer (Optional; inheritable) """ return _PDFNetPython.Field_FindInheritedAttribute(self, attrib)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: the underlying SDF/Cos object. """ return _PDFNetPython.Field_GetSDFObj(self)
def __nonzero__(self): return _PDFNetPython.Field___nonzero__(self) __bool__ = __nonzero__
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.Field_Destroy(self)
[docs] def UseSignatureHandler(self, signature_handler_id): r""" Sets the signature handler to use for adding a signature to this field. If the signature handler is not found in PDFDoc's signature handlers list, this field will not be signed. To add signature handlers, use PDFDoc.AddSignatureHandler method. If a signature handler is already assigned to this field and this method is called once again, the associate signature handler for this field will be updated with the new handler. :type signature_handler_id: int :param signature_handler_id: The unique id of the SignatureHandler to use for adding signature in this field. :rtype: :py:class:`Obj` :return: The signature dictionary created using the SignatureHandler, or NULL pointer if the signature handler is not found. """ return _PDFNetPython.Field_UseSignatureHandler(self, signature_handler_id)
[docs] def IsLockedByDigitalSignature(self): r""" Returns whether modifying this field would invalidate a digital signature in the document. :rtype: boolean :return: whether modifying this field would invalidate a digital signature in the document """ return _PDFNetPython.Field_IsLockedByDigitalSignature(self)
mp_field = property(_PDFNetPython.Field_mp_field_get, _PDFNetPython.Field_mp_field_set) def __init__(self, args): _PDFNetPython.Field_swiginit(self, _PDFNetPython.new_Field(args))
# Register Field in _PDFNetPython: _PDFNetPython.Field_swigregister(Field)
[docs] class TimestampingResult(object): r"""A class representing the result of testing a timestamping configuration.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_TimestampingResult
[docs] def Destroy(self): return _PDFNetPython.TimestampingResult_Destroy(self)
[docs] def GetStatus(self): r""" Retrieves the overall status of the timestamping configuration testing operation. :rtype: boolean :return: a boolean value representing the status. """ return _PDFNetPython.TimestampingResult_GetStatus(self)
[docs] def GetString(self): r""" Retrieves a result message regarding the timestamping configuration testing operation. :rtype: string :return: a string result message. Notes: Output may change in future versions. """ return _PDFNetPython.TimestampingResult_GetString(self)
[docs] def HasResponseVerificationResult(self): r""" Returns whether a timestamp response verification result is available. This means that false will be returned when a timestamp response was not received or was empty (e.g. network failures, improper server configuration, bad URL, etc.). This function should be called to check for the availability of a verification result before actually attempting to retrieve one using GetResponseVerificationResult (which throws if a result is not available). :rtype: boolean :return: whether a timestamp response verification result is available """ return _PDFNetPython.TimestampingResult_HasResponseVerificationResult(self)
[docs] def GetResponseVerificationResult(self): r""" If a timestamp response was successfully retrieved from a timestamp authority, returns the result of verifying it. If a timestamp response was not received, throws. One should call HasResponseVerificationResult first to see if a detailed result is available before calling this function. :rtype: :py:class:`EmbeddedTimestampVerificationResult` :return: a timestamp response verification result """ return _PDFNetPython.TimestampingResult_GetResponseVerificationResult(self)
[docs] def GetData(self): r""" If GetStatus gives true, returns the data from the completed timestamping operation, otherwise throws. If this result was returned from TimestampOnNextSave, then this data is the timestamp token. However, if this result was returned from GenerateContentsWithEmbeddedTimestamp, then this data is the main document CMS signature of the DigitalSignatureField but with a newly-added embedded timestamp (unsigned signature-time-stamp attribute as specified in PAdES and PDF 2.0). :rtype: std::vector< UChar,std::allocator< UChar > > :return: the data representing the result of the timestamping operation, if GetStatus gives true """ return _PDFNetPython.TimestampingResult_GetData(self)
def __init__(self, args): _PDFNetPython.TimestampingResult_swiginit(self, _PDFNetPython.new_TimestampingResult(args)) m_impl = property(_PDFNetPython.TimestampingResult_m_impl_get, _PDFNetPython.TimestampingResult_m_impl_set)
# Register TimestampingResult in _PDFNetPython: _PDFNetPython.TimestampingResult_swigregister(TimestampingResult)
[docs] class TimestampingConfiguration(object): r"""A class representing a set of options for timestamping a document.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_TimestampingConfiguration
[docs] def Destroy(self): return _PDFNetPython.TimestampingConfiguration_Destroy(self)
[docs] def SetTimestampAuthorityServerURL(self, in_url): r""" Setter to change the timestamp authority (TSA) URL to use during timestamping. :type in_url: string :param in_url: -- a string representing a URL of a timestamp authority. """ return _PDFNetPython.TimestampingConfiguration_SetTimestampAuthorityServerURL(self, in_url)
[docs] def SetTimestampAuthorityServerUsername(self, in_username): r""" Setter for a username to use during timestamping. :type in_username: string :param in_username: -- a string representing a username. """ return _PDFNetPython.TimestampingConfiguration_SetTimestampAuthorityServerUsername(self, in_username)
[docs] def SetTimestampAuthorityServerPassword(self, in_password): r""" Setter for a password to use during timestamping. :type in_password: string :param in_password: -- a string representing a password. """ return _PDFNetPython.TimestampingConfiguration_SetTimestampAuthorityServerPassword(self, in_password)
[docs] def SetUseNonce(self, in_use_nonce): r""" Setter for whether to use a nonce (unique random number) during timestamping. This is on by default, and should be on whenever a timestamp authority supports it, because it helps prevent replay attacks. :type in_use_nonce: boolean :param in_use_nonce: -- a boolean value representing whether or not to use a nonce """ return _PDFNetPython.TimestampingConfiguration_SetUseNonce(self, in_use_nonce)
[docs] def TestConfiguration(self, in_opts): r""" Tests a timestamping configuration for usability and reports any failures. This function does not throw on many common failures, unlike the real signing, thereby allowing early diagnosis of things like connectivity issues with timestamp authorities. :type in_opts: :py:class:`VerificationOptions` :param in_opts: -- a set of verification options to try to use :rtype: :py:class:`TimestampingResult` :return: A result object containing information about the status of the configuration test and any errors that occurred during it. """ return _PDFNetPython.TimestampingConfiguration_TestConfiguration(self, in_opts)
def __init__(self, args): _PDFNetPython.TimestampingConfiguration_swiginit(self, _PDFNetPython.new_TimestampingConfiguration(args)) m_impl = property(_PDFNetPython.TimestampingConfiguration_m_impl_get, _PDFNetPython.TimestampingConfiguration_m_impl_set)
# Register TimestampingConfiguration in _PDFNetPython: _PDFNetPython.TimestampingConfiguration_swigregister(TimestampingConfiguration)
[docs] class ObjectIdentifier(object): r"""This class represents an object identifier (OID), as defined by ITU and used in X.509.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_commonName = _PDFNetPython.ObjectIdentifier_e_commonName e_surname = _PDFNetPython.ObjectIdentifier_e_surname e_countryName = _PDFNetPython.ObjectIdentifier_e_countryName e_localityName = _PDFNetPython.ObjectIdentifier_e_localityName e_stateOrProvinceName = _PDFNetPython.ObjectIdentifier_e_stateOrProvinceName e_streetAddress = _PDFNetPython.ObjectIdentifier_e_streetAddress e_organizationName = _PDFNetPython.ObjectIdentifier_e_organizationName e_organizationalUnitName = _PDFNetPython.ObjectIdentifier_e_organizationalUnitName e_SHA1 = _PDFNetPython.ObjectIdentifier_e_SHA1 e_SHA256 = _PDFNetPython.ObjectIdentifier_e_SHA256 e_SHA384 = _PDFNetPython.ObjectIdentifier_e_SHA384 e_SHA512 = _PDFNetPython.ObjectIdentifier_e_SHA512 e_RIPEMD160 = _PDFNetPython.ObjectIdentifier_e_RIPEMD160 e_RSA_encryption_PKCS1 = _PDFNetPython.ObjectIdentifier_e_RSA_encryption_PKCS1 e_RSASSA_PSS = _PDFNetPython.ObjectIdentifier_e_RSASSA_PSS e_MGF1 = _PDFNetPython.ObjectIdentifier_e_MGF1 __swig_destroy__ = _PDFNetPython.delete_ObjectIdentifier
[docs] def Destroy(self): return _PDFNetPython.ObjectIdentifier_Destroy(self)
[docs] def GetRawValue(self): r""" Retrieves the value of the object identifier. :rtype: std::vector< int,std::allocator< int > > :return: the value of the object identifier, as a container of integer components. """ return _PDFNetPython.ObjectIdentifier_GetRawValue(self)
def __init__(self, args): _PDFNetPython.ObjectIdentifier_swiginit(self, _PDFNetPython.new_ObjectIdentifier(args)) m_impl = property(_PDFNetPython.ObjectIdentifier_m_impl_get, _PDFNetPython.ObjectIdentifier_m_impl_set)
# Register ObjectIdentifier in _PDFNetPython: _PDFNetPython.ObjectIdentifier_swigregister(ObjectIdentifier)
[docs] class AlgorithmParams(object): r"""Base class for AlgorithmIdentifier parameters.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_AlgorithmParams def __init__(self, args): _PDFNetPython.AlgorithmParams_swiginit(self, _PDFNetPython.new_AlgorithmParams(args)) m_impl = property(_PDFNetPython.AlgorithmParams_m_impl_get, _PDFNetPython.AlgorithmParams_m_impl_set)
# Register AlgorithmParams in _PDFNetPython: _PDFNetPython.AlgorithmParams_swigregister(AlgorithmParams)
[docs] class AlgorithmIdentifier(object): r""" This class represents an algorithm identifier, as defined by ITU and used in X.509. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_AlgorithmIdentifier def __init__(self, args): _PDFNetPython.AlgorithmIdentifier_swiginit(self, _PDFNetPython.new_AlgorithmIdentifier(args)) m_impl = property(_PDFNetPython.AlgorithmIdentifier_m_impl_get, _PDFNetPython.AlgorithmIdentifier_m_impl_set)
# Register AlgorithmIdentifier in _PDFNetPython: _PDFNetPython.AlgorithmIdentifier_swigregister(AlgorithmIdentifier)
[docs] class RSASSAPSSParams(AlgorithmParams): r"""The parameters for RSASSA-PSS algorithm""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): r""" Overload 1: Initialize RSASSA-PSS parameters with default values specified in RFC 4055. | Overload 2: Initialize RSASSA-PSS parameters with MGF1 for a given digest algorithm and salt length. :type digest_algorithm_id: :py:class:`AlgorithmIdentifier` :param digest_algorithm_id: The digest algorithm. :type salt_length: int :param salt_length: The salt length. """ _PDFNetPython.RSASSAPSSParams_swiginit(self, _PDFNetPython.new_RSASSAPSSParams(args))
[docs] def GetDigestAlgorithm(self): r""" Get the digest algorithm parameter value. :rtype: :py:class:`AlgorithmIdentifier` :return: The digest algorithm. """ return _PDFNetPython.RSASSAPSSParams_GetDigestAlgorithm(self)
[docs] def SetDigestAlgorithm(self, value): r""" Set the digest algorithm parameter value. :type value: :py:class:`AlgorithmIdentifier` :param value: The digest algorithm. """ return _PDFNetPython.RSASSAPSSParams_SetDigestAlgorithm(self, value)
[docs] def GetMaskGenAlgorithm(self): r""" Get the mask generation function parameter value. :rtype: :py:class:`AlgorithmIdentifier` :return: The mask generation function. """ return _PDFNetPython.RSASSAPSSParams_GetMaskGenAlgorithm(self)
[docs] def SetMaskGenAlgorithm(self, value): r""" Set the mask generation function parameter value. :type value: :py:class:`AlgorithmIdentifier` :param value: The mask generation function. """ return _PDFNetPython.RSASSAPSSParams_SetMaskGenAlgorithm(self, value)
[docs] def GetSaltLength(self): r""" Get the salt length parameter value. :rtype: int :return: The salt length. """ return _PDFNetPython.RSASSAPSSParams_GetSaltLength(self)
[docs] def SetSaltLength(self, value): r""" Set the salt length parameter value. :type value: int :param value: The salt length. """ return _PDFNetPython.RSASSAPSSParams_SetSaltLength(self, value)
[docs] def GetTrailerField(self): r""" Get the trailer field parameter value. :rtype: int :return: The trailer field. """ return _PDFNetPython.RSASSAPSSParams_GetTrailerField(self)
[docs] def SetTrailerField(self, value): r""" Set the trailer field parameter value. :type value: int :param value: The trailer field. """ return _PDFNetPython.RSASSAPSSParams_SetTrailerField(self, value)
__swig_destroy__ = _PDFNetPython.delete_RSASSAPSSParams
# Register RSASSAPSSParams in _PDFNetPython: _PDFNetPython.RSASSAPSSParams_swigregister(RSASSAPSSParams)
[docs] class X501DistinguishedName(object): r""" This class represents a distinguished name (DN) as defined in X.501. See the X.500 standards, RFC 5280, and an OID repository for more information. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_X501DistinguishedName
[docs] def Destroy(self): return _PDFNetPython.X501DistinguishedName_Destroy(self)
[docs] def HasAttribute(self, in_oid): r""" Returns whether this distinguished name contains a particular attribute, identified by its object identifier (OID). :type in_oid: :py:class:`ObjectIdentifier` :param in_oid: the object identifier representing the sought attribute. :rtype: boolean :return: a boolean value representing whether this distinguished name contains the supplied attribute. """ return _PDFNetPython.X501DistinguishedName_HasAttribute(self, in_oid)
[docs] def GetStringValuesForAttribute(self, in_oid): r""" Returns a container full of string representations of all the values in this distinguished name that match a particular attribute's object identifier (OID). If an attribute's OID defines the corresponding value to not be of a string type, then that value will not be returned from this function. :type in_oid: :py:class:`ObjectIdentifier` :param in_oid: the object identifier representing the sought attribute. :rtype: std::vector< std::string,std::allocator< std::string > > :return: a container of string values containing any strings associated with the supplied attribute """ return _PDFNetPython.X501DistinguishedName_GetStringValuesForAttribute(self, in_oid)
[docs] def GetAllAttributesAndValues(self): r""" Retrieves all of the attribute-type-to-value pairs in this distinguished name. :rtype: std::vector< Crypto::X501AttributeTypeAndValue,std::allocator< Crypto::X501AttributeTypeAndValue > > :return: a container of X501AttributeTypeAndValue objects """ return _PDFNetPython.X501DistinguishedName_GetAllAttributesAndValues(self)
def __init__(self, args): _PDFNetPython.X501DistinguishedName_swiginit(self, _PDFNetPython.new_X501DistinguishedName(args)) m_impl = property(_PDFNetPython.X501DistinguishedName_m_impl_get, _PDFNetPython.X501DistinguishedName_m_impl_set)
# Register X501DistinguishedName in _PDFNetPython: _PDFNetPython.X501DistinguishedName_swigregister(X501DistinguishedName)
[docs] class X501AttributeTypeAndValue(object): r"""This class represents an AttributeTypeAndValue as mentioned in RFC 5280 in the context of DistinguishedNames and as defined in ITU X.501.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def Destroy(self): return _PDFNetPython.X501AttributeTypeAndValue_Destroy(self)
[docs] def GetAttributeTypeOID(self): r""" Retrieves the OID (i.e. one of the object identifiers from the X.500 attribute types) in the form of integer components in a container. :rtype: :py:class:`ObjectIdentifier` :return: an ObjectIdentifier object. """ return _PDFNetPython.X501AttributeTypeAndValue_GetAttributeTypeOID(self)
[docs] def GetStringValue(self): r""" Retrieves the value associated with the contained OID (object identifier) as a string, if the value is defined by the OID to be of a string type. :rtype: string :return: a string containing the string value. """ return _PDFNetPython.X501AttributeTypeAndValue_GetStringValue(self)
__swig_destroy__ = _PDFNetPython.delete_X501AttributeTypeAndValue def __init__(self, args): _PDFNetPython.X501AttributeTypeAndValue_swiginit(self, _PDFNetPython.new_X501AttributeTypeAndValue(args)) m_impl = property(_PDFNetPython.X501AttributeTypeAndValue_m_impl_get, _PDFNetPython.X501AttributeTypeAndValue_m_impl_set)
# Register X501AttributeTypeAndValue in _PDFNetPython: _PDFNetPython.X501AttributeTypeAndValue_swigregister(X501AttributeTypeAndValue)
[docs] class X509Extension(object): r"""This class represents an X509v3 certificate extension. See RFC 5280 as a specification.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def Destroy(self): return _PDFNetPython.X509Extension_Destroy(self)
[docs] def IsCritical(self): r""" Retrieves whether the extension is 'critical'. See RFC 5280 for an explanation of what this means. :rtype: boolean :return: a boolean representing the criticality flag of the extension. """ return _PDFNetPython.X509Extension_IsCritical(self)
[docs] def GetObjectIdentifier(self): r""" Retrieves the OID (object identifier) of the extension in the form of integer components in a container. The meaning of an OID can be determined from an OID repository. :rtype: :py:class:`ObjectIdentifier` :return: an ObjectIdentifier object. """ return _PDFNetPython.X509Extension_GetObjectIdentifier(self)
[docs] def ToString(self): r""" Returns a string representation of the extension. :rtype: string :return: a string representation of the extension. Notes: Output may change in future versions. """ return _PDFNetPython.X509Extension_ToString(self)
[docs] def GetData(self): r""" Retrieves the raw binary DER-encoded data of the extension. (DER is short for Distinguished Encoding Rules.) :rtype: std::vector< UChar,std::allocator< UChar > > :return: a container holding the bytes of the extension in the form of binary DER-encoded data """ return _PDFNetPython.X509Extension_GetData(self)
__swig_destroy__ = _PDFNetPython.delete_X509Extension def __init__(self, args): _PDFNetPython.X509Extension_swiginit(self, _PDFNetPython.new_X509Extension(args)) m_impl = property(_PDFNetPython.X509Extension_m_impl_get, _PDFNetPython.X509Extension_m_impl_set)
# Register X509Extension in _PDFNetPython: _PDFNetPython.X509Extension_swigregister(X509Extension)
[docs] class X509Certificate(object): r"""This class represents an X509 public-key certificate, as specified in RFC 5280.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_X509Certificate
[docs] def Destroy(self): return _PDFNetPython.X509Certificate_Destroy(self)
[docs] def GetIssuerField(self): r""" Retrieves the names of the certificate issuer as a map of OIDs (i.e. one of the object identifiers from the X.500 attribute types) to string values. The issuer field identifies the entity that has signed and issued the certificate. The returned value will contain all of the AttributeTypeAndValue items from all of the RelativeDistinguishedNames in the Name of the issuer. See RFC 5280, section 4.1.2.4 and Appendix A.1 (page 116). :rtype: :py:class:`X501DistinguishedName` :return: an X501DistinguishedName object """ return _PDFNetPython.X509Certificate_GetIssuerField(self)
[docs] def GetSubjectField(self): r""" Retrieves the names of the certificate subject as a map of OIDs (i.e. one of the object identifiers from the X.500 attribute types) to string values. The subject field represents the identity of the entity associated with the certificate's public key. The returned value will contain all of the AttributeTypeAndValue items from all of the RelativeDistinguishedNames in the Name of the subject. See RFC 5280, section 4.1.2.6 and Appendix A.1 (page 116). :rtype: :py:class:`X501DistinguishedName` :return: an X501DistinguishedName object """ return _PDFNetPython.X509Certificate_GetSubjectField(self)
[docs] def GetNotBeforeEpochTime(self): r""" Retrieves the notBefore time from the certificate's Validity entry in the form of an integral value representing an epoch time. :rtype: int :return: an integer containing an epoch time """ return _PDFNetPython.X509Certificate_GetNotBeforeEpochTime(self)
[docs] def GetNotAfterEpochTime(self): r""" Retrieves the notAfter time from the certificate's Validity entry in the form of an integral value representing an epoch time. :rtype: int :return: an integer containing an epoch time """ return _PDFNetPython.X509Certificate_GetNotAfterEpochTime(self)
[docs] def GetRawX509VersionNumber(self): r""" Retrieves the version number representing which version of X509 the certificate corresponds to, from the certificate. :rtype: int :return: an integer containing the version number Notes: The X509 version number in the certificate, which we return unchanged here, is zero-indexed and therefore is one less in value than the actual version. e.g. X509v3 is represented by a returned version number of 2. """ return _PDFNetPython.X509Certificate_GetRawX509VersionNumber(self)
[docs] def ToString(self): r""" Returns a string representation of the certificate. :rtype: string :return: a string representation of the certificate. Notes: Output may change in future versions. """ return _PDFNetPython.X509Certificate_ToString(self)
[docs] def GetFingerprint(self, args): r""" Retrieves, in a string, a text representation of a cryptographically-secure digest of the certificate that can be used to identify it uniquely. :type in_digest_algorithm: int :param in_digest_algorithm: An enumeration representing the digest algorithm to use. Currently supported are SHA-1 (SHA-160), SHA-256, SHA-384, and SHA-512. :rtype: string :return: a string representation of the fingerprint, in the form of double ASCII characters representing hex bytes, separated by colons Notes: Default algorithm parameter is currently SHA-256, but may change in future without further warning, pursuant to security needs. """ return _PDFNetPython.X509Certificate_GetFingerprint(self, args)
[docs] def GetSerialNumber(self): r""" Retrieves the serialNumber entry from the certificate. :rtype: std::vector< UChar,std::allocator< UChar > > :return: a big-integer-style container holding bytes representing the components of an integral serial number in big-endian order. """ return _PDFNetPython.X509Certificate_GetSerialNumber(self)
[docs] def GetExtensions(self): r""" Retrieves all extensions (as first specified in V3 of X509, see RFC 5280) from the certificate. :rtype: std::vector< Crypto::X509Extension,std::allocator< Crypto::X509Extension > > :return: a container of X509Extension objects. """ return _PDFNetPython.X509Certificate_GetExtensions(self)
[docs] def GetData(self): r""" Retrieves the certificate as binary DER-encoded data. (DER is short for Distinguished Encoding Rules.). :rtype: std::vector< UChar,std::allocator< UChar > > :return: a container of bytes representing the certificate, encoded as binary DER. """ return _PDFNetPython.X509Certificate_GetData(self)
def __init__(self, args): _PDFNetPython.X509Certificate_swiginit(self, _PDFNetPython.new_X509Certificate(args)) m_impl = property(_PDFNetPython.X509Certificate_m_impl_get, _PDFNetPython.X509Certificate_m_impl_set)
# Register X509Certificate in _PDFNetPython: _PDFNetPython.X509Certificate_swigregister(X509Certificate)
[docs] class DisallowedChange(object): r""" The class DisallowedChange. Data pertaining to a change detected in a document during a digital signature modification permissions verification step, the change bein g both made after the signature was signed, and disallowed by t he signature's permissions settings. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_form_filled = _PDFNetPython.DisallowedChange_e_form_filled e_digital_signature_signed = _PDFNetPython.DisallowedChange_e_digital_signature_signed e_page_template_instantiated = _PDFNetPython.DisallowedChange_e_page_template_instantiated e_annotation_created_or_updated_or_deleted = _PDFNetPython.DisallowedChange_e_annotation_created_or_updated_or_deleted e_other = _PDFNetPython.DisallowedChange_e_other e_unknown = _PDFNetPython.DisallowedChange_e_unknown def __init__(self, args): _PDFNetPython.DisallowedChange_swiginit(self, _PDFNetPython.new_DisallowedChange(args)) __swig_destroy__ = _PDFNetPython.delete_DisallowedChange
[docs] def Destroy(self): return _PDFNetPython.DisallowedChange_Destroy(self)
[docs] def GetObjNum(self): r""" Returns the SDF object number of the indirect object associated with this DisallowedChange. :rtype: int :return: An unsigned 32-bit integer value. """ return _PDFNetPython.DisallowedChange_GetObjNum(self)
[docs] def GetType(self): r""" Returns an enumeration value representing the semantic type of this disallowed change. :rtype: int :return: An enumeration value of type: Type of DisallowedChange. """ return _PDFNetPython.DisallowedChange_GetType(self)
[docs] def GetTypeAsString(self): r""" Returns a string value representing the semantic type of this disallowed change. :rtype: string :return: A string. """ return _PDFNetPython.DisallowedChange_GetTypeAsString(self)
m_impl = property(_PDFNetPython.DisallowedChange_m_impl_get, _PDFNetPython.DisallowedChange_m_impl_set)
# Register DisallowedChange in _PDFNetPython: _PDFNetPython.DisallowedChange_swigregister(DisallowedChange)
[docs] class FDFField(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): _PDFNetPython.FDFField_swiginit(self, _PDFNetPython.new_FDFField(args))
[docs] def GetValue(self): r""" :rtype: :py:class:`Obj` :return: the value of the Field (the value of its /V key) or NULL if the value is not specified. The format of field's value varies depending on the field type. """ return _PDFNetPython.FDFField_GetValue(self)
[docs] def SetValue(self, value): r""" Sets the value of the FDFField (the value of the field's /V key). :type value: :py:class:`Obj` :param value: - the value to set the FDFField to Notes: in order to remove/erase the existing value use SetValue(SDF::Null) """ return _PDFNetPython.FDFField_SetValue(self, value)
[docs] def GetName(self): r""" :rtype: string :return: a string representing the fully qualified name of the field (e.g. "employee.name.first"). """ return _PDFNetPython.FDFField_GetName(self)
[docs] def GetPartialName(self): r""" :rtype: string :return: a string representing the partial name of the field (e.g. "first" when "employee.name.first" is fully qualified name). """ return _PDFNetPython.FDFField_GetPartialName(self)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: the object to the underlying SDF/Cos object. """ return _PDFNetPython.FDFField_GetSDFObj(self)
[docs] def FindAttribute(self, attrib): r""" The function returns the specified attribute. :type attrib: string :param attrib: - name of the attribute to find :rtype: :py:class:`Obj` :return: return the attribute value if the given attribute name was found or a NULL object if the given attribute name was not found. """ return _PDFNetPython.FDFField_FindAttribute(self, attrib)
def __nonzero__(self): return _PDFNetPython.FDFField___nonzero__(self) __bool__ = __nonzero__ __swig_destroy__ = _PDFNetPython.delete_FDFField
# Register FDFField in _PDFNetPython: _PDFNetPython.FDFField_swigregister(FDFField)
[docs] class FDFDoc(object): r""" FDFDoc is a class representing Forms Data Format (FDF) documents. FDF is typically used when submitting form data to a server, receiving the response, and incorporating it into the interactive form. It can also be used to export form data to stand-alone files that can be stored, transmitted electronically, and imported back into the corresponding PDF interactive form. In addition, beginning in PDF 1.3, FDF can be used to define a container for annotations that are separate from the PDF document to which they apply. Note: While theructor does not, a few methods in FDFDoc will cause it to count as a document for the consumption-based licensing if was not created through PDFDoc::FDFExtract(). Please consult individual API documentation for exact details. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_FDFDoc
[docs] def Close(self): r""" Close FDFDoc""" return _PDFNetPython.FDFDoc_Close(self)
[docs] def IsModified(self): r""" :rtype: boolean :return: - true if document was modified, false otherwise """ return _PDFNetPython.FDFDoc_IsModified(self)
[docs] def Save(self, args): r""" Overload 1: Saves the document to a file. If a full save is requested to the original path, the file is saved to a file system-determined temporary file, the old file is deleted, and the temporary file is renamed to path. A full save with remove unused or linearization option may re-arrange object in the cross reference table. Therefore all pointers and references to document objects and resources should be re acquired in order to continue document editing. In order to use incremental save the specified path must match original path and e_incremental flag bit should be set. :type path: string :param path: - The full path name to which the file is saved. :raises: - if the file can't be opened for saving or if there is a problem during Save an Exception object will be thrown. Notes: This method will count as a document usage for consumption-based licensing if the current document has not yet been counted. | Overload 2: Saves the document to a memory buffer. :raises: - if there is a problem during Save an Exception object will be thrown. Notes: This method will count as a document usage for consumption-based licensing if the current document has not yet been counted. """ return _PDFNetPython.FDFDoc_Save(self, args)
[docs] def GetTrailer(self): r""" :rtype: :py:class:`Obj` :return: - A dictionary representing the Cos root of the document (document's trailer) Notes: This method will count as a document usage for consumption-based licensing if the current document has not yet been counted. """ return _PDFNetPython.FDFDoc_GetTrailer(self)
[docs] def GetRoot(self): r""" :rtype: :py:class:`Obj` :return: - A dictionary representing the Cos root of the document (/Root entry within the trailer dictionary) Notes: This method will count as a document usage for consumption-based licensing if the current document has not yet been counted. """ return _PDFNetPython.FDFDoc_GetRoot(self)
[docs] def GetFDF(self): r""" :rtype: :py:class:`Obj` :return: the FDF dictionary located in "/Root" or NULL if dictionary is not present. """ return _PDFNetPython.FDFDoc_GetFDF(self)
[docs] def GetPDFFileName(self): r""" Get the PDF document file that this FDF file was exported from or is intended to be imported into. :rtype: string :return: a String with the PDF document file name. """ return _PDFNetPython.FDFDoc_GetPDFFileName(self)
[docs] def SetPDFFileName(self, filepath): r""" Set the PDF document file that this FDF file was exported from or is intended to be imported into. :type filepath: string :param filepath: - pathname to the file. """ return _PDFNetPython.FDFDoc_SetPDFFileName(self, filepath)
[docs] def GetID(self): r""" Get the ID entry from "/Root/FDF" dictionary. :rtype: :py:class:`Obj` :return: - An object representing the ID entry in "/Root/FDF" dictionary. """ return _PDFNetPython.FDFDoc_GetID(self)
[docs] def SetID(self, id): r""" Set the ID entry in "/Root/FDF" dictionary. :type id: :py:class:`Obj` :param id: - ID array object. """ return _PDFNetPython.FDFDoc_SetID(self, id)
[docs] def GetFieldIterator(self, args): r""" Overload 1: An interactive form (sometimes referred to as an AcroForm) is a collection of fields for gathering information interactively from the user. A FDF document may contain any number of fields appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document. The following methods are used to access and manipulate Interactive form fields (sometimes referred to as AcroForms). :rtype: :py:class:`FDFFieldIterator` :return: an iterator to the first FDFField in the document. Notes: if the document has no AcroForms, HasNext() will return false. | Overload 2: An interactive form (sometimes referred to as an AcroForm) is a collection of fields for gathering information interactively from the user. A FDF document may contain any number of fields appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document. The following methods are used to access and manipulate Interactive form fields (sometimes referred to as AcroForms). :type field_name: string :param field_name: String representing the name of the FDFField to get. :rtype: :py:class:`FDFFieldIterator` :return: an iterator to the FDFField in the document. Notes: if the document has no AcroForms, HasNext() will return false. """ return _PDFNetPython.FDFDoc_GetFieldIterator(self, args)
[docs] def GetField(self, field_name): r""" :type field_name: string :param field_name: - a string representing the fully qualified name of the field (e.g. "employee.name.first"). :rtype: :py:class:`FDFField` :return: a FDFField associated with the given field_name or invalid field (null) if the field is not found. """ return _PDFNetPython.FDFDoc_GetField(self, field_name)
[docs] def FieldCreate(self, args): return _PDFNetPython.FDFDoc_FieldCreate(self, args)
[docs] def GetSDFDoc(self): r""" :rtype: :py:class:`SDFDoc` :return: document's SDF/Cos document Notes: This method will count as a document usage for consumption-based licensing if the current document has not yet been counted. """ return _PDFNetPython.FDFDoc_GetSDFDoc(self)
[docs] @staticmethod def CreateFromXFDF(file_name): r""" Create a new FDFDoc from XFDF input. Input can be either a XFDF file path, or the XFDF data itself. :type file_name: string :param file_name: - string containing either the file path to a XFDF file, or the XML buffer containing the XFDF. :rtype: :py:class:`FDFDoc` :return: A new FDFDoc. """ return _PDFNetPython.FDFDoc_CreateFromXFDF(file_name)
[docs] def SaveAsXFDF(self, args): r""" Overload 1: Export FDF file as an XFDF file :type filepath: string :param filepath: - the filepath of the exported XFDF file | Overload 2: Export FDF file as an XFDF file :type filepath: string :param filepath: - the filepath of the exported XFDF file :type opts: FDF::XFDFExportOptions :param opts: Options controlling finer parameters of xfdf export | Overload 3: Export FDF file as a XFDF string :param opts: Options controlling finer parameters of xfdf export | Overload 4: Export FDF file as a XFDF string :type opts: FDF::XFDFExportOptions :param opts: Options controlling finer parameters of xfdf export :rtype: string :return: A UString containing the XFDF representation of the FDF file """ return _PDFNetPython.FDFDoc_SaveAsXFDF(self, args)
[docs] def MergeAnnots(self, args): r""" Merge the annotations from XFDF file into FDF file :type command_file: string :param command_file: - string containing the xml command file path or xml string of the command :type permitted_user: string :param permitted_user: - optional user name of the permitted user """ return _PDFNetPython.FDFDoc_MergeAnnots(self, args)
def __init__(self, args): _PDFNetPython.FDFDoc_swiginit(self, _PDFNetPython.new_FDFDoc(args)) mp_doc = property(_PDFNetPython.FDFDoc_mp_doc_get, _PDFNetPython.FDFDoc_mp_doc_set)
# Register FDFDoc in _PDFNetPython: _PDFNetPython.FDFDoc_swigregister(FDFDoc)
[docs] def FDFDoc_CreateFromXFDF(file_name): r""" Create a new FDFDoc from XFDF input. Input can be either a XFDF file path, or the XFDF data itself. :type file_name: string :param file_name: - string containing either the file path to a XFDF file, or the XML buffer containing the XFDF. :rtype: :py:class:`FDFDoc` :return: A new FDFDoc. """ return _PDFNetPython.FDFDoc_CreateFromXFDF(file_name)
[docs] class VerificationOptions(object): r"""Options pertaining to digital signature verification.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_compatibility_and_archiving = _PDFNetPython.VerificationOptions_e_compatibility_and_archiving e_maximum = _PDFNetPython.VerificationOptions_e_maximum e_signing = _PDFNetPython.VerificationOptions_e_signing e_timestamp = _PDFNetPython.VerificationOptions_e_timestamp e_current = _PDFNetPython.VerificationOptions_e_current e_signing_trust = _PDFNetPython.VerificationOptions_e_signing_trust e_certification_trust = _PDFNetPython.VerificationOptions_e_certification_trust e_dynamic_content = _PDFNetPython.VerificationOptions_e_dynamic_content e_javascript = _PDFNetPython.VerificationOptions_e_javascript e_identity = _PDFNetPython.VerificationOptions_e_identity e_trust_anchor = _PDFNetPython.VerificationOptions_e_trust_anchor e_default_trust = _PDFNetPython.VerificationOptions_e_default_trust e_complete_trust = _PDFNetPython.VerificationOptions_e_complete_trust __swig_destroy__ = _PDFNetPython.delete_VerificationOptions
[docs] def Destroy(self): return _PDFNetPython.VerificationOptions_Destroy(self)
def __init__(self, args): r""" Constructs a set of options for digital signature verification. :type level: int :param level: -- the general security level to use. Sets other security settings internally. """ _PDFNetPython.VerificationOptions_swiginit(self, _PDFNetPython.new_VerificationOptions(args))
[docs] def AddTrustedCertificate(self, args): r""" Overload 1: Adds a certificate to the store of trusted certificates inside this options object. :type in_certificate_buf: UChar :param in_certificate_buf: -- a buffer consisting of the data of an X.509 public-key certificate encoded in binary DER (Distinguished Encoding Rules) format, or in PEM (appropriate Privacy-Enhanced Mail header+Base64 encoded DER+appropriate footer) format :type in_buf_size: int :param in_buf_size: -- buffer size :type in_trust_flags: int :param in_trust_flags: -- a combination of trust flags (see enum CertificateTrustFlag) that determine for which situations this certificate should be trusted during trust verification. There is a default parameter value, the e_default_trust CertificateTrustFlag, which matches Acrobat's behaviour for this parameter. | Overload 2: Adds a certificate to the store of trusted certificates inside this options object, by loading it from a file. :type in_filepath: string :param in_filepath: -- a path to a file containing the data of an X.509 public-key certificate encoded in binary DER (Distinguished Encoding Rules) format, or in PEM (appropriate Privacy-Enhanced Mail header+Base64 encoded DER+appropriate footer) format. :type in_trust_flags: int :param in_trust_flags: -- a combination of trust flags (see enum CertificateTrustFlag) that determine for which situations this certificate should be trusted during trust verification. There is a default parameter value, the e_default_trust CertificateTrustFlag, which matches Acrobat's behaviour for this parameter. | Overload 3: Adds a certificate to the store of trusted certificates inside this options object, by loading it from a file. :type in_filepath: string :param in_filepath: -- a path to a file containing the data of an X.509 public-key certificate encoded in binary DER (Distinguished Encoding Rules) format, or in PEM (appropriate Privacy-Enhanced Mail header+Base64 encoded DER+appropriate footer) format. :param in_trust_flags: -- a combination of trust flags (see enum CertificateTrustFlag) that determine for which situations this certificate should be trusted during trust verification. There is a default parameter value, the e_default_trust CertificateTrustFlag, which matches Acrobat's behaviour for this parameter. """ return _PDFNetPython.VerificationOptions_AddTrustedCertificate(self, args)
[docs] def AddTrustedCertificates(self, in_P7C_binary_DER_certificates_file_data, in_size): r""" Bulk trust list loading API from P7C. Attempts to decode the input data as binary DER and trust multiple trusted root certificates from it. Compatible with Acrobat's .P7C format, which is a variation on PKCS #7/CMS that only contains certificates (i.e. no CRLs, no signature, etc.). If a certificate cannot be decoded, this is ignored and an attempt is made to decode the next certificate. This overload takes no account of trust-level flags because none are available in the P7C format. Therefore, when this function is used, all certificates in the P7C file will be loaded as if trusted for everything, which may lead to false positives when compared to other PDF software. (Most applications use the FDF Cert Exchange format.) The FDF-trust-list-loading function "LoadTrustList" should be used instead whenever possible. :type in_P7C_binary_DER_certificates_file_data: UChar :param in_P7C_binary_DER_certificates_file_data: -- the P7C-format bulk certificate data, encoded in binary DER (Distinguished Encoding Rules) :type in_size: int :param in_size: -- the size of the data, in bytes """ return _PDFNetPython.VerificationOptions_AddTrustedCertificates(self, in_P7C_binary_DER_certificates_file_data, in_size)
[docs] def LoadTrustList(self, in_fdf_cert_exchange_data): r""" Bulk trust list loading API with trust flag support. Loads a trust list that is structured in Acrobat's FDF Data/Cert Exchange format into the VerificationOptions certificate store. Use of this function is strongly recommended instead of the P7C API (i.e. AddTrustedCertificates). Certificates inside the FDF trust list that cannot be decoded and loaded, will be skipped. :type in_fdf_cert_exchange_data: :py:class:`FDFDoc` :param in_fdf_cert_exchange_data: -- an FDFDoc from the FDF cert exchange data """ return _PDFNetPython.VerificationOptions_LoadTrustList(self, in_fdf_cert_exchange_data)
[docs] def EnableModificationVerification(self, in_on_or_off): r""" Sets a flag that can turn on or off the verification of the permissibility of any modifications made to the document after the signing of the digital signature being verified, in terms of the document and field permissions specified by the digital signature being verified. :type in_on_or_off: boolean :param in_on_or_off: -- A boolean. """ return _PDFNetPython.VerificationOptions_EnableModificationVerification(self, in_on_or_off)
[docs] def EnableDigestVerification(self, in_on_or_off): r""" Sets a flag that can turn on or off the verification of the digest (cryptographic hash) component of a digital signature. :type in_on_or_off: boolean :param in_on_or_off: -- A boolean. """ return _PDFNetPython.VerificationOptions_EnableDigestVerification(self, in_on_or_off)
[docs] def EnableTrustVerification(self, in_on_or_off): r""" Sets a flag that can turn on or off the verification of the trust status of a digital signature. :type in_on_or_off: boolean :param in_on_or_off: -- A boolean. """ return _PDFNetPython.VerificationOptions_EnableTrustVerification(self, in_on_or_off)
[docs] def SetRevocationTimeout(self, in_revocation_timeout_milliseconds): r""" Sets the timeout for online revocation requests. :type in_revocation_timeout_milliseconds: int :param in_revocation_timeout_milliseconds: The timeout value in milliseconds. """ return _PDFNetPython.VerificationOptions_SetRevocationTimeout(self, in_revocation_timeout_milliseconds)
[docs] def EnableOnlineCRLRevocationChecking(self, in_on_or_off): r""" Enables/disables online CRL revocation checking. The default setting is for it to be turned off, but this may change in future versions. Notes: CRL checking is off by default because the technology is inherently complicated and resource-intensive, but may help improve verification rate when files are verified against a recent reference-time (e.g. maximum security mode), because online CRLs will be valid within that time. This mode will not be useful for old archival-type ('LTV') documents verified in archiving-and-compatibility security mode, because their online OCSP and/or CRL responder servers may not be alive anymore. However, such LTV documents can be created (if the CRL responder servers are still active) by enabling online checking, verifying, and then embedding the data using DigitalSignatureField.EnableLTVOfflineVerification. :type in_on_or_off: boolean :param in_on_or_off: -- what setting to use """ return _PDFNetPython.VerificationOptions_EnableOnlineCRLRevocationChecking(self, in_on_or_off)
[docs] def EnableOnlineOCSPRevocationChecking(self, in_on_or_off): r""" Enables/disables online OCSP revocation checking. The default setting is for it to be turned on. :type in_on_or_off: boolean :param in_on_or_off: -- what setting to use. """ return _PDFNetPython.VerificationOptions_EnableOnlineOCSPRevocationChecking(self, in_on_or_off)
[docs] def EnableOnlineRevocationChecking(self, in_on_or_off): r""" Enables/disables all online revocation checking modes. The default settings are that online OCSP is turned on and online CRL is turned off, but the default CRL setting may change in future versions. Notes: CRL checking is off by default because the technology is inherently complicated and resource-intensive, but may help improve verification rate when files are verified against a recent reference-time (e.g. maximum security mode), because online CRLs will be valid within that time. This mode will not be useful for old archival-type ('LTV') documents verified in archiving-and-compatibility security mode, because their online OCSP and/or CRL responder servers may not be alive anymore. However, such LTV documents can be created (if the CRL responder servers are still active) by enabling online checking, verifying, and then embedding the data using DigitalSignatureField.EnableLTVOfflineVerification. :type in_on_or_off: boolean :param in_on_or_off: -- what setting to use """ return _PDFNetPython.VerificationOptions_EnableOnlineRevocationChecking(self, in_on_or_off)
[docs] def GetTrustedCertificateCount(self): r""" Get the number of trusted certificates that have been added. :rtype: int :return: the number of trusted certificates. """ return _PDFNetPython.VerificationOptions_GetTrustedCertificateCount(self)
[docs] def GetTrustedCertificate(self, index): r""" Get the certificate at a specific position in the current list of trusted certificates. :type index: int :param index: -- the index of the certificate in the current list. :rtype: :py:class:`X509Certificate` :return: the certificate at position index in the list. """ return _PDFNetPython.VerificationOptions_GetTrustedCertificate(self, index)
m_impl = property(_PDFNetPython.VerificationOptions_m_impl_get, _PDFNetPython.VerificationOptions_m_impl_set)
# Register VerificationOptions in _PDFNetPython: _PDFNetPython.VerificationOptions_swigregister(VerificationOptions)
[docs] class TrustVerificationResult(object): r""" The detailed result of a trust verification step of a verification operation performed on a digital signature. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_TrustVerificationResult
[docs] def Destroy(self): return _PDFNetPython.TrustVerificationResult_Destroy(self)
[docs] def WasSuccessful(self): r""" Retrieves the trust verification status. :rtype: boolean :return: A boolean representing whether or not the trust verification operation was successful. Whether trust-related warnings are treated as errors or not depend on the VerificationOptions used for the verification operation. """ return _PDFNetPython.TrustVerificationResult_WasSuccessful(self)
[docs] def GetResultString(self): r""" Retrieves a string representation of the details of the trust verification status. :rtype: string :return: A string. Notes: Output may change in future versions. """ return _PDFNetPython.TrustVerificationResult_GetResultString(self)
[docs] def GetTimeOfTrustVerification(self): r""" Retrieves the reference-time used for trust verification as an epoch time. :rtype: int :return: An integral value representing an epoch time. """ return _PDFNetPython.TrustVerificationResult_GetTimeOfTrustVerification(self)
[docs] def GetTimeOfTrustVerificationEnum(self): r""" Retrieves the type of reference-time used for trust verification. :rtype: int :return: An enumerated value representing the type of reference-time used for trust verification. """ return _PDFNetPython.TrustVerificationResult_GetTimeOfTrustVerificationEnum(self)
[docs] def HasEmbeddedTimestampVerificationResult(self): r""" Returns whether this TrustVerificationResult has a detailed timestamp result inside. :rtype: boolean :return: a boolean value representing whether this TrustVerificationResult has a detailed timestamp result inside. """ return _PDFNetPython.TrustVerificationResult_HasEmbeddedTimestampVerificationResult(self)
[docs] def GetEmbeddedTimestampVerificationResult(self): r""" Returns the detailed timestamp result inside this TrustVerificationResult. One must call HasEmbeddedTimestampVerificationResult first to check whether the result is available. :rtype: :py:class:`EmbeddedTimestampVerificationResult` :return: an EmbeddedTimestampVerificationResult object. """ return _PDFNetPython.TrustVerificationResult_GetEmbeddedTimestampVerificationResult(self)
[docs] def GetCertPath(self): r""" Retrieves the certificate path that was used for verification. :rtype: std::vector< Crypto::X509Certificate,std::allocator< Crypto::X509Certificate > > :return: a container of X509Certificate objects """ return _PDFNetPython.TrustVerificationResult_GetCertPath(self)
def __init__(self, args): _PDFNetPython.TrustVerificationResult_swiginit(self, _PDFNetPython.new_TrustVerificationResult(args)) m_impl = property(_PDFNetPython.TrustVerificationResult_m_impl_get, _PDFNetPython.TrustVerificationResult_m_impl_set)
# Register TrustVerificationResult in _PDFNetPython: _PDFNetPython.TrustVerificationResult_swigregister(TrustVerificationResult)
[docs] class VerificationResult(object): r"""The result of a verification operation performed on a digital signature.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_no_error = _PDFNetPython.VerificationResult_e_no_error e_corrupt_file = _PDFNetPython.VerificationResult_e_corrupt_file e_unsigned = _PDFNetPython.VerificationResult_e_unsigned e_bad_byteranges = _PDFNetPython.VerificationResult_e_bad_byteranges e_corrupt_cryptographic_contents = _PDFNetPython.VerificationResult_e_corrupt_cryptographic_contents e_digest_invalid = _PDFNetPython.VerificationResult_e_digest_invalid e_digest_verified = _PDFNetPython.VerificationResult_e_digest_verified e_digest_verification_disabled = _PDFNetPython.VerificationResult_e_digest_verification_disabled e_weak_digest_algorithm_but_digest_verifiable = _PDFNetPython.VerificationResult_e_weak_digest_algorithm_but_digest_verifiable e_no_digest_status = _PDFNetPython.VerificationResult_e_no_digest_status e_unsupported_encoding = _PDFNetPython.VerificationResult_e_unsupported_encoding e_unsupported_digest_algorithm = _PDFNetPython.VerificationResult_e_unsupported_digest_algorithm e_trust_verified = _PDFNetPython.VerificationResult_e_trust_verified e_untrusted = _PDFNetPython.VerificationResult_e_untrusted e_trust_verification_disabled = _PDFNetPython.VerificationResult_e_trust_verification_disabled e_no_trust_status = _PDFNetPython.VerificationResult_e_no_trust_status e_unsupported_trust_features = _PDFNetPython.VerificationResult_e_unsupported_trust_features e_invalidated_by_disallowed_changes = _PDFNetPython.VerificationResult_e_invalidated_by_disallowed_changes e_has_allowed_changes = _PDFNetPython.VerificationResult_e_has_allowed_changes e_unmodified = _PDFNetPython.VerificationResult_e_unmodified e_permissions_verification_disabled = _PDFNetPython.VerificationResult_e_permissions_verification_disabled e_no_permissions_status = _PDFNetPython.VerificationResult_e_no_permissions_status e_unsupported_permissions_features = _PDFNetPython.VerificationResult_e_unsupported_permissions_features __swig_destroy__ = _PDFNetPython.delete_VerificationResult
[docs] def Destroy(self): return _PDFNetPython.VerificationResult_Destroy(self)
[docs] def GetVerificationStatus(self): r""" Retrieves the main verification status. The main status is determined based on the other statuses. Verification may fail for many reasons; some of these reasons are the presence of features that are not supported yet. It may be desirable for you to report unsupported signatures differently (for example, using a question mark rather than an X mark). Any unsupported features encountered can be retrieved by the use of the function GetUnsupportedFeatures on this class. :rtype: boolean :return: A boolean representing whether or not the verification operation was completely successful. """ return _PDFNetPython.VerificationResult_GetVerificationStatus(self)
[docs] def GetDocumentStatus(self): r""" Retrieves the document-related result condition associated with a digital signature verification operation. :rtype: int :return: A DocumentStatus-type enumeration value. """ return _PDFNetPython.VerificationResult_GetDocumentStatus(self)
[docs] def GetDigestStatus(self): r""" Retrieves the digest-related result condition associated with a digital signature verification operation. :rtype: int :return: A DigestStatus-type enumeration value. """ return _PDFNetPython.VerificationResult_GetDigestStatus(self)
[docs] def GetTrustStatus(self): r""" Retrieves the trust-related result condition associated with a digital signature verification operation. :rtype: int :return: A TrustStatus-type enumeration value. """ return _PDFNetPython.VerificationResult_GetTrustStatus(self)
[docs] def GetPermissionsStatus(self): r""" Retrieves the result condition about permissions checks performed on any unsigned modifications associated with a digital signature verification operation. :rtype: int :return: A ModificationPermissionsStatus-type enumeration value. """ return _PDFNetPython.VerificationResult_GetPermissionsStatus(self)
[docs] def HasTrustVerificationResult(self): r""" Returns whether there is a detailed TrustVerificationResult in this VerificationResult or not. :rtype: boolean :return: A boolean. """ return _PDFNetPython.VerificationResult_HasTrustVerificationResult(self)
[docs] def GetTrustVerificationResult(self): r""" Retrieves the detailed result associated with the trust step of the verification operation that returned this VerificationResult, if such a detailed trust result is available. Must call HasTrustVerificationResult first and check for a true result. :rtype: :py:class:`TrustVerificationResult` :return: a TrustVerificationResult object Notes: This function will throw if no TrustVerificationResult is available. """ return _PDFNetPython.VerificationResult_GetTrustVerificationResult(self)
[docs] def GetDisallowedChanges(self): r""" Retrieves a list of informational structures regarding any disallowed changes that have been made to the document since the signature associated with this verification result was signed. :rtype: std::vector< PDF::VerificationResult::DisallowedChange,std::allocator< PDF::VerificationResult::DisallowedChange > > :return: a collection of DisallowedChange objects. """ return _PDFNetPython.VerificationResult_GetDisallowedChanges(self)
[docs] def GetDigestAlgorithm(self): r""" Retrieves an enumeration value representing the digest algorithm used to sign the signature that is associated with this verification result. For DocTimeStamp signatures, returns the weakest algorithm found (between the CMS and message imprint digests). :rtype: int :return: A DigestAlgorithm enumeration value. """ return _PDFNetPython.VerificationResult_GetDigestAlgorithm(self)
[docs] def GetDocumentStatusAsString(self): r""" Retrieves the document-related result condition associated with a digital signature verification operation, as a descriptive string. :rtype: string :return: a string. """ return _PDFNetPython.VerificationResult_GetDocumentStatusAsString(self)
[docs] def GetDigestStatusAsString(self): r""" Retrieves the digest-related result condition associated with a digital signature verification operation, as a descriptive string. :rtype: string :return: a string. """ return _PDFNetPython.VerificationResult_GetDigestStatusAsString(self)
[docs] def GetTrustStatusAsString(self): r""" Retrieves the trust-related result condition associated with a digital signature verification operation, as a descriptive string. :rtype: string :return: a string. """ return _PDFNetPython.VerificationResult_GetTrustStatusAsString(self)
[docs] def GetPermissionsStatusAsString(self): r""" Retrieves the result condition about permissions checks performed on any unsigned modifications associated with a digital signature verification operation, as a descriptive string. :rtype: string :return: a string. """ return _PDFNetPython.VerificationResult_GetPermissionsStatusAsString(self)
[docs] def GetUnsupportedFeatures(self): r""" Retrieves reports about unsupported features encountered during verification. This function is the canonical source of information about all unsupported features encountered. Current possible values: "unsupported signature encoding", "usage rights signature", "legal content attestations", "unsupported digest algorithm" :rtype: std::vector< std::string,std::allocator< std::string > > :return: a container of strings representing unsupported features encountered during verification Notes: Output may change in future versions. """ return _PDFNetPython.VerificationResult_GetUnsupportedFeatures(self)
def __init__(self, args): _PDFNetPython.VerificationResult_swiginit(self, _PDFNetPython.new_VerificationResult(args)) m_impl = property(_PDFNetPython.VerificationResult_m_impl_get, _PDFNetPython.VerificationResult_m_impl_set)
# Register VerificationResult in _PDFNetPython: _PDFNetPython.VerificationResult_swigregister(VerificationResult)
[docs] class EmbeddedTimestampVerificationResult(object): r""" This class represents the result of verifying a secure embedded timestamp digital signature. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_EmbeddedTimestampVerificationResult
[docs] def Destroy(self): return _PDFNetPython.EmbeddedTimestampVerificationResult_Destroy(self)
[docs] def GetVerificationStatus(self): r""" Retrieves the main verification status. The main status is determined based on the other statuses. :rtype: boolean :return: A boolean representing whether or not the verification operation was completely successful. """ return _PDFNetPython.EmbeddedTimestampVerificationResult_GetVerificationStatus(self)
[docs] def GetCMSDigestStatus(self): r""" Retrieves the result condition associated with the CMS signed digest verification step. :rtype: int :return: A DigestStatus-type enumeration value. """ return _PDFNetPython.EmbeddedTimestampVerificationResult_GetCMSDigestStatus(self)
[docs] def GetMessageImprintDigestStatus(self): r""" Retrieves the result condition associated with the message imprint digest verification step. :rtype: int :return: A DigestStatus-type enumeration value. """ return _PDFNetPython.EmbeddedTimestampVerificationResult_GetMessageImprintDigestStatus(self)
[docs] def GetTrustStatus(self): r""" Retrieves the result condition associated with the trust verification step. :rtype: int :return: A TrustStatus-type enumeration value. """ return _PDFNetPython.EmbeddedTimestampVerificationResult_GetTrustStatus(self)
[docs] def GetCMSDigestStatusAsString(self): r""" Retrieves the result condition associated with the CMS signed digest verification step, as a descriptive string. :rtype: string :return: a string Notes: Output may change in future versions. """ return _PDFNetPython.EmbeddedTimestampVerificationResult_GetCMSDigestStatusAsString(self)
[docs] def GetMessageImprintDigestStatusAsString(self): r""" Retrieves the result condition associated with the message imprint digest verification step, as a descriptive string. :rtype: string :return: a string Notes: Output may change in future versions. """ return _PDFNetPython.EmbeddedTimestampVerificationResult_GetMessageImprintDigestStatusAsString(self)
[docs] def GetTrustStatusAsString(self): r""" Retrieves the result condition associated with the trust verification step, as a descriptive string. :rtype: string :return: a string Notes: Output may change in future versions. """ return _PDFNetPython.EmbeddedTimestampVerificationResult_GetTrustStatusAsString(self)
[docs] def HasTrustVerificationResult(self): r""" Returns whether there is a detailed TrustVerificationResult in this EmbeddedTimestampVerificationResult. :rtype: boolean :return: A boolean """ return _PDFNetPython.EmbeddedTimestampVerificationResult_HasTrustVerificationResult(self)
[docs] def GetTrustVerificationResult(self): r""" Retrieves the detailed result associated with the trust step of the verification operation that returned this EmbeddedTimestampVerificationResult, if such a detailed trust result is available. Must call HasTrustVerificationResult first and check for a true result. Notes: This function will throw if there is no trust result available. :rtype: :py:class:`TrustVerificationResult` :return: A TrustVerificationResult object. """ return _PDFNetPython.EmbeddedTimestampVerificationResult_GetTrustVerificationResult(self)
[docs] def GetCMSSignatureDigestAlgorithm(self): r""" Retrieves an enumeration value representing the digest algorithm used to sign the timestamp token. :rtype: int :return: A DigestAlgorithm enumeration value. """ return _PDFNetPython.EmbeddedTimestampVerificationResult_GetCMSSignatureDigestAlgorithm(self)
[docs] def GetMessageImprintDigestAlgorithm(self): r""" Retrieves an enumeration value representing the digest algorithm used inside the message imprint field of the timestamp to digest the main signature value. :rtype: int :return: A DigestAlgorithm enumeration value. """ return _PDFNetPython.EmbeddedTimestampVerificationResult_GetMessageImprintDigestAlgorithm(self)
[docs] def GetUnsupportedFeatures(self): r""" Retrieves reports about unsupported features encountered during verification of the timestamp. Current possible values: "GeneralizedTime format with length <number greater than 15>", "unsupported digest algorithm" :rtype: std::vector< std::string,std::allocator< std::string > > :return: a container of strings representing unsupported features encountered during verification of the timestamp Notes: Output may change in future versions. """ return _PDFNetPython.EmbeddedTimestampVerificationResult_GetUnsupportedFeatures(self)
def __init__(self, args): _PDFNetPython.EmbeddedTimestampVerificationResult_swiginit(self, _PDFNetPython.new_EmbeddedTimestampVerificationResult(args)) m_impl = property(_PDFNetPython.EmbeddedTimestampVerificationResult_m_impl_get, _PDFNetPython.EmbeddedTimestampVerificationResult_m_impl_set)
# Register EmbeddedTimestampVerificationResult in _PDFNetPython: _PDFNetPython.EmbeddedTimestampVerificationResult_swigregister(EmbeddedTimestampVerificationResult)
[docs] class DigestAlgorithm(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_SHA1 = _PDFNetPython.DigestAlgorithm_e_SHA1 e_SHA256 = _PDFNetPython.DigestAlgorithm_e_SHA256 e_SHA384 = _PDFNetPython.DigestAlgorithm_e_SHA384 e_SHA512 = _PDFNetPython.DigestAlgorithm_e_SHA512 e_RIPEMD160 = _PDFNetPython.DigestAlgorithm_e_RIPEMD160 e_unknown_digest_algorithm = _PDFNetPython.DigestAlgorithm_e_unknown_digest_algorithm
[docs] @staticmethod def CalculateDigest(in_digest_algorithm_type, in_message_buf): r""" Calculates a digest of arbitrary data. Useful during CMS generation custom signing workflows for digesting signedAttributes before sending off for CMS signatureValue generation (e.g. by HSM device or cloud signing platform). :type in_digest_algorithm_type: int :param in_digest_algorithm_type: -- the digest algorithm to use :type in_message_buf: std::vector< UChar,std::allocator< UChar > > :param in_message_buf: -- the message to digest :rtype: std::vector< UChar,std::allocator< UChar > > :return: a container of bytes corresponding to the digest of the message """ return _PDFNetPython.DigestAlgorithm_CalculateDigest(in_digest_algorithm_type, in_message_buf)
[docs] @staticmethod def SignDigest(args): r""" Overload 1: Sign the digest of arbitrary data with private key in the provided PKCS #12 key file (.pfx). This function is part of the low-level custom signing API, and works with GenerateESSSigningCertPAdESAttribute, GenerateCMSSignedAttributes, and GenerateCMSSignature. :type digest_buf: std::vector< UChar,std::allocator< UChar > > :param digest_buf: -- The digest to sign. :type digest_algorithm_type: int :param digest_algorithm_type: -- The digest algorithm used to generate the digest. :type pkcs12_keyfile_path: string :param pkcs12_keyfile_path: -- The path to the PKCS #12 keyfile (usually has a .pfx extension) to use for signing. :type pkcs12_password: string :param pkcs12_password: -- The password to use to parse the PKCS #12 keyfile. :rtype: std::vector< UChar,std::allocator< UChar > > :return: the DER-serialized bytes of the signature. | Overload 2: Sign the digest of arbitrary data with private key in the provided PKCS #12 key file (.pfx). This function is part of the low-level custom signing API, and works with GenerateESSSigningCertPAdESAttribute, GenerateCMSSignedAttributes, and GenerateCMSSignature. :type digest_buf: std::vector< UChar,std::allocator< UChar > > :param digest_buf: -- The digest to sign. :type digest_algorithm_type: int :param digest_algorithm_type: -- The digest algorithm used to generate the digest. :type pkcs12_buf: std::vector< UChar,std::allocator< UChar > > :param pkcs12_buf: -- The buffer containing the PKCS #12 key (as usually stored in .pfx files) to use for signing. :type pkcs12_password: string :param pkcs12_password: -- The password to use to parse the PKCS 12 key. :rtype: std::vector< UChar,std::allocator< UChar > > :return: the DER-serialized bytes of the signature. """ return _PDFNetPython.DigestAlgorithm_SignDigest(args)
def __init__(self): _PDFNetPython.DigestAlgorithm_swiginit(self, _PDFNetPython.new_DigestAlgorithm()) __swig_destroy__ = _PDFNetPython.delete_DigestAlgorithm
# Register DigestAlgorithm in _PDFNetPython: _PDFNetPython.DigestAlgorithm_swigregister(DigestAlgorithm)
[docs] def DigestAlgorithm_CalculateDigest(in_digest_algorithm_type, in_message_buf): r""" Calculates a digest of arbitrary data. Useful during CMS generation custom signing workflows for digesting signedAttributes before sending off for CMS signatureValue generation (e.g. by HSM device or cloud signing platform). :type in_digest_algorithm_type: int :param in_digest_algorithm_type: -- the digest algorithm to use :type in_message_buf: std::vector< UChar,std::allocator< UChar > > :param in_message_buf: -- the message to digest :rtype: std::vector< UChar,std::allocator< UChar > > :return: a container of bytes corresponding to the digest of the message """ return _PDFNetPython.DigestAlgorithm_CalculateDigest(in_digest_algorithm_type, in_message_buf)
[docs] def DigestAlgorithm_SignDigest(args): r""" Overload 1: Sign the digest of arbitrary data with private key in the provided PKCS #12 key file (.pfx). This function is part of the low-level custom signing API, and works with GenerateESSSigningCertPAdESAttribute, GenerateCMSSignedAttributes, and GenerateCMSSignature. :type digest_buf: std::vector< UChar,std::allocator< UChar > > :param digest_buf: -- The digest to sign. :type digest_algorithm_type: int :param digest_algorithm_type: -- The digest algorithm used to generate the digest. :type pkcs12_keyfile_path: string :param pkcs12_keyfile_path: -- The path to the PKCS #12 keyfile (usually has a .pfx extension) to use for signing. :type pkcs12_password: string :param pkcs12_password: -- The password to use to parse the PKCS #12 keyfile. :rtype: std::vector< UChar,std::allocator< UChar > > :return: the DER-serialized bytes of the signature. | Overload 2: Sign the digest of arbitrary data with private key in the provided PKCS #12 key file (.pfx). This function is part of the low-level custom signing API, and works with GenerateESSSigningCertPAdESAttribute, GenerateCMSSignedAttributes, and GenerateCMSSignature. :type digest_buf: std::vector< UChar,std::allocator< UChar > > :param digest_buf: -- The digest to sign. :type digest_algorithm_type: int :param digest_algorithm_type: -- The digest algorithm used to generate the digest. :type pkcs12_buf: std::vector< UChar,std::allocator< UChar > > :param pkcs12_buf: -- The buffer containing the PKCS #12 key (as usually stored in .pfx files) to use for signing. :type pkcs12_password: string :param pkcs12_password: -- The password to use to parse the PKCS 12 key. :rtype: std::vector< UChar,std::allocator< UChar > > :return: the DER-serialized bytes of the signature. """ return _PDFNetPython.DigestAlgorithm_SignDigest(args)
[docs] class CMSSignatureOptions(object): r"""Optional data for CMS creation.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_CMSSignatureOptions def __init__(self, args): _PDFNetPython.CMSSignatureOptions_swiginit(self, _PDFNetPython.new_CMSSignatureOptions(args)) m_impl = property(_PDFNetPython.CMSSignatureOptions_m_impl_get, _PDFNetPython.CMSSignatureOptions_m_impl_set)
# Register CMSSignatureOptions in _PDFNetPython: _PDFNetPython.CMSSignatureOptions_swigregister(CMSSignatureOptions)
[docs] class DigitalSignatureField(object): r"""A class representing a digital signature form field.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_adbe_x509_rsa_sha1 = _PDFNetPython.DigitalSignatureField_e_adbe_x509_rsa_sha1 e_adbe_pkcs7_detached = _PDFNetPython.DigitalSignatureField_e_adbe_pkcs7_detached e_adbe_pkcs7_sha1 = _PDFNetPython.DigitalSignatureField_e_adbe_pkcs7_sha1 e_ETSI_CAdES_detached = _PDFNetPython.DigitalSignatureField_e_ETSI_CAdES_detached e_ETSI_RFC3161 = _PDFNetPython.DigitalSignatureField_e_ETSI_RFC3161 e_unknown = _PDFNetPython.DigitalSignatureField_e_unknown e_absent = _PDFNetPython.DigitalSignatureField_e_absent e_no_changes_allowed = _PDFNetPython.DigitalSignatureField_e_no_changes_allowed e_formfilling_signing_allowed = _PDFNetPython.DigitalSignatureField_e_formfilling_signing_allowed e_annotating_formfilling_signing_allowed = _PDFNetPython.DigitalSignatureField_e_annotating_formfilling_signing_allowed e_unrestricted = _PDFNetPython.DigitalSignatureField_e_unrestricted e_lock_all = _PDFNetPython.DigitalSignatureField_e_lock_all e_include = _PDFNetPython.DigitalSignatureField_e_include e_exclude = _PDFNetPython.DigitalSignatureField_e_exclude
[docs] def HasCryptographicSignature(self): r""" Returns whether the digital signature field has been cryptographically signed. Checks whether there is a digital signature dictionary in the field and whether it has a Contents entry. Must be called before using various digital signature dictionary-related functions. Does not check validity - will return true even if a valid hash has not yet been generated (which will be the case after [Certify/Sign]OnNextSave[WithCustomHandler] has been called on the signature but even before Save is called on the document). :rtype: boolean :return: A boolean value representing whether the digital signature field has a digital signature dictionary with a Contents entry. """ return _PDFNetPython.DigitalSignatureField_HasCryptographicSignature(self)
[docs] def GetSubFilter(self): r""" Returns the SubFilter type of the digital signature. Specification says that one must check the SubFilter before using various getters. Must call HasCryptographicSignature first and use it to check whether the signature is signed. :rtype: int :return: An enumeration describing what the SubFilter of the digital signature is from within the digital signature dictionary. """ return _PDFNetPython.DigitalSignatureField_GetSubFilter(self)
[docs] def GetSignatureName(self): r""" Should not be called when SubFilter is ETSI.RFC3161 (i.e. on a DocTimeStamp). Returns the name of the signer of the signature from the digital signature dictionary. Must call HasCryptographicSignature first and use it to check whether the signature is signed. :rtype: string :return: A unicode string containing the name of the signer from within the digital signature dictionary. Empty if Name entry not present. """ return _PDFNetPython.DigitalSignatureField_GetSignatureName(self)
[docs] def GetSigningTime(self): r""" Should not be called when SubFilter is ETSI.RFC3161 (i.e. on a DocTimeStamp). Returns the "M" entry from the digital signature dictionary, which represents the signing date/time. Must call HasCryptographicSignature first and use it to check whether the signature is signed. :rtype: :py:class:`Date` :return: A PDF::Date object holding the signing date/time from within the digital signature dictionary. Returns a default-constructed PDF::Date if no date is present. """ return _PDFNetPython.DigitalSignatureField_GetSigningTime(self)
[docs] def GetLocation(self): r""" Should not be called when SubFilter is ETSI.RFC3161 (i.e. on a DocTimeStamp). Returns the Location of the signature from the digital signature dictionary. Must call HasCryptographicSignature first and use it to check whether the signature is signed. :rtype: string :return: A unicode string containing the signing location from within the digital signature dictionary. Empty if Location entry not present. """ return _PDFNetPython.DigitalSignatureField_GetLocation(self)
[docs] def GetReason(self): r""" Should not be called when SubFilter is ETSI.RFC3161 (i.e. on a DocTimeStamp). Returns the Reason for the signature from the digital signature dictionary. Must call HasCryptographicSignature first and use it to check whether the signature is signed. :rtype: string :return: A unicode string containing the reason for the signature from within the digital signature dictionary. Empty if Reason entry not present. """ return _PDFNetPython.DigitalSignatureField_GetReason(self)
[docs] def GetContactInfo(self): r""" Should not be called when SubFilter is ETSI.RFC3161 (i.e. on a DocTimeStamp). Returns the contact information of the signer from the digital signature dictionary. Must call HasCryptographicSignature first and use it to check whether the signature is signed. :rtype: string :return: A unicode string containing the contact information of the signer from within the digital signature dictionary. Empty if ContactInfo entry not present. """ return _PDFNetPython.DigitalSignatureField_GetContactInfo(self)
[docs] def GetCert(self, in_index): r""" Gets a certificate in the certificate chain (Cert entry) of the digital signature dictionary by index. Throws if Cert is not Array or String, throws if index is out of range and Cert is Array, throws if index is > 1 and Cert is string, otherwise retrieves the certificate. Only to be used for old-style adbe.x509.rsa_sha1 signatures; for other signatures, use CMS getter functions instead. :type in_index: int :param in_index: -- An integral index which must be greater than 0 and less than the cert count as retrieved using GetCertCount. :rtype: std::vector< UChar,std::allocator< UChar > > :return: A vector of bytes containing the certificate at the index. Returns empty vector if Cert is missing. """ return _PDFNetPython.DigitalSignatureField_GetCert(self, in_index)
[docs] def GetCertCount(self): r""" Gets number of certificates in certificate chain (Cert entry of digital signature dictionary). Must call HasCryptographicSignature first and use it to check whether the signature is signed. Only to be used for old-style adbe.x509.rsa_sha1 signatures; for other signatures, use CMS getter functions instead. :rtype: int :return: An integer value - the number of certificates in the Cert entry of the digital signature dictionary. """ return _PDFNetPython.DigitalSignatureField_GetCertCount(self)
[docs] def HasVisibleAppearance(self): r""" Returns whether the field has a visible appearance. Can be called without checking HasCryptographicSignature first, since it operates on the surrounding Field dictionary, not the "V" entry (i.e. digital signature dictionary). Performs the zero-width+height check, the Hidden bit check, and the NoView bit check as described by the PDF 2.0 specification, section 12.7.5.5 "Signature fields". :rtype: boolean :return: A boolean representing whether or not the signature field has a visible signature. """ return _PDFNetPython.DigitalSignatureField_HasVisibleAppearance(self)
[docs] def SetContactInfo(self, in_contact_info): r""" Should not be called when SubFilter is ETSI.RFC3161 (i.e. on a DocTimeStamp). Sets the ContactInfo entry in the digital signature dictionary. Must create a digital signature dictionary first using [Certify/Sign]OnNextSave[WithCustomHandler]. If this function is called on a digital signature field that has already been cryptographically signed with a valid hash, the hash will no longer be valid, so do not call Save (to sign/create the hash) until after you call this function, if you need to call this function in the first place. Essentially, call this function after [Certify/Sign]OnNextSave[WithCustomHandler] and before Save. :type in_contact_info: string :param in_contact_info: -- A string containing the ContactInfo to be set. """ return _PDFNetPython.DigitalSignatureField_SetContactInfo(self, in_contact_info)
[docs] def SetLocation(self, in_location): r""" Should not be called when SubFilter is ETSI.RFC3161 (i.e. on a DocTimeStamp). Sets the Location entry in the digital signature dictionary. Must create a digital signature dictionary first using [Certify/Sign]OnNextSave[WithCustomHandler]. If this function is called on a digital signature field that has already been cryptographically signed with a valid hash, the hash will no longer be valid, so do not call Save (to sign/create the hash) until after you call this function, if you need to call this function in the first place. Essentially, call this function after [Certify/Sign]OnNextSave[WithCustomHandler] and before Save. :type in_location: string :param in_location: -- A string containing the Location to be set. """ return _PDFNetPython.DigitalSignatureField_SetLocation(self, in_location)
[docs] def SetReason(self, in_reason): r""" Should not be called when SubFilter is ETSI.RFC3161 (i.e. on a DocTimeStamp). Sets the Reason entry in the digital signature dictionary. Must create a digital signature dictionary first using [Certify/Sign]OnNextSave[WithCustomHandler]. If this function is called on a digital signature field that has already been cryptographically signed with a valid hash, the hash will no longer be valid, so do not call Save (to sign/create the hash) until after you call this function, if you need to call this function in the first place. Essentially, call this function after [Certify/Sign]OnNextSave[WithCustomHandler] and before Save. :type in_reason: string :param in_reason: -- A string containing the Reason to be set. """ return _PDFNetPython.DigitalSignatureField_SetReason(self, in_reason)
[docs] def SetFieldPermissions(self, args): r""" Tentatively sets which fields are to be locked by this digital signature upon signing. It is not necessary to call HasCryptographicSignature before using this function. Throws if non-empty array of field names is passed along with FieldPermissions Action == e_lock_all. :type in_action: int :param in_action: -- An enumerated value representing which sort of field locking should be done. Options are All (lock all fields), Include (lock listed fields), and Exclude (lock all fields except listed fields). :type in_field_names: std::vector< std::string,std::allocator< std::string > > :param in_field_names: -- A list of field names; can be empty (and must be empty, if Action is set to All). Empty by default. """ return _PDFNetPython.DigitalSignatureField_SetFieldPermissions(self, args)
[docs] def SetDocumentPermissions(self, in_perms): r""" Sets the document locking permission level for this digital signature field. Call only on unsigned signatures, otherwise a valid hash will be invalidated. :type in_perms: int :param in_perms: -- An enumerated value representing the document locking permission level to set. """ return _PDFNetPython.DigitalSignatureField_SetDocumentPermissions(self, in_perms)
[docs] def SignOnNextSave(self, args): r""" Overload 1: Must be called to prepare a signature for signing, which is done afterwards by calling Save. Cannot sign two signatures during one save (throws). Default document permission level is e_annotating_formfilling_signing_allowed. Throws if signature field already has a digital signature dictionary. :type in_pkcs12_keyfile_path: string :param in_pkcs12_keyfile_path: -- The path to the PKCS #12 private keyfile to use to sign this digital signature. :type in_password: string :param in_password: -- The password to use to parse the PKCS #12 keyfile. | Overload 2: Must be called to prepare a signature for signing, which is done afterwards by calling Save. Cannot sign two signatures during one save (throws). Default document permission level is e_annotating_formfilling_signing_allowed. Throws if signature field already has a digital signature dictionary. :type in_pkcs12_buffer: UChar :param in_pkcs12_buffer: -- A buffer of bytes containing the PKCS #12 private key certificate store to use to sign this digital signature. :type in_buf_size: int :param in_buf_size: -- buffer size. :type in_password: string :param in_password: -- The password to use to parse the PKCS #12 buffer. """ return _PDFNetPython.DigitalSignatureField_SignOnNextSave(self, args)
[docs] def SignOnNextSaveWithCustomHandler(self, in_signature_handler_id): r""" Must be called to prepare a signature for signing, which is done afterwards by calling Save. Cannot sign two signatures during one save (throws). Default document permission level is e_annotating_formfilling_signing_allowed. Throws if signature field already has a digital signature dictionary. :type in_signature_handler_id: int :param in_signature_handler_id: -- The unique id of the signature handler to use to sign this digital signature. """ return _PDFNetPython.DigitalSignatureField_SignOnNextSaveWithCustomHandler(self, in_signature_handler_id)
[docs] def CertifyOnNextSave(self, args): r""" Overload 1: Must be called to prepare a signature for certification, which is done afterwards by calling Save. Throws if document already certified. Default document permission level is e_annotating_formfilling_signing_allowed. Throws if signature field already has a digital signature dictionary. :type in_pkcs12_keyfile_path: string :param in_pkcs12_keyfile_path: -- The path to the PKCS #12 private keyfile to use to certify this digital signature. :type in_password: string :param in_password: -- The password to use to parse the PKCS #12 keyfile. | Overload 2: Must be called to prepare a signature for certification, which is done afterwards by calling Save. Throws if document already certified. Default document permission level is e_annotating_formfilling_signing_allowed. Throws if signature field already has a digital signature dictionary. :type in_pkcs12_buffer: UChar :param in_pkcs12_buffer: -- A buffer of bytes containing the PKCS #12 private key certificate store to use to certify this digital signature. :type in_buf_size: int :param in_buf_size: -- buffer size. :type in_password: string :param in_password: -- The password to use to parse the PKCS #12 buffer. """ return _PDFNetPython.DigitalSignatureField_CertifyOnNextSave(self, args)
[docs] def CertifyOnNextSaveWithCustomHandler(self, in_signature_handler_id): r""" Must be called to prepare a signature for certification, which is done afterwards by calling Save. Throws if document already certified. Default document permission level is e_annotating_formfilling_signing_allowed. Throws if signature field already has a digital signature dictionary. :type in_signature_handler_id: int :param in_signature_handler_id: -- The unique id of the signature handler to use to certify this digital signature. """ return _PDFNetPython.DigitalSignatureField_CertifyOnNextSaveWithCustomHandler(self, in_signature_handler_id)
[docs] def GetSDFObj(self): r""" Retrieves the SDF Obj of the digital signature field. :rtype: :py:class:`Obj` :return: the underlying SDF/Cos object. """ return _PDFNetPython.DigitalSignatureField_GetSDFObj(self)
[docs] def IsLockedByDigitalSignature(self): r""" Returns whether this digital signature field is locked against modifications by any digital signatures. Can be called when this field is unsigned. :rtype: boolean :return: A boolean representing whether this digital signature field is locked against modifications by any digital signatures in the document. """ return _PDFNetPython.DigitalSignatureField_IsLockedByDigitalSignature(self)
[docs] def GetLockedFields(self): r""" Returns the fully-qualified names of all fields locked by this signature using the field permissions feature. Retrieves from the digital signature dictionary if the form field HasCryptographicSignature. Otherwise, retrieves from the Lock entry of the digital signature form field. Result is invalidated by any field additions or removals. Does not take document permissions restrictions into account. :rtype: std::vector< std::string,std::allocator< std::string > > :return: A vector of UStrings representing the fully-qualified names of all fields locked by this signature. """ return _PDFNetPython.DigitalSignatureField_GetLockedFields(self)
[docs] def GetDocumentPermissions(self): r""" If HasCryptographicSignature, returns most restrictive permissions found in any reference entries in this digital signature. Returns Lock-resident (i.e. tentative) permissions otherwise. Throws if invalid permission value is found. :rtype: int :return: An enumeration value representing the level of restrictions (potentially) placed on the document by this signature. """ return _PDFNetPython.DigitalSignatureField_GetDocumentPermissions(self)
[docs] def ClearSignature(self): r"""Clears cryptographic signature, if present. Otherwise, does nothing. Do not need to call HasCryptographicSignature before calling this. After clearing, other signatures should still pass validation if saving after clearing was done incrementally. Clears the appearance as well.""" return _PDFNetPython.DigitalSignatureField_ClearSignature(self)
[docs] def Verify(self, in_opts): r""" Verifies this cryptographic digital signature in the manner specified by the VerificationOptions. :type in_opts: :py:class:`VerificationOptions` :param in_opts: -- The options specifying how to do the verification. :rtype: :py:class:`VerificationResult` :return: A VerificationResult object containing various information about the verifiability of the cryptographic digital signature. """ return _PDFNetPython.DigitalSignatureField_Verify(self, in_opts)
[docs] def IsCertification(self): r""" Returns whether or not this signature is a certification. :rtype: boolean :return: a boolean value representing whether or not this signature is a certification. """ return _PDFNetPython.DigitalSignatureField_IsCertification(self)
[docs] def GetSignerCertFromCMS(self): r""" Returns the signing certificate. Must only be called on signed adbe.pkcs7.detached or ETSI.CAdES.detached signatures. :rtype: :py:class:`X509Certificate` :return: An X509Certificate object. Notes: This function does not verify the signature. It merely extracts the claimed signing certificate. This function only works when the build has support for verification-related APIs. """ return _PDFNetPython.DigitalSignatureField_GetSignerCertFromCMS(self)
[docs] def GetByteRanges(self): r""" Retrieves the ranges of byte indices within the document over which this signature is intended to apply/be verifiable. :rtype: std::vector< Common::ByteRange,std::allocator< Common::ByteRange > > :return: a container of byte range objects Notes: This function does not verify that the signature is valid over its byte ranges. It merely returns them. This can be useful when a document consists of multiple incremental revisions, the latter of which may or may not have been signed, for telling which revisions were actually signed by which signature. The outputs of this function can also be used to truncate the document at the end of a signed byte range, in order that the signed document revision may be retrieved from a document with later incremental revisions. Of course, to be certain that the signature is valid, it must also then be verified using the verification API. Also, the caller is responsible for making sure that the byte ranges returned from this function actually make sense (i.e. fit inside the document). """ return _PDFNetPython.DigitalSignatureField_GetByteRanges(self)
[docs] def GetCertPathsFromCMS(self): r""" Retrieves allructible certificate paths from an adbe.pkcs7.detached or ETSI.CAdES.detached digital signature. The signer will always be returned if the signature is CMS-based and not corrupt. Must only be called on signed adbe.pkcs7.detached signatures. The order of the certificates in each of the paths returned is as follows: the signer will be first, and issuers come after it in order of the issuer of the previous certificate. The default behaviour is to return a sub-path for each marginal issuer in a max-length path. :rtype: std::vector< std::vector< Crypto::X509Certificate,std::allocator< Crypto::X509Certificate > >,std::allocator< std::vector< Crypto::X509Certificate,std::allocator< Crypto::X509Certificate > > > > :return: a container of X509Certificate objects Notes: This function does not verify the paths. It merely extracts certificates andructs paths. This function only works when the build has support for verification-related APIs. """ return _PDFNetPython.DigitalSignatureField_GetCertPathsFromCMS(self)
[docs] def EnableLTVOfflineVerification(self, in_verification_result): r""" Given a successful verification result that required online information to verify trust (trust verification must have been enabled and successful during the verification), embeds data into the PDF document that allows the signature to be verified offline. (This is accomplished using DSS and VRI dictionaries.) When this operation is successfully completed, one of the two components of secure long term validation (LTV) will be in place. The other necessary component of secure long term validation is to make sure to timestamp the document appropriately while the signature is still verifiable to maintain a chain of unexpired secure timestamps attesting to the integrity of the document. The verifiability of the signature should thereafter be maintainable in such a fashion despite any possible certificate expiry, algorithm compromise, or key compromise that would have otherwise rendered it invalid if it were to be verified using a time in the future rather than a securely-signed timestamp-derived time nearer the time of signing (at which which the signature was verifiable without extra data). This function, if given a good verification result, is also capable of making timestamp (DocTimeStamp ETSI.RFC3161) signatures LTV-enabled, which is necessary to do first when you intend to add another timestamp around an already-timestamped document to extend or enhance its verifiability (as described above), as per the PDF 2.0 and ETSI TS 102 778-4 (PAdES Level 4) specifications. :type in_verification_result: :py:class:`VerificationResult` :param in_verification_result: -- a successful verification result containing a successful TrustVerificationResult :rtype: boolean :return: a boolean status that reflects whether offline verification information was added successfully Notes: It is necessary to save the document incrementally after this function completes successfully in order to actually write the LTV data into the document. """ return _PDFNetPython.DigitalSignatureField_EnableLTVOfflineVerification(self, in_verification_result)
[docs] def TimestampOnNextSave(self, in_timestamping_config, in_timestamp_response_verification_options): r""" Must be called to prepare a secure PDF-embedded timestamp signature (RFC 3161 DocTimeStamp) for signing, which is done afterwards by calling Save on the document with an e_incremental flag. Throws if document is locked by other signatures, if signature is already signed, or if another signature has already been prepared for signing on the next save (because only one signing operation can be done per incremental save). Default document permission level is e_annotating_formfilling_signing_allowed. :type in_timestamping_config: :py:class:`TimestampingConfiguration` :param in_timestamping_config: -- Configuration options to store for timestamping. These will include various items related to contacting a timestamping authority. Incorrect configuration will result in document Save throwing an exception. The usability of a combination of a TimestampingConfiguration and VerificationOptions can be checked ahead of time to prevent exceptions by calling TestConfiguration on TimestampingConfiguration and passing VerificationOptions. :type in_timestamp_response_verification_options: :py:class:`VerificationOptions` :param in_timestamp_response_verification_options: -- Options for the timestamp response verification step (which is required by RFC 3161 to be done as part of timestamping). These response verification options should include the root certificate of the timestamp authority, so that the trust status of the timestamp signature can be verified. The options that should be passed are the same ones that one expects the timestamp to be verifiable with in the future (once it is embedded in the document), except the response verification requires online revocation information whereas the later verification may not (depending on whether LTV offline verification information for the timestamp signature gets embedded into the document by that time). The timestamp response verification step makes sure that (a) the timestamp response has a success status, which is the only time that this is verified in the entire workflow, which prevents embedding an unsuccessful response; (b) that it digests the document correctly and is otherwise generally verifiable; and (c) that the nonce is correct (which is the only time that this is verifiable in the entire workflow) to prevent replay attacks (if it was not requested in the TimestampingConfiguration that the nonce mechanism should be disabled). Notes: A failure in timestamp response verification will result in document Save throwing an exception. It is recommended to use TimestampingConfiguration.TestConfiguration with the VerificationOptions ahead of time to avoid this. """ return _PDFNetPython.DigitalSignatureField_TimestampOnNextSave(self, in_timestamping_config, in_timestamp_response_verification_options)
[docs] def GenerateContentsWithEmbeddedTimestamp(self, in_timestamping_config, in_timestamp_response_verification_options): r""" Contacts a remote timestamp authority over network, sends CMS digest, receives and verifies timestamp token, combines the timestamp token and the data of an existing CMS-type (adbe.pkcs7.detached or ETSI.CAdES.detached subfilter) main document signature, and then returns that data to the user. At least one signing time, whether "M" (see SetSigDictTimeOfSigning) or a secure embedded timestamp, is required to be added in order to create a PAdES signature. Notes: This function does not insert the final CMS-type document signature into the document. You must retrieve it from the result using GetData and then pass that to PDFDoc SaveCustomSignature. :type in_timestamping_config: :py:class:`TimestampingConfiguration` :param in_timestamping_config: -- Configuration options to store for timestamping. These will include various items related to contacting a timestamping authority. Incorrect configuration will result in an exception being thrown. The usability of a combination of a TimestampingConfiguration and VerificationOptions can be checked ahead of time to prevent exceptions by calling TestConfiguration on TimestampingConfiguration and passing VerificationOptions. :type in_timestamp_response_verification_options: :py:class:`VerificationOptions` :param in_timestamp_response_verification_options: -- Options for the timestamp response verification step (which is required by RFC 3161 to be done as part of timestamping). These response verification options should include the root certificate of the timestamp authority, so that the trust status of the timestamp signature can be verified. The options that should be passed are the same ones that one expects the timestamp to be verifiable with in the future (once it is embedded in the document), except the response verification requires online revocation information whereas the later verification may not (depending on whether LTV offline verification information for the embedded timestamp gets embedded into the document by that time). The timestamp response verification step makes sure that (a) the timestamp response has a success status, which is the only time that this is verified in the entire workflow, which prevents embedding an unsuccessful response; (b) that it digests the main signature digest correctly and is otherwise generally verifiable; and (c) that the nonce is correct (which is the only time that this is verifiable in the entire workflow) to prevent replay attacks (if it was not requested in the TimestampingConfiguration that the nonce mechanism should be disabled). :rtype: :py:class:`TimestampingResult` :return: The result of the timestamp request, including the final document signature as DER-encoded CMS with a timestamp embedded """ return _PDFNetPython.DigitalSignatureField_GenerateContentsWithEmbeddedTimestamp(self, in_timestamping_config, in_timestamp_response_verification_options)
[docs] def UseSubFilter(self, in_subfilter_type, in_make_mandatory=True): r""" Sets the requested SubFilter value (which identifies a signature type) as the only one to use during future signing, overwriting all such previous settings. It is not necessary to call HasCryptographicSignature before calling this function. For example, this function can be used to switch to PAdES signing mode. :type in_subfilter_type: int :param in_subfilter_type: -- The SubFilter type to set. :type in_make_mandatory: boolean :param in_make_mandatory: -- Whether to make usage of this SubFilter mandatory for future signing applications. Default value for this parameter is true. """ return _PDFNetPython.DigitalSignatureField_UseSubFilter(self, in_subfilter_type, in_make_mandatory)
[docs] def CalculateDigest(self, args): r""" Calculates the digest of the relevant bytes of the document for this signature field, in order to allow the caller to perform custom signing/processing. Signature field must first be prepared using one of the non-sign overloads (CreateSigDictForCustomSigning/Certification), and then the document must be saved; after that, this function can be called. The ByteRanges that the most recent save has entered into the signature dictionary within this signature field will be used to calculate the digest. :type in_digest_algorithm_type: int :param in_digest_algorithm_type: -- the enumerated type of digest algorithm to use for the calculation. The default is SHA-256. :rtype: std::vector< UChar,std::allocator< UChar > > :return: an array of bytes containing the digest value """ return _PDFNetPython.DigitalSignatureField_CalculateDigest(self, args)
[docs] def SetPreferredDigestAlgorithm(self, in_digest_algorithm_type, in_make_mandatory=True): r""" Sets the preferred digest algorithm to use when signing this field. This is done by setting DigestMethod in the Seed Value dictionary. This function can be called before a signature field is even prepared for signing. :type in_digest_algorithm_type: int :param in_digest_algorithm_type: -- the digest algorithm to use :type in_make_mandatory: boolean :param in_make_mandatory: -- whether to tell signing software to give up if the preferred algorithm is unsupported. Default value for this parameter is true. """ return _PDFNetPython.DigitalSignatureField_SetPreferredDigestAlgorithm(self, in_digest_algorithm_type, in_make_mandatory)
[docs] def CreateSigDictForCustomCertification(self, in_filter_name, in_subfilter_type, in_contents_size_to_reserve): r""" Prepares the field for certification without actually performing certification. Useful for custom signing workflows. It is not necessary to call HasCryptographicSignature before calling this function. :type in_filter_name: string :param in_filter_name: the Filter name to use, representing the name of the signature handler that will be used to sign and verify the signature (e.g. Adobe.PPKLite) :type in_subfilter_type: int :param in_subfilter_type: the SubFilter name to use, representing an interoperable signature type identifier for third-party verification (e.g. adbe.pkcs7.detached, ETSI.CAdES.detached, etc.) :type in_contents_size_to_reserve: int :param in_contents_size_to_reserve: The size of the empty Contents entry to create. For security reasons, set the contents size to a value greater than but as close as possible to the size you expect your final signature to be. """ return _PDFNetPython.DigitalSignatureField_CreateSigDictForCustomCertification(self, in_filter_name, in_subfilter_type, in_contents_size_to_reserve)
[docs] def CreateSigDictForCustomSigning(self, in_filter_name, in_subfilter_type, in_contents_size_to_reserve): r""" Prepares the field for approval signing without actually performing signing. Useful for custom signing workflows. It is not necessary to call HasCryptographicSignature before calling this function. :type in_filter_name: string :param in_filter_name: the Filter name to use, representing the name of the signature handler that will be used to sign and verify the signature (e.g. Adobe.PPKLite) :type in_subfilter_type: int :param in_subfilter_type: the SubFilter name to use, representing an interoperable signature type identifier for third-party verification (e.g. adbe.pkcs7.detached, ETSI.CAdES.detached, etc.) :type in_contents_size_to_reserve: int :param in_contents_size_to_reserve: The size of the empty Contents entry to create. For security reasons, set the contents size to a value greater than but as close as possible to the size you expect your final signature to be. """ return _PDFNetPython.DigitalSignatureField_CreateSigDictForCustomSigning(self, in_filter_name, in_subfilter_type, in_contents_size_to_reserve)
[docs] def SetSigDictTimeOfSigning(self, in_date): r""" Adds the "M" key and value, representing the PDF-time-of-signing (not to be confused with embedded timestamps, DocTimeStamps, or CMS signing time), to the digital signature dictionary. The digital signature field must have been prepared for signing first. This function should only be used if no secure embedded timestamping support is available from your signing provider. Useful for custom signing workflows, where signing time is not set automatically by the Apryse SDK, unlike in the usual standard handler signing workflow. A secure embedded timestamp can also be added later and should override this "M" date entry when the signature is read by signature-verifying PDF processor applications. At least one signing time, whether "M" or a secure embedded timestamp (see GenerateContentsWithEmbeddedTimestamp), is required to be added in order to create a PAdES signature. :type in_date: :py:class:`Date` :param in_date: the PDF Date datetime value to set """ return _PDFNetPython.DigitalSignatureField_SetSigDictTimeOfSigning(self, in_date)
[docs] @staticmethod def SignDigest(args): r""" Overload 1: Returns a CMS detached signature incorporating a digest that is provided using the provided PKCS #12 key file (.pfx). This function is part of the custom signing API, but cannot be used for workflows where the key is not in PFX format or when the signature comes from a source that cannot generate CMS signatures (e.g. Hardware Security Modules (HSM) devices, cloud signing services). In such cases, the low-level parts of the custom signing API should be used instead of this function (e.g. GenerateESSSigningCertPAdESAttribute, GenerateCMSSignedAttributes, GenerateCMSSignature). This function is a shortcut for situations in which use of more low-level custom signing functions is unnecessary. Therefore, this function will generate necessary CMS components, such as signedAttrs, internally. Notes: This function does not change the DigitalSignatureField. Call SaveCustomSignature to write a signature to its PDFDoc. :type in_digest: std::vector< UChar,std::allocator< UChar > > :param in_digest: -- the document digest value to use :type in_pkcs12_keyfile_path: string :param in_pkcs12_keyfile_path: -- the path to the PKCS #12 key file (usually has a .pfx extension) to use for signing :type in_keyfile_password: string :param in_keyfile_password: -- the password to use to decrypt the PKCS #12 key file :type in_pades_mode: boolean :param in_pades_mode: -- whether to create a PAdES-type signature (PDF Advanced Electronic Signatures standards) :type in_digest_algorithm_type: int :param in_digest_algorithm_type: -- the identifier to use to write the digest algorithm :rtype: std::vector< UChar,std::allocator< UChar > > :return: the DER-serialized bytes of a CMS detached signature (CMS ContentInfo) | Overload 2: Returns a CMS detached signature incorporating a digest that is provided using the provided PKCS #12 key buffer (.pfx). This function is part of the custom signing API, but cannot be used for workflows where the key is not in PFX format or when the signature comes from a source that cannot generate CMS signatures (e.g. Hardware Security Modules (HSM) devices, cloud signing services). In such cases, the low-level parts of the custom signing API should be used instead of this function (e.g. GenerateESSSigningCertPAdESAttribute, GenerateCMSSignedAttributes, GenerateCMSSignature). This function is a shortcut for situations in which use of more low-level custom signing functions is unnecessary. Therefore, this function will generate necessary CMS components, such as signedAttrs, internally. Notes: This function does not change the DigitalSignatureField. Call SaveCustomSignature to write a signature to its PDFDoc. :type in_digest: std::vector< UChar,std::allocator< UChar > > :param in_digest: -- the document digest value to use :type in_pkcs12_buffer: std::vector< UChar,std::allocator< UChar > > :param in_pkcs12_buffer: -- a buffer containing the PKCS #12 key (as usually stored in .pfx files) to use for signing :type in_keyfile_password: string :param in_keyfile_password: -- the password to use to decrypt the PKCS #12 key file data in the buffer :type in_pades_mode: boolean :param in_pades_mode: -- whether to create a PAdES-type signature (PDF Advanced Electronic Signatures standards) :type in_digest_algorithm_type: int :param in_digest_algorithm_type: -- the identifier to use to write the digest algorithm :rtype: std::vector< UChar,std::allocator< UChar > > :return: the DER-serialized bytes of a CMS detached signature (CMS ContentInfo) """ return _PDFNetPython.DigitalSignatureField_SignDigest(args)
[docs] @staticmethod def GenerateESSSigningCertPAdESAttribute(in_signer_cert, in_digest_algorithm_type): r""" Low-level optional function belonging to custom-signing APIs allowing creation of PAdES signatures with key elsewhere, allowing CMS to be generated automatically later. Represents one the components of the functionality of SignDigest which are not key-related. Creates the necessary attribute for a PAdES signature (ETSI.CAdES.detached subfilter type). The result of this function can be passed as a contiguous part of the custom attributes buffer parameter of GenerateCMSSignedAttributes. At least one signing time, whether "M" (see SetSigDictTimeOfSigning) or a secure embedded timestamp (see GenerateContentsWithEmbeddedTimestamp), is also required to be added in order to create a PAdES signature. The result will be either the BER-serialized bytes of an ESS_signing_cert or ESS_signing_cert_V2 CMS Attribute (an ASN.1 SEQUENCE containing the correct OID and ESSCertID or ESSCertIDv2), as is appropriate, depending on what digest algorithm type is provided (see RFC 5035). :type in_signer_cert: :py:class:`X509Certificate` :param in_signer_cert: -- the X509 public-key certificate of the signature's signer (mathematically associated with private key to be used) :type in_digest_algorithm_type: int :param in_digest_algorithm_type: -- the digest algorithm to be used :rtype: std::vector< UChar,std::allocator< UChar > > :return: the BER-serialized bytes of an ESS_signing_cert or ESS_signing_cert_V2 CMS attribute """ return _PDFNetPython.DigitalSignatureField_GenerateESSSigningCertPAdESAttribute(in_signer_cert, in_digest_algorithm_type)
[docs] @staticmethod def GenerateCMSSignedAttributes(args): r""" Low-level function belonging to custom-signing APIs. Creates the signedAttributes component of Cryptographic Message Syntax (CMS). The result of this function can then be encrypted by a remote private key (cloud service, Hardware Security Module (HSM) device, etc.), using some external API that returns the bytes of a not-already-CMS-embedded signature value (e.g. RSA PKCS #1 v1.5 format). Following that, CMS generation can be performed using GenerateCMSSignature, after which the resulting signature can be inserted into a resulting signed version of the PDF document using the PDFDoc function SaveCustomSignature. :type in_digest_buf: std::vector< UChar,std::allocator< UChar > > :param in_digest_buf: -- a buffer containing the digest of the document within ByteRanges of this DigitalSignatureField (see CalculateDigest) :type in_custom_signedattributes_buf: std::vector< UChar,std::allocator< UChar > > :param in_custom_signedattributes_buf: -- a buffer containing any optional custom BER-encoded signedAttributes to add, including potentially the PAdES one (see GenerateESSSigningCertPAdESAttribute). (Do not place an ASN.1ructed type around all of the attributes.) Do not pass any of the normal attributes (content type or message digest) as custom attributes because otherwise they will be duplicated. :rtype: std::vector< UChar,std::allocator< UChar > > :return: the BER-encoded bytes of the future signedAttrs component of a CMS signature, with no surroundingructed type """ return _PDFNetPython.DigitalSignatureField_GenerateCMSSignedAttributes(args)
[docs] @staticmethod def GenerateCMSSignature(args): r""" Overload 1: Low-level function belonging to custom-signing APIs. Using low-level inputs that permit incorporation of remote key usage (cloud keystore, Hardware Security Module (HSM) device, etc.), generates bytes representing a Cryptographic Message Syntax (CMS)-format signature encoded in DER. The resulting data can be passed to SaveCustomSignature. :type in_signer_cert: :py:class:`X509Certificate` :param in_signer_cert: -- the X509 public-key certificate of the signature's signer (mathematically associated with private key used) :type in_chain_certs_list: std::vector< Crypto::X509Certificate,std::allocator< Crypto::X509Certificate > > :param in_chain_certs_list: -- the intermediate and root certificates to include in the CMS to allow verifiers to establish the chain/path of trust :type in_digest_algorithm_oid: :py:class:`ObjectIdentifier` :param in_digest_algorithm_oid: -- the OID of the digest algorithm used, for embedding in the CMS :type in_signature_algorithm_oid: :py:class:`ObjectIdentifier` :param in_signature_algorithm_oid: -- the OID of the signature algorithm used, for embedding in the CMS :type in_signature_value_buf: std::vector< UChar,std::allocator< UChar > > :param in_signature_value_buf: -- a buffer containing the signature value to embed in the CMS :type in_signedattributes_buf: std::vector< UChar,std::allocator< UChar > > :param in_signedattributes_buf: -- a buffer containing signedAttributes for embedding into the CMS (must exactly match those used when creating signature value) :rtype: std::vector< UChar,std::allocator< UChar > > :return: finished CMS data for embedding into the document using SaveCustomSignature | Overload 2: Low-level function belonging to custom-signing APIs. Using low-level inputs that permit incorporation of remote key usage (cloud keystore, Hardware Security Module (HSM) device, etc.), generates bytes representing a Cryptographic Message Syntax (CMS)-format signature encoded in DER. The resulting data can be passed to SaveCustomSignature. :type signer_cert: :py:class:`X509Certificate` :param signer_cert: The X509 public-key certificate of the signature's signer (mathematically associated with private key used). :type chain_certs_list: std::vector< Crypto::X509Certificate,std::allocator< Crypto::X509Certificate > > :param chain_certs_list: The intermediate and root certificates to include in the CMS to allow verifiers to establish the chain/path of trust. :type digest_algorithm_id: :py:class:`AlgorithmIdentifier` :param digest_algorithm_id: The digest algorithm used, for embedding in the CMS. :type signature_algorithm_id: :py:class:`AlgorithmIdentifier` :param signature_algorithm_id: The signature algorithm used, for embedding in the CMS. :type signature_value_buf: std::vector< UChar,std::allocator< UChar > > :param signature_value_buf: A buffer containing the signature value to embed in the CMS. :type signedattributes_buf: std::vector< UChar,std::allocator< UChar > > :param signedattributes_buf: A buffer containing signedAttributes for embedding into the CMS (must exactly match those used when creating signature value). :type cms_options: :py:class:`CMSSignatureOptions` :param cms_options: Optional extra data to store in the CMS. :rtype: std::vector< UChar,std::allocator< UChar > > :return: The finished CMS data for embedding into the document using SaveCustomSignature. | Overload 3: Low-level function belonging to custom-signing APIs. Using low-level inputs that permit incorporation of remote key usage (cloud keystore, Hardware Security Module (HSM) device, etc.), generates bytes representing a Cryptographic Message Syntax (CMS)-format signature encoded in DER. The resulting data can be passed to SaveCustomSignature. :type signer_cert: :py:class:`X509Certificate` :param signer_cert: The X509 public-key certificate of the signature's signer (mathematically associated with private key used). :type chain_certs_list: std::vector< Crypto::X509Certificate,std::allocator< Crypto::X509Certificate > > :param chain_certs_list: The intermediate and root certificates to include in the CMS to allow verifiers to establish the chain/path of trust. :type digest_algorithm_id: :py:class:`AlgorithmIdentifier` :param digest_algorithm_id: The digest algorithm used, for embedding in the CMS. :type signature_algorithm_id: :py:class:`AlgorithmIdentifier` :param signature_algorithm_id: The signature algorithm used, for embedding in the CMS. :type signature_value_buf: std::vector< UChar,std::allocator< UChar > > :param signature_value_buf: A buffer containing the signature value to embed in the CMS. :type signedattributes_buf: std::vector< UChar,std::allocator< UChar > > :param signedattributes_buf: A buffer containing signedAttributes for embedding into the CMS (must exactly match those used when creating signature value). :param cms_options: Optional extra data to store in the CMS. :rtype: std::vector< UChar,std::allocator< UChar > > :return: The finished CMS data for embedding into the document using SaveCustomSignature. """ return _PDFNetPython.DigitalSignatureField_GenerateCMSSignature(args)
[docs] @staticmethod def SetDigSigLogFilename(filename): r""" Sets the digital signature logging filename, and enables the logging. This function is expected to be called only once. Subsequent calls to the function will have no effect. :type filename: string :param filename: The name (and path) of the log file. :rtype: boolean :return: True if this operation was successful and false if it failed because the logging process has already started. """ return _PDFNetPython.DigitalSignatureField_SetDigSigLogFilename(filename)
def __init__(self, args): _PDFNetPython.DigitalSignatureField_swiginit(self, _PDFNetPython.new_DigitalSignatureField(args)) m_impl = property(_PDFNetPython.DigitalSignatureField_m_impl_get, _PDFNetPython.DigitalSignatureField_m_impl_set) __swig_destroy__ = _PDFNetPython.delete_DigitalSignatureField
# Register DigitalSignatureField in _PDFNetPython: _PDFNetPython.DigitalSignatureField_swigregister(DigitalSignatureField)
[docs] def DigitalSignatureField_SignDigest(args): r""" Overload 1: Returns a CMS detached signature incorporating a digest that is provided using the provided PKCS #12 key file (.pfx). This function is part of the custom signing API, but cannot be used for workflows where the key is not in PFX format or when the signature comes from a source that cannot generate CMS signatures (e.g. Hardware Security Modules (HSM) devices, cloud signing services). In such cases, the low-level parts of the custom signing API should be used instead of this function (e.g. GenerateESSSigningCertPAdESAttribute, GenerateCMSSignedAttributes, GenerateCMSSignature). This function is a shortcut for situations in which use of more low-level custom signing functions is unnecessary. Therefore, this function will generate necessary CMS components, such as signedAttrs, internally. Notes: This function does not change the DigitalSignatureField. Call SaveCustomSignature to write a signature to its PDFDoc. :type in_digest: std::vector< UChar,std::allocator< UChar > > :param in_digest: -- the document digest value to use :type in_pkcs12_keyfile_path: string :param in_pkcs12_keyfile_path: -- the path to the PKCS #12 key file (usually has a .pfx extension) to use for signing :type in_keyfile_password: string :param in_keyfile_password: -- the password to use to decrypt the PKCS #12 key file :type in_pades_mode: boolean :param in_pades_mode: -- whether to create a PAdES-type signature (PDF Advanced Electronic Signatures standards) :type in_digest_algorithm_type: int :param in_digest_algorithm_type: -- the identifier to use to write the digest algorithm :rtype: std::vector< UChar,std::allocator< UChar > > :return: the DER-serialized bytes of a CMS detached signature (CMS ContentInfo) | Overload 2: Returns a CMS detached signature incorporating a digest that is provided using the provided PKCS #12 key buffer (.pfx). This function is part of the custom signing API, but cannot be used for workflows where the key is not in PFX format or when the signature comes from a source that cannot generate CMS signatures (e.g. Hardware Security Modules (HSM) devices, cloud signing services). In such cases, the low-level parts of the custom signing API should be used instead of this function (e.g. GenerateESSSigningCertPAdESAttribute, GenerateCMSSignedAttributes, GenerateCMSSignature). This function is a shortcut for situations in which use of more low-level custom signing functions is unnecessary. Therefore, this function will generate necessary CMS components, such as signedAttrs, internally. Notes: This function does not change the DigitalSignatureField. Call SaveCustomSignature to write a signature to its PDFDoc. :type in_digest: std::vector< UChar,std::allocator< UChar > > :param in_digest: -- the document digest value to use :type in_pkcs12_buffer: std::vector< UChar,std::allocator< UChar > > :param in_pkcs12_buffer: -- a buffer containing the PKCS #12 key (as usually stored in .pfx files) to use for signing :type in_keyfile_password: string :param in_keyfile_password: -- the password to use to decrypt the PKCS #12 key file data in the buffer :type in_pades_mode: boolean :param in_pades_mode: -- whether to create a PAdES-type signature (PDF Advanced Electronic Signatures standards) :type in_digest_algorithm_type: int :param in_digest_algorithm_type: -- the identifier to use to write the digest algorithm :rtype: std::vector< UChar,std::allocator< UChar > > :return: the DER-serialized bytes of a CMS detached signature (CMS ContentInfo) """ return _PDFNetPython.DigitalSignatureField_SignDigest(args)
[docs] def DigitalSignatureField_GenerateESSSigningCertPAdESAttribute(in_signer_cert, in_digest_algorithm_type): r""" Low-level optional function belonging to custom-signing APIs allowing creation of PAdES signatures with key elsewhere, allowing CMS to be generated automatically later. Represents one the components of the functionality of SignDigest which are not key-related. Creates the necessary attribute for a PAdES signature (ETSI.CAdES.detached subfilter type). The result of this function can be passed as a contiguous part of the custom attributes buffer parameter of GenerateCMSSignedAttributes. At least one signing time, whether "M" (see SetSigDictTimeOfSigning) or a secure embedded timestamp (see GenerateContentsWithEmbeddedTimestamp), is also required to be added in order to create a PAdES signature. The result will be either the BER-serialized bytes of an ESS_signing_cert or ESS_signing_cert_V2 CMS Attribute (an ASN.1 SEQUENCE containing the correct OID and ESSCertID or ESSCertIDv2), as is appropriate, depending on what digest algorithm type is provided (see RFC 5035). :type in_signer_cert: :py:class:`X509Certificate` :param in_signer_cert: -- the X509 public-key certificate of the signature's signer (mathematically associated with private key to be used) :type in_digest_algorithm_type: int :param in_digest_algorithm_type: -- the digest algorithm to be used :rtype: std::vector< UChar,std::allocator< UChar > > :return: the BER-serialized bytes of an ESS_signing_cert or ESS_signing_cert_V2 CMS attribute """ return _PDFNetPython.DigitalSignatureField_GenerateESSSigningCertPAdESAttribute(in_signer_cert, in_digest_algorithm_type)
[docs] def DigitalSignatureField_GenerateCMSSignedAttributes(args): r""" Low-level function belonging to custom-signing APIs. Creates the signedAttributes component of Cryptographic Message Syntax (CMS). The result of this function can then be encrypted by a remote private key (cloud service, Hardware Security Module (HSM) device, etc.), using some external API that returns the bytes of a not-already-CMS-embedded signature value (e.g. RSA PKCS #1 v1.5 format). Following that, CMS generation can be performed using GenerateCMSSignature, after which the resulting signature can be inserted into a resulting signed version of the PDF document using the PDFDoc function SaveCustomSignature. :type in_digest_buf: std::vector< UChar,std::allocator< UChar > > :param in_digest_buf: -- a buffer containing the digest of the document within ByteRanges of this DigitalSignatureField (see CalculateDigest) :type in_custom_signedattributes_buf: std::vector< UChar,std::allocator< UChar > > :param in_custom_signedattributes_buf: -- a buffer containing any optional custom BER-encoded signedAttributes to add, including potentially the PAdES one (see GenerateESSSigningCertPAdESAttribute). (Do not place an ASN.1ructed type around all of the attributes.) Do not pass any of the normal attributes (content type or message digest) as custom attributes because otherwise they will be duplicated. :rtype: std::vector< UChar,std::allocator< UChar > > :return: the BER-encoded bytes of the future signedAttrs component of a CMS signature, with no surroundingructed type """ return _PDFNetPython.DigitalSignatureField_GenerateCMSSignedAttributes(args)
[docs] def DigitalSignatureField_GenerateCMSSignature(args): r""" Overload 1: Low-level function belonging to custom-signing APIs. Using low-level inputs that permit incorporation of remote key usage (cloud keystore, Hardware Security Module (HSM) device, etc.), generates bytes representing a Cryptographic Message Syntax (CMS)-format signature encoded in DER. The resulting data can be passed to SaveCustomSignature. :type in_signer_cert: :py:class:`X509Certificate` :param in_signer_cert: -- the X509 public-key certificate of the signature's signer (mathematically associated with private key used) :type in_chain_certs_list: std::vector< Crypto::X509Certificate,std::allocator< Crypto::X509Certificate > > :param in_chain_certs_list: -- the intermediate and root certificates to include in the CMS to allow verifiers to establish the chain/path of trust :type in_digest_algorithm_oid: :py:class:`ObjectIdentifier` :param in_digest_algorithm_oid: -- the OID of the digest algorithm used, for embedding in the CMS :type in_signature_algorithm_oid: :py:class:`ObjectIdentifier` :param in_signature_algorithm_oid: -- the OID of the signature algorithm used, for embedding in the CMS :type in_signature_value_buf: std::vector< UChar,std::allocator< UChar > > :param in_signature_value_buf: -- a buffer containing the signature value to embed in the CMS :type in_signedattributes_buf: std::vector< UChar,std::allocator< UChar > > :param in_signedattributes_buf: -- a buffer containing signedAttributes for embedding into the CMS (must exactly match those used when creating signature value) :rtype: std::vector< UChar,std::allocator< UChar > > :return: finished CMS data for embedding into the document using SaveCustomSignature | Overload 2: Low-level function belonging to custom-signing APIs. Using low-level inputs that permit incorporation of remote key usage (cloud keystore, Hardware Security Module (HSM) device, etc.), generates bytes representing a Cryptographic Message Syntax (CMS)-format signature encoded in DER. The resulting data can be passed to SaveCustomSignature. :type signer_cert: :py:class:`X509Certificate` :param signer_cert: The X509 public-key certificate of the signature's signer (mathematically associated with private key used). :type chain_certs_list: std::vector< Crypto::X509Certificate,std::allocator< Crypto::X509Certificate > > :param chain_certs_list: The intermediate and root certificates to include in the CMS to allow verifiers to establish the chain/path of trust. :type digest_algorithm_id: :py:class:`AlgorithmIdentifier` :param digest_algorithm_id: The digest algorithm used, for embedding in the CMS. :type signature_algorithm_id: :py:class:`AlgorithmIdentifier` :param signature_algorithm_id: The signature algorithm used, for embedding in the CMS. :type signature_value_buf: std::vector< UChar,std::allocator< UChar > > :param signature_value_buf: A buffer containing the signature value to embed in the CMS. :type signedattributes_buf: std::vector< UChar,std::allocator< UChar > > :param signedattributes_buf: A buffer containing signedAttributes for embedding into the CMS (must exactly match those used when creating signature value). :type cms_options: :py:class:`CMSSignatureOptions` :param cms_options: Optional extra data to store in the CMS. :rtype: std::vector< UChar,std::allocator< UChar > > :return: The finished CMS data for embedding into the document using SaveCustomSignature. | Overload 3: Low-level function belonging to custom-signing APIs. Using low-level inputs that permit incorporation of remote key usage (cloud keystore, Hardware Security Module (HSM) device, etc.), generates bytes representing a Cryptographic Message Syntax (CMS)-format signature encoded in DER. The resulting data can be passed to SaveCustomSignature. :type signer_cert: :py:class:`X509Certificate` :param signer_cert: The X509 public-key certificate of the signature's signer (mathematically associated with private key used). :type chain_certs_list: std::vector< Crypto::X509Certificate,std::allocator< Crypto::X509Certificate > > :param chain_certs_list: The intermediate and root certificates to include in the CMS to allow verifiers to establish the chain/path of trust. :type digest_algorithm_id: :py:class:`AlgorithmIdentifier` :param digest_algorithm_id: The digest algorithm used, for embedding in the CMS. :type signature_algorithm_id: :py:class:`AlgorithmIdentifier` :param signature_algorithm_id: The signature algorithm used, for embedding in the CMS. :type signature_value_buf: std::vector< UChar,std::allocator< UChar > > :param signature_value_buf: A buffer containing the signature value to embed in the CMS. :type signedattributes_buf: std::vector< UChar,std::allocator< UChar > > :param signedattributes_buf: A buffer containing signedAttributes for embedding into the CMS (must exactly match those used when creating signature value). :param cms_options: Optional extra data to store in the CMS. :rtype: std::vector< UChar,std::allocator< UChar > > :return: The finished CMS data for embedding into the document using SaveCustomSignature. """ return _PDFNetPython.DigitalSignatureField_GenerateCMSSignature(args)
[docs] def DigitalSignatureField_SetDigSigLogFilename(filename): r""" Sets the digital signature logging filename, and enables the logging. This function is expected to be called only once. Subsequent calls to the function will have no effect. :type filename: string :param filename: The name (and path) of the log file. :rtype: boolean :return: True if this operation was successful and false if it failed because the logging process has already started. """ return _PDFNetPython.DigitalSignatureField_SetDigSigLogFilename(filename)
[docs] class FileSpec(object): r""" FileSpec corresponds to the PDF file specification object. A PDF file can refer to the contents of another file by using a file specification, which can take either of the following forms: - A simple file specification gives just the name of the target file in a standard format, independent of the naming conventions of any particular file system. - A full file specification includes information related to one or more specific file systems. - A URL reference. Although the file designated by a file specification is normally external to the PDF file referring to it, it is also possible to embed the file allowing its contents to be stored or transmitted along with the PDF file. However, embedding a file does not change the presumption that it is external to (or separate from) the PDF file. For more details on file specifications, please refer to Section 3.10, 'File Specifications' in the PDF Reference Manual. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, path, embed=True): r""" Creates a file specification for the given file. By default, the specified file is embedded in PDF. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the FileSpec should be added. To obtain SDFDoc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc(). :type path: string :param path: - The path to convert into a file specification. :type embed: boolean :param embed: - A flag indicating whether to embed specified in the PDF. By default, all files are embedded. :rtype: :py:class:`FileSpec` :return: newly created FileSpec object. """ return _PDFNetPython.FileSpec_Create(doc, path, embed)
[docs] @staticmethod def CreateURL(doc, url): r""" Creates a URL file specification. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the FileSpec should be added. To obtain SDFDoc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc(). :type url: string :param url: - A uniform resource locator (URL) of the form defined in Internet RFC 1738, Uniform Resource Locators Specification. :rtype: :py:class:`FileSpec` :return: newly created FileSpec object. """ return _PDFNetPython.FileSpec_CreateURL(doc, url)
def __eq__(self, d): r""" Compares two FileSpec-s for equality. The comparison will return true only if both annotations share the same underlying SDF/Cos object. """ return _PDFNetPython.FileSpec___eq__(self, d)
[docs] def IsValid(self): r""" :rtype: boolean :return: whether this is a valid (non-null) FileSpec. If the function returns false the underlying SDF/Cos object is null or is not valid and the FileSpec object should be treated as null as well. """ return _PDFNetPython.FileSpec_IsValid(self)
[docs] def Export(self, args): r""" The function saves the data referenced by this FileSpec to an external file. :type save_as: string :param save_as: An optional parameter indicating the filepath and filename where the data should be saved. If this parameter is not specified, the function will attempt to save the file using FileSpec.GetFilePath(). If the file is embedded, the function saves the embedded file. If the file is not embedded, the function will copy the external file. If the file is not embedded and the external file can't be found, the function returns false. :rtype: boolean :return: true is the file was saved successfully, false otherwise. """ return _PDFNetPython.FileSpec_Export(self, args)
[docs] def GetFileData(self): r""" The function returns data referenced by this FileSpec. :rtype: :py:class:`Filter` :return: A stream (filter) containing file data. If the file is embedded, the function returns a stream to the embedded file. If the file is not embedded, the function will return a stream to the external file. If the file is not embedded and the external file can't be found, the function returns NULL. """ return _PDFNetPython.FileSpec_GetFileData(self)
[docs] def GetFilePath(self): r""" :rtype: string :return: The file path for this file specification. If the FileSpec is a dictionary, a corresponding platform specific path is returned (DOS, Mac, or Unix). Otherwise the function returns the path represented in the form described in Section 3.10.1, 'File Specification Strings,' or , if the file system is URL, as a uniform resource locator (URL). If the FileSpec is not valid, an empty string is returned. """ return _PDFNetPython.FileSpec_GetFilePath(self)
[docs] def SetDesc(self, desc): r""" The functions sets the descriptive text associated with the file specification. This test is typically used in the EmbeddedFiles name tree. """ return _PDFNetPython.FileSpec_SetDesc(self, desc)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: The underlying SDF/Cos object. """ return _PDFNetPython.FileSpec_GetSDFObj(self)
def __init__(self, args): _PDFNetPython.FileSpec_swiginit(self, _PDFNetPython.new_FileSpec(args)) mp_impl = property(_PDFNetPython.FileSpec_mp_impl_get, _PDFNetPython.FileSpec_mp_impl_set) __swig_destroy__ = _PDFNetPython.delete_FileSpec
# Register FileSpec in _PDFNetPython: _PDFNetPython.FileSpec_swigregister(FileSpec)
[docs] def FileSpec_Create(doc, path, embed=True): r""" Creates a file specification for the given file. By default, the specified file is embedded in PDF. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the FileSpec should be added. To obtain SDFDoc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc(). :type path: string :param path: - The path to convert into a file specification. :type embed: boolean :param embed: - A flag indicating whether to embed specified in the PDF. By default, all files are embedded. :rtype: :py:class:`FileSpec` :return: newly created FileSpec object. """ return _PDFNetPython.FileSpec_Create(doc, path, embed)
[docs] def FileSpec_CreateURL(doc, url): r""" Creates a URL file specification. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the FileSpec should be added. To obtain SDFDoc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc(). :type url: string :param url: - A uniform resource locator (URL) of the form defined in Internet RFC 1738, Uniform Resource Locators Specification. :rtype: :py:class:`FileSpec` :return: newly created FileSpec object. """ return _PDFNetPython.FileSpec_CreateURL(doc, url)
[docs] class Flattener(object): r""" Flattener is a optional PDFNet add-on that can be used to simplify and optimize existing PDF's to render faster on devices with lower memory and speeds. PDF documents can frequently contain very complex page description (e.g. thousands of paths, different shadings, color spaces, blend modes, large images etc.) that may not be suitable for interactive viewing on mobile devices. Flattener can be used to speed-up PDF rendering on mobile devices and on the Web by simplifying page content (e.g. flattening complex graphics into images) while maintaining vector text whenever possible. By using the FlattenMode::e_simple option each page in the PDF will be reduced to a single background image, with the remaining text over top in vector format. Some text may still get flattened, in particular any text that is clipped, or underneath, other content that will be flattened. On the other hand the FlattenMode::e_fast will not flatten simple content, such as simple straight lines, nor will it flatten Type3 fonts. Notes: 'Flattener' is available as a separately licensable add-on to PDFNet core license. See 'pdftron.PDF.Optimizer' for alternate approach to optimize PDFs with focus on file size reduction. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Flattenerructor""" _PDFNetPython.Flattener_swiginit(self, _PDFNetPython.new_Flattener()) __swig_destroy__ = _PDFNetPython.delete_Flattener
[docs] def SetDPI(self, dpi): r""" The output resolution, from 1 to 1000, in Dots Per Inch (DPI) at which to render elements which cannot be directly converted. the default value is 150 Dots Per Inch :type dpi: int :param dpi: the resolution in Dots Per Inch """ return _PDFNetPython.Flattener_SetDPI(self, dpi)
[docs] def SetMaximumImagePixels(self, max_pixels): r""" Specifies the maximum image size in pixels. :type max_pixels: int :param max_pixels: the maximum number of pixels an image can have. """ return _PDFNetPython.Flattener_SetMaximumImagePixels(self, max_pixels)
[docs] def SetPreferJPG(self, jpg): r""" Specifies whether to leave images in existing compression, or as JPEG. :type jpg: boolean :param jpg: if true PDF will contain all JPEG images. """ return _PDFNetPython.Flattener_SetPreferJPG(self, jpg)
[docs] def SetJPGQuality(self, quality): r""" Specifies the compression quality to use when generating JPEG images. :type quality: int :param quality: the JPEG compression quality, from 0(highest compression) to 100(best quality). """ return _PDFNetPython.Flattener_SetJPGQuality(self, quality)
e_threshold_very_strict = _PDFNetPython.Flattener_e_threshold_very_strict r""" Render (flatten) any text that is clipped or occluded.""" e_threshold_strict = _PDFNetPython.Flattener_e_threshold_strict r""" Render text that are marginally clipped or occluded.""" e_threshold_default = _PDFNetPython.Flattener_e_threshold_default r""" Render text that are somewhat clipped or occluded.""" e_threshold_keep_most = _PDFNetPython.Flattener_e_threshold_keep_most r""" Only render text that are seriously clipped or occluded.""" e_threshold_keep_all = _PDFNetPython.Flattener_e_threshold_keep_all r""" Only render text that are completely occluded, or used as a clipping path.""" e_simple = _PDFNetPython.Flattener_e_simple r""" Feature reduce PDF to a simple two layer representation consisting of a single background RGB image and a simple top text layer. """ e_fast = _PDFNetPython.Flattener_e_fast r""" Feature reduce PDF while trying to preserve some complex PDF features (such as vector figures, transparency, shadings, blend modes, Type3 fonts etc.) for pages that are already fast to render. This option can also result in smaller faster files compared to e_simple, but the pages may have more complex structure. """
[docs] def SetThreshold(self, threshold): r""" Used to control how precise or relaxed text flattening is. When some text is preserved (not flattened to image) the visual appearance of the document may be altered. :type threshold: int :param threshold: the threshold setting to use. """ return _PDFNetPython.Flattener_SetThreshold(self, threshold)
[docs] def SetPathHinting(self, enable_hinting): r""" Enable or disable path hinting. :type enable_hinting: boolean :param enable_hinting: if true path hinting is enabled. Path hinting is used to slightly adjust paths in order to avoid or alleviate artifacts of hair line cracks between certain graphical elements. This option is turned on by default. """ return _PDFNetPython.Flattener_SetPathHinting(self, enable_hinting)
[docs] def Process(self, args): r""" Overload 1: Process each page in the PDF, flattening content that matches the mode criteria. :type doc: :py:class:`PDFDoc` :param doc: the document to flatten. :type mode: int :param mode: indicates the criteria for which elements are flattened. | Overload 2: Process the given page, flattening content that matches the mode criteria. :type page: :py:class:`Page` :param page: the page to flatten. :type mode: int :param mode: indicates the criteria for which elements are flattened. """ return _PDFNetPython.Flattener_Process(self, args)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.Flattener_Destroy(self)
mp_impl = property(_PDFNetPython.Flattener_mp_impl_get, _PDFNetPython.Flattener_mp_impl_set)
# Register Flattener in _PDFNetPython: _PDFNetPython.Flattener_swigregister(Flattener)
[docs] class RefreshOptions(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): _PDFNetPython.RefreshOptions_swiginit(self, _PDFNetPython.new_RefreshOptions()) __swig_destroy__ = _PDFNetPython.delete_RefreshOptions
[docs] def GetDrawBackgroundOnly(self): r""" Gets the value DrawBackgroundOnly from the options object If true draw only the background and border, which can be useful when generating the rest of the annotation content elsewhere. Off by default. :rtype: boolean :return: the current value for DrawBackgroundOnly. """ return _PDFNetPython.RefreshOptions_GetDrawBackgroundOnly(self)
[docs] def SetDrawBackgroundOnly(self, value): r""" Sets the value for DrawBackgroundOnly in the options object If true draw only the background and border, which can be useful when generating the rest of the annotation content elsewhere. Off by default. :type value: boolean :param value: the new value for DrawBackgroundOnly :rtype: :py:class:`RefreshOptions` :return: this object, for call chaining """ return _PDFNetPython.RefreshOptions_SetDrawBackgroundOnly(self, value)
[docs] def GetRefreshExisting(self): r""" Gets the value RefreshExisting from the options object Whether we should refresh annotations with existing appearances. Defaults to false when used in PDFDoc.RefreshAnnotAppearances and true when used in Annot.RefreshAppearance. :rtype: boolean :return: the current value for RefreshExisting. """ return _PDFNetPython.RefreshOptions_GetRefreshExisting(self)
[docs] def SetRefreshExisting(self, value): r""" Sets the value for RefreshExisting in the options object Whether we should refresh annotations with existing appearances. Defaults to false when used in PDFDoc.RefreshAnnotAppearances and true when used in Annot.RefreshAppearance. :type value: boolean :param value: the new value for RefreshExisting :rtype: :py:class:`RefreshOptions` :return: this object, for call chaining """ return _PDFNetPython.RefreshOptions_SetRefreshExisting(self, value)
[docs] def GetUseNonStandardRotation(self): r""" Gets the value UseNonStandardRotation from the options object Whether we should use rotation in the annotation even if it is not a multiple of 90. Off by default. :rtype: boolean :return: the current value for UseNonStandardRotation. """ return _PDFNetPython.RefreshOptions_GetUseNonStandardRotation(self)
[docs] def SetUseNonStandardRotation(self, value): r""" Sets the value for UseNonStandardRotation in the options object Whether we should use rotation in the annotation even if it is not a multiple of 90. Off by default. :type value: boolean :param value: the new value for UseNonStandardRotation. :rtype: :py:class:`RefreshOptions` :return: this object, for call chaining """ return _PDFNetPython.RefreshOptions_SetUseNonStandardRotation(self, value)
[docs] def GetUseRoundedCorners(self): r""" Gets the value UseRoundedCorners from the options object Whether we should use the corner radii specified in Annot.BorderStyle. Off by default. :rtype: boolean :return: the current value for UseRoundedCorners. """ return _PDFNetPython.RefreshOptions_GetUseRoundedCorners(self)
[docs] def SetUseRoundedCorners(self, value): r""" Sets the value for UseRoundedCorners in the options object Whether we should use the corner radii specified in Annot.BorderStyle. Off by default. :type value: boolean :param value: the new value for UseRoundedCorners. :rtype: :py:class:`RefreshOptions` :return: this object, for call chaining """ return _PDFNetPython.RefreshOptions_SetUseRoundedCorners(self, value)
[docs] def GetInternalObj(self): return _PDFNetPython.RefreshOptions_GetInternalObj(self)
# Register RefreshOptions in _PDFNetPython: _PDFNetPython.RefreshOptions_swigregister(RefreshOptions)
[docs] class Annot(object): r""" Annot is a base class for different types of annotations. For annotation specific properties, please refer to derived classes. An annotation is an interactive object placed on a page, such as a text note, a link, or an embedded file. PDF includes a wide variety of standard annotation types. An annotation associates an object such as a widget, note, or movie with a location on a page of a PDF document, or provides a means of interacting with the user via the mouse and keyboard. For more details on PDF annotations please refer to section 12.5 in the PDF Reference Manual and the documentation in derived classes. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_Text = _PDFNetPython.Annot_e_Text r""" Text annotation""" e_Link = _PDFNetPython.Annot_e_Link r""" Link annotation""" e_FreeText = _PDFNetPython.Annot_e_FreeText r""" Free text annotation""" e_Line = _PDFNetPython.Annot_e_Line r""" Line annotation""" e_Square = _PDFNetPython.Annot_e_Square r""" Square annotation""" e_Circle = _PDFNetPython.Annot_e_Circle r""" Circle annotation""" e_Polygon = _PDFNetPython.Annot_e_Polygon r""" Polygon annotation""" e_Polyline = _PDFNetPython.Annot_e_Polyline r""" Polyline annotation""" e_Highlight = _PDFNetPython.Annot_e_Highlight r""" Highlight annotation""" e_Underline = _PDFNetPython.Annot_e_Underline r""" Underline annotation""" e_Squiggly = _PDFNetPython.Annot_e_Squiggly r""" Squiggly-underline annotation""" e_StrikeOut = _PDFNetPython.Annot_e_StrikeOut r""" Strikeout annotation""" e_Stamp = _PDFNetPython.Annot_e_Stamp r""" Rubber stamp annotation""" e_Caret = _PDFNetPython.Annot_e_Caret r""" Caret annotation""" e_Ink = _PDFNetPython.Annot_e_Ink r""" Ink annotation""" e_Popup = _PDFNetPython.Annot_e_Popup r""" Pop-up annotation""" e_FileAttachment = _PDFNetPython.Annot_e_FileAttachment r""" File attachment annotation""" e_Sound = _PDFNetPython.Annot_e_Sound r""" Sound annotation""" e_Movie = _PDFNetPython.Annot_e_Movie r""" Movie annotation""" e_Widget = _PDFNetPython.Annot_e_Widget r""" Widget annotation""" e_Screen = _PDFNetPython.Annot_e_Screen r""" Screen annotation""" e_PrinterMark = _PDFNetPython.Annot_e_PrinterMark r""" Printer's mark annotation""" e_TrapNet = _PDFNetPython.Annot_e_TrapNet r""" Trap network annotation""" e_Watermark = _PDFNetPython.Annot_e_Watermark r""" Watermark annotation""" e_3D = _PDFNetPython.Annot_e_3D r""" 3D annotation""" e_Redact = _PDFNetPython.Annot_e_Redact r""" Redact annotation""" e_Projection = _PDFNetPython.Annot_e_Projection r""" Projection annotation, Adobe supplement to ISO 32000""" e_RichMedia = _PDFNetPython.Annot_e_RichMedia r""" Rich Media annotation, Adobe supplement to ISO 32000""" e_Unknown = _PDFNetPython.Annot_e_Unknown r""" Any other annotation type, not listed in PDF spec and unrecognized by PDFTron software"""
[docs] @staticmethod def Create(doc, type, pos): r""" Creates a new annotation of a given type, in the specified document. The newly created annotation does not contain any properties specific to a given annotation type, which means an invalid annotation object could be created. It is therefore recommended to always create an annotation using type specific methods, such as Annots::Line::Create() or Annots::FileAttachment::Create(). Users should only call Annot::Create() to create annotations of non-standard types that are not recognized by PDFTron software (by using Annot::e_Unknown as a type). :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type type: int :param type: Subtype of annotation to create. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :rtype: :py:class:`Annot` :return: A newly created blank annotation for the given annotation type. """ return _PDFNetPython.Annot_Create(doc, type, pos)
def __eq__(self, d): r""" Compares two annotations for equality. The comparison will return true only if both annotations share the same underlying SDF/Cos object. :type d: :py:class:`Annot` :param d: Annotation to compare to """ return _PDFNetPython.Annot___eq__(self, d)
[docs] def IsValid(self): r""" :rtype: boolean :return: True if this is a valid (non-null) annotation, false otherwise. If the function returns false the underlying SDF/Cos object is null or is not valid and the annotation object should be treated as a null object. """ return _PDFNetPython.Annot_IsValid(self)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: The underlying SDF/Cos object. """ return _PDFNetPython.Annot_GetSDFObj(self)
[docs] def GetType(self): r""" :rtype: int :return: The type of this annotation. Corresponds to the "Subtype" entry of annotation dictionary, as per PDF Reference Manual section 12.5.2 """ return _PDFNetPython.Annot_GetType(self)
[docs] def GetRect(self): r""" :rtype: :py:class:`Rect` :return: Annotation's bounding rectangle, specified in user space coordinates. The meaning of the rectangle depends on the annotation type. For Link and RubberStamp annotations, the rectangle specifies the area containing the hyperlink area or stamp. For Note annotations, the rectangle is describing the popup window when it's opened. When it's closed, the icon is positioned at lower left corner. """ return _PDFNetPython.Annot_GetRect(self)
[docs] def GetVisibleContentBox(self): r""" It is possible during viewing that GetRect does not return the most accurate bounding box of what is actually rendered. This method calculates the bounding box, rather than relying on what is specified in the PDF document. The bounding box is defined as the smallest rectangle that includes all the visible content on the annotation. :rtype: :py:class:`Rect` :return: the bounding box for this annotation. The dimensions are specified in user space coordinates. """ return _PDFNetPython.Annot_GetVisibleContentBox(self)
[docs] def IsMarkup(self): r""" Return true if this annotation is classified as a markup annotation. :rtype: boolean :return: boolean value, true if this annotation is classified as a markup annotation. """ return _PDFNetPython.Annot_IsMarkup(self)
[docs] def SetRect(self, pos): r""" Sets the size and location of an annotation on its page. :type pos: :py:class:`Rect` :param pos: Annotation's bounding rectangle, specified in user space coordinates. The meaning of the rectangle depends on the annotation type. For Link and RubberStamp annotations, the rectangle specifies the area containing the hyperlink area or stamp. For Note annotations, the rectangle is describing the popup window when it's opened. When it's closed, the icon is positioned at lower left corner. """ return _PDFNetPython.Annot_SetRect(self, pos)
[docs] def GetPage(self): r""" Gets the page the annotation is associated with. :rtype: :py:class:`Page` :return: A Page object or null page object if the page reference is not available. The page object returned is an indirect reference to the page object with which this annotation is associated. This entry shall be present in screen annotations associated with rendition actions. Optional. PDF 1.3 PDF 1.4 PDF 1.5 not used in FDF files. """ return _PDFNetPython.Annot_GetPage(self)
[docs] def SetPage(self, page): r""" Sets the reference to a page the annotation is associated with. (Optional PDF 1.3; not used in FDF files) :type page: :py:class:`Page` :param page: The page object user wants the annotation to be associated with. Notes: The parameter should be an indirect reference to the page object with which this annotation is associated. This entry shall be present in screen annotations associated with rendition actions """ return _PDFNetPython.Annot_SetPage(self, page)
[docs] def GetUniqueID(self): r""" :rtype: :py:class:`Obj` :return: The unique identifier for this annotation, or NULL if the identifier is not available. The returned value is a String object and is the value of the "NM" field, which was added as an optional attribute in PDF 1.4. """ return _PDFNetPython.Annot_GetUniqueID(self)
[docs] def SetUniqueID(self, id, id_buf_sz=0): r""" Sets the unique identifier for this annotation. :type id: string :param id: A buffer containing a unique identifier for this annotation. :type id_buf_sz: int :param id_buf_sz: The size of 'id' buffer, or 0 if the string is NULL terminated. Notes: It is necessary to ensure that the unique ID generated is actually unique. """ return _PDFNetPython.Annot_SetUniqueID(self, id, id_buf_sz)
[docs] def GetDate(self): r""" Gets an annotation's last modified date. :rtype: :py:class:`Date` :return: The annotation's last modified time and date. If the annotation has no associated date structure, the returned date is not valid (date.IsValid() returns false). Corresponds to the "M" entry of the annotation dictionary. """ return _PDFNetPython.Annot_GetDate(self)
[docs] def SetDate(self, date): r""" Sets an annotation's last modified date. :type date: :py:class:`Date` :param date: The annotation's last modified time and date. Corresponds to the "M" entry of the annotation dictionary. """ return _PDFNetPython.Annot_SetDate(self, date)
e_invisible = _PDFNetPython.Annot_e_invisible e_hidden = _PDFNetPython.Annot_e_hidden e_print = _PDFNetPython.Annot_e_print e_no_zoom = _PDFNetPython.Annot_e_no_zoom e_no_rotate = _PDFNetPython.Annot_e_no_rotate e_no_view = _PDFNetPython.Annot_e_no_view e_read_only = _PDFNetPython.Annot_e_read_only e_locked = _PDFNetPython.Annot_e_locked e_toggle_no_view = _PDFNetPython.Annot_e_toggle_no_view e_locked_contents = _PDFNetPython.Annot_e_locked_contents
[docs] def GetFlag(self, flag): r""" :rtype: boolean :return: The value of given Flag :type flag: int :param flag: The Flag property to query. """ return _PDFNetPython.Annot_GetFlag(self, flag)
[docs] def SetFlag(self, flag, value): r""" Sets the value of given Flag. :type flag: int :param flag: The Flag property to modify. :type value: boolean :param value: The new value for the property. """ return _PDFNetPython.Annot_SetFlag(self, flag, value)
e_action_trigger_activate = _PDFNetPython.Annot_e_action_trigger_activate e_action_trigger_annot_enter = _PDFNetPython.Annot_e_action_trigger_annot_enter e_action_trigger_annot_exit = _PDFNetPython.Annot_e_action_trigger_annot_exit e_action_trigger_annot_down = _PDFNetPython.Annot_e_action_trigger_annot_down e_action_trigger_annot_up = _PDFNetPython.Annot_e_action_trigger_annot_up e_action_trigger_annot_focus = _PDFNetPython.Annot_e_action_trigger_annot_focus e_action_trigger_annot_blur = _PDFNetPython.Annot_e_action_trigger_annot_blur e_action_trigger_annot_page_open = _PDFNetPython.Annot_e_action_trigger_annot_page_open e_action_trigger_annot_page_close = _PDFNetPython.Annot_e_action_trigger_annot_page_close e_action_trigger_annot_page_visible = _PDFNetPython.Annot_e_action_trigger_annot_page_visible e_action_trigger_annot_page_invisible = _PDFNetPython.Annot_e_action_trigger_annot_page_invisible
[docs] def GetTriggerAction(self, trigger): r""" Get the Action associated with the selected Annot Trigger event. :type trigger: int :param trigger: the type of trigger event to get :rtype: :py:class:`Obj` :return: the Action Obj if present, otherwise NULL """ return _PDFNetPython.Annot_GetTriggerAction(self, trigger)
[docs] def GetBorderStyle(self): r""" Gets the border style for the annotation. Typically used for Link annotations. :rtype: :py:class:`BorderStyle` :return: Annotation's border style. """ return _PDFNetPython.Annot_GetBorderStyle(self)
[docs] def SetBorderStyle(self, bs, oldStyleOnly=False): r""" Sets the border style for the annotation. :type bs: :py:class:`BorderStyle` :param bs: New border style for this annotation. :type oldStyleOnly: boolean :param oldStyleOnly: PDF manual specifies two ways to add border information to an annotation object, either through an array named 'Border' (PDF 1.0), or a dictionary called 'BS' (PDF 1.2) the latter taking precedence over the former. However, if you want to create a border with rounded corners, you can only do that using PDF 1.0 Border specification, in which case if you call SetBorderStyle() set the parameter oldStyleOnly to true. This parameter has a default value of false in the API and does not need to be used otherwise. """ return _PDFNetPython.Annot_SetBorderStyle(self, bs, oldStyleOnly)
e_normal = _PDFNetPython.Annot_e_normal e_rollover = _PDFNetPython.Annot_e_rollover e_down = _PDFNetPython.Annot_e_down
[docs] def GetAppearance(self, args): r""" Gets the annotation's appearance for the given combination of annotation and appearance states. :type annot_state: int :param annot_state: the annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance. :type app_state: string :param app_state: is an optional parameter specifying the appearance state to look for (e.g. "Off", "On", etc). If appearance_state is NULL, the choice between different appearance states is determined by the AS (Appearance State) entry in the annotation dictionary. :rtype: :py:class:`Obj` :return: The appearance stream for this annotation, or NULL if the annotation does not have an appearance for the given combination of annotation and appearance states. """ return _PDFNetPython.Annot_GetAppearance(self, args)
[docs] def SetAppearance(self, args): r""" Sets the annotation's appearance for the given combination of annotation and appearance states. (Optional; PDF 1.2) :type app_stream: :py:class:`Obj` :param app_stream: a content stream defining the new appearance. :type annot_state: int :param annot_state: the annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance. :type app_state: string :param app_state: is an optional parameter specifying the appearance state (e.g. "Off", "On", etc) under which the new appearance should be stored. If appearance_state is NULL, the annotation will have only one annotation state. """ return _PDFNetPython.Annot_SetAppearance(self, args)
[docs] def RemoveAppearance(self, args): r""" Removes the annotation's appearance for the given combination of annotation and appearance states. :type annot_state: int :param annot_state: the annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance. :type app_state: string :param app_state: is an optional parameter specifying the appearance state (e.g. "Off", "On", etc) under which the new appearance should be stored. If appearance_state is NULL, the annotation will have only one annotation state. """ return _PDFNetPython.Annot_RemoveAppearance(self, args)
[docs] def Flatten(self, page): r""" Flatten/Merge the existing annotation appearances with the page content and delete this annotation from a given page. Annotation 'flattening' refers to the operation that changes active annotations (such as markup, widgets, 3D models, etc.) into a static area that is part of the PDF document, just like the other text and images in the document. Notes: an alternative approach to set the annotation as read only is using Annot.SetFlag(Annot::e_read_only, true) method. Unlike Annot.SetFlag(...), the result of Flatten() operation can not be programatically reversed. """ return _PDFNetPython.Annot_Flatten(self, page)
[docs] def GetActiveAppearanceState(self): r""" Gets the annotation's active appearance state. :rtype: string :return: the name of the active state. The annotation's appearance state, which selects the applicable appearance stream from an appearance subdictionary. """ return _PDFNetPython.Annot_GetActiveAppearanceState(self)
[docs] def SetActiveAppearanceState(self, astate): r""" Sets the annotation's active appearance state. (Required if the appearance dictionary AP contains one or more subdictionaries; PDF 1.2) :type astate: string :param astate: Character string representing the name of the active appearance state. The string used to select the annotation's appearance state, which selects the applicable appearance stream from an appearance subdictionary. """ return _PDFNetPython.Annot_SetActiveAppearanceState(self, astate)
[docs] def GetColorAsRGB(self): r""" Gets an annotation's color in RGB color space. :rtype: :py:class:`ColorPt` :return: A ColorPt object containing an array of three numbers in the range 0.0 to 1.0, representing an RGB colour used for the following purposes: - The background of the annotation's icon when closed - The title bar of the annotation's pop-up window - The border of a link annotation If the annotation does not specify an explicit color, a default color is returned. Text annotations return 'default yellow;' all others return black. """ return _PDFNetPython.Annot_GetColorAsRGB(self)
[docs] def GetColorAsCMYK(self): r""" Returns the annotation's color in CMYK color space. :rtype: :py:class:`ColorPt` :return: A ColorPt object containing an array of four numbers in the range 0.0 to 1.0, representing a CMYK color used for the following purposes: - The background of the annotation's icon when closed - The title bar of the annotation's pop-up window - The border of a link annotation If the annotation does not specify an explicit color, a default color is returned. Text annotations return 'default yellow;' all others return black. """ return _PDFNetPython.Annot_GetColorAsCMYK(self)
[docs] def GetColorAsGray(self): r""" Returns the annotation's color in Gray color space. :rtype: :py:class:`ColorPt` :return: A ColorPt object containing a number in the range 0.0 to 1.0, representing a Gray Scale color used for the following purposes: The background of the annotation's icon when closed The title bar of the annotation's pop-up window The border of a link annotation If the annotation does not specify an explicit color, black color is returned. """ return _PDFNetPython.Annot_GetColorAsGray(self)
[docs] def GetColorCompNum(self): r""" Returns the color space the annotation's color is represented in. :rtype: int :return: An integer that is either 1(for DeviceGray), 3(DeviceRGB), or 4(DeviceCMYK). If the annotation has no color, i.e. is transparent, 0 will be returned. """ return _PDFNetPython.Annot_GetColorCompNum(self)
[docs] def SetColor(self, col, numcomp=3): r""" Sets an annotation's color. (Optional; PDF 1.1) :type col: :py:class:`ColorPt` :param col: A ColorPt object in RGB or Gray or CMYK color space representing the annotation's color. The ColorPt contains an array of numbers in the range 0.0 to 1.0, representing a color used for the following purposes: The background of the annotation's icon when closed The title bar of the annotation's pop-up window The border of a link annotation The number of array elements determines the color space in which the color shall be defined: 0 No color; transparent 1 DeviceGray 3 DeviceRGB 4 DeviceCMYK :type numcomp: int :param numcomp: - The number of color components used to represent the color (i.e. 1, 3, 4). """ return _PDFNetPython.Annot_SetColor(self, col, numcomp)
[docs] def GetStructParent(self): r""" Returns the struct parent of an annotation. (Required if the annotation is a structural content item; PDF 1.3) :rtype: int :return: An integer which is the integer key of the annotation's entry in the structural parent tree. Notes: The StructParent is the integer key of the annotation's entry in the structural parent tree. """ return _PDFNetPython.Annot_GetStructParent(self)
[docs] def SetStructParent(self, parkeyval): r""" Sets the struct parent of an annotation. (Required if the annotation is a structural content item; PDF 1.3) :type parkeyval: int :param parkeyval: An integer which is the integer key of the annotation's entry in the structural parent tree. Notes: The StructParent is the integer key of the annotation's entry in the structural parent tree. """ return _PDFNetPython.Annot_SetStructParent(self, parkeyval)
[docs] def GetOptionalContent(self): r""" Returns optional content associated with this annotation. :rtype: :py:class:`Obj` :return: A SDF object corresponding to the group of optional properties. Notes: The return value is an Optional Content Group (OCG) or Optional Content Membership Dictionary (PDF::OCG::OCMD) specifying the optional content properties for the annotation. Before the annotation is drawn, its visibility shall be determined based on this entry as well as the annotation flags specified in the Flag entry. If it is determined to be invisible, the annotation shall be skipped, as if it were not in the document. """ return _PDFNetPython.Annot_GetOptionalContent(self)
[docs] def SetOptionalContent(self, content): r""" Associates optional content with this annotation. (Optional, PDF1.5). :type content: :py:class:`Obj` :param content: A pointer to an SDF object corresponding to the optional content, a PDF::OCG::Group or membership dictionary specifying the PDF::OCG::Group properties for the annotation. Before the annotation is drawn, its visibility shall be determined based on this entry as well as the annotation flags specified in the Flag entry . If it is determined to be invisible, the annotation shall be skipped, as if it were not in the document. """ return _PDFNetPython.Annot_SetOptionalContent(self, content)
[docs] def SetContents(self, contents): r""" Sets the content of this annotation. (Optional). :type contents: string :param contents: A reference to unicode string object with the text that will be associated with this annotation. This is the text that annotation displays on user interaction, if the annotation type supports it. """ return _PDFNetPython.Annot_SetContents(self, contents)
[docs] def GetContents(self): r""" Extract the content of this annotation. (Optional). :rtype: string :return: A unicode string object with the text that is associated with this annotation. This is the text that annotation displays on user interaction, if the annotation type supports it. """ return _PDFNetPython.Annot_GetContents(self)
[docs] def GetRotation(self): r""" Returns the rotation value of the annotation. The Rotation specifies the number of degrees by which the annotation shall be rotated counterclockwise relative to the page. The value shall be a multiple of 90. :rtype: int :return: An integer representing the rotation value of the annotation. Notes: This property is part of the appearance characteristics dictionary, this dictionary that shall be used inructing a dynamic appearance stream specifying the annotation's visual presentation on the page. """ return _PDFNetPython.Annot_GetRotation(self)
[docs] def SetRotation(self, angle): r""" Sets the rotation value of the annotation. The Rotation specifies the number of degrees by which the annotation shall be rotated counterclockwise relative to the page. The value shall be a multiple of 90. (Optional) :type angle: int :param angle: An integer representing the rotation value of the annotation. Notes: This property is part of the appearance characteristics dictionary, this dictionary that shall be used inructing a dynamic appearance stream specifying the annotation's visual presentation on the page. """ return _PDFNetPython.Annot_SetRotation(self, angle)
[docs] def RefreshAppearance(self, args): r""" Overload 1: Regenerates the appearance stream for the annotation. This method can be used to auto-generate the annotation appearance after creating or modifying the annotation without providing an explicit appearance or setting the "NeedAppearances" flag in the AcroForm dictionary. Notes: If this annotation contains text, and has been added to a rotated page, the text in the annotation may be rotated. If RefreshAppearance is called after the annotation is added to a rotated page, then any text will be rotated in the opposite direction of the page rotation. If this method is called before the annotation is added to any rotated page, then no counter rotation will be applied. If you wish to call RefreshAppearance on an annotation already added to a rotated page, but you don't want the text to be rotated, you can do one of the following; temporarily un-rotate the page, or, temporarily remove the "Rotate" object from the annotation. To support users adding text annotations while using a PDF viewer, you can also add any viewer rotation to the annotations Rotate object, to have text always rotated correctly, from the users perspective. | Overload 2: A version of RefreshAppearance allowing custom options to make slight tweaks in behaviour. :type options: :py:class:`RefreshOptions` :param options: The RefreshOptions. """ return _PDFNetPython.Annot_RefreshAppearance(self, args)
[docs] def GetCustomData(self, key): r""" Returns custom data associated with the given key. :type key: string :param key: The key for which to retrieve the associated data. :rtype: string :return: the custom data string. If no data is available an empty string is returned. """ return _PDFNetPython.Annot_GetCustomData(self, key)
[docs] def SetCustomData(self, key, value): r""" Sets the custom data associated with the specified key. :type key: string :param key: The key under which to store this custom data :type value: string :param value: The custom data string to store """ return _PDFNetPython.Annot_SetCustomData(self, key, value)
[docs] def DeleteCustomData(self, key): r""" Deletes custom data associated with the given key. :type key: string :param key: The key for which to delete the associated data. """ return _PDFNetPython.Annot_DeleteCustomData(self, key)
[docs] def Resize(self, newrect): r""" Scales the geometry of the annotation so that its appearance would now fit a new rectangle on the page, in user units. Users still have to call RefreshAppearance() later if they want a corresponding appearance stream to be generated for the new rectangle. The main reason for not combining the two operations together is to be able to resize annotations that do not have an appearance stream. :type newrect: :py:class:`Rect` :param newrect: A reference to the new rectangle to which this annotation has to be resized. """ return _PDFNetPython.Annot_Resize(self, newrect)
[docs] @staticmethod def CreateInternal(impl): return _PDFNetPython.Annot_CreateInternal(impl)
[docs] def GetHandleInternal(self): return _PDFNetPython.Annot_GetHandleInternal(self)
def __init__(self, args): _PDFNetPython.Annot_swiginit(self, _PDFNetPython.new_Annot(args)) mp_annot = property(_PDFNetPython.Annot_mp_annot_get, _PDFNetPython.Annot_mp_annot_set) __swig_destroy__ = _PDFNetPython.delete_Annot
# Register Annot in _PDFNetPython: _PDFNetPython.Annot_swigregister(Annot)
[docs] def Annot_Create(doc, type, pos): r""" Creates a new annotation of a given type, in the specified document. The newly created annotation does not contain any properties specific to a given annotation type, which means an invalid annotation object could be created. It is therefore recommended to always create an annotation using type specific methods, such as Annots::Line::Create() or Annots::FileAttachment::Create(). Users should only call Annot::Create() to create annotations of non-standard types that are not recognized by PDFTron software (by using Annot::e_Unknown as a type). :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type type: int :param type: Subtype of annotation to create. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :rtype: :py:class:`Annot` :return: A newly created blank annotation for the given annotation type. """ return _PDFNetPython.Annot_Create(doc, type, pos)
[docs] def Annot_CreateInternal(impl): return _PDFNetPython.Annot_CreateInternal(impl)
[docs] class BorderStyle(object): r""" BorderStyle structure specifies the characteristics of the annotation's border. The border is specified as a rounded rectangle. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_solid = _PDFNetPython.BorderStyle_e_solid r""" A solid rectangle surrounding the annotation.""" e_dashed = _PDFNetPython.BorderStyle_e_dashed r""" A dashed rectangle surrounding the annotation.""" e_beveled = _PDFNetPython.BorderStyle_e_beveled r""" A simulated embossed rectangle that appears to be raised above the surface of the page.""" e_inset = _PDFNetPython.BorderStyle_e_inset r""" A simulated engraved rectangle that appears to be recessed below the surface of the page.""" e_underline = _PDFNetPython.BorderStyle_e_underline r""" A single line along the bottom of the annotation rectangle.""" __swig_destroy__ = _PDFNetPython.delete_BorderStyle
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.BorderStyle_Destroy(self)
[docs] def GetStyle(self): r""" :rtype: int :return: the border style. """ return _PDFNetPython.BorderStyle_GetStyle(self)
[docs] def SetStyle(self, style): r"""Sets the border style.""" return _PDFNetPython.BorderStyle_SetStyle(self, style)
[docs] def GetHR(self): r""" :rtype: double :return: horizontal corner radius. """ return _PDFNetPython.BorderStyle_GetHR(self)
[docs] def SetHR(self, horizontal_radius): r""" Sets horizontal corner radius. :type horizontal_radius: double :param horizontal_radius: A number representing the value of the horizontal radius to set the annotation to. """ return _PDFNetPython.BorderStyle_SetHR(self, horizontal_radius)
[docs] def GetVR(self): r""" :rtype: double :return: vertical corner radius. """ return _PDFNetPython.BorderStyle_GetVR(self)
[docs] def SetVR(self, vertical_radius): r""" Sets vertical corner radius. :type vertical_radius: double :param vertical_radius: A number representing the value of the vertical radius to set the annotation to. """ return _PDFNetPython.BorderStyle_SetVR(self, vertical_radius)
[docs] def GetWidth(self): r""" :rtype: double :return: the border width. """ return _PDFNetPython.BorderStyle_GetWidth(self)
[docs] def SetWidth(self, width): r""" Sets the border width :type width: double :param width: A number representing the width value to set the annotation to. """ return _PDFNetPython.BorderStyle_SetWidth(self, width)
[docs] def GetDash(self): r""" :rtype: std::vector< double,std::allocator< double > > :return: the border dash pattern. See also: BorderStyle() """ return _PDFNetPython.BorderStyle_GetDash(self)
[docs] def SetDash(self, dash): r""" Sets the border dash pattern. See also: BorderStyle() """ return _PDFNetPython.BorderStyle_SetDash(self, dash)
def __init__(self, args): _PDFNetPython.BorderStyle_swiginit(self, _PDFNetPython.new_BorderStyle(args))
# Register BorderStyle in _PDFNetPython: _PDFNetPython.BorderStyle_swigregister(BorderStyle) # Register Popup in _PDFNetPython: _PDFNetPython.Popup_swigregister(Popup)
[docs] class Markup(Annot): r""" Markup is a base class for a number of annotations types that are used to mark up PDF documents. These annotations have text that appears as part of the annotation and may be displayed in other ways by a conforming reader, such as in a Comments pane. Markup annotations may be divided into the following groups: - Free text annotations display text directly on the page. The annotation's Contents entry specifies the displayed text. - Most other markup annotations have an associated pop-up window that may contain text. The annotation's Contents entry specifies the text that shall be displayed when the pop-up window is opened. These include text, line, square, circle, polygon, polyline, highlight,underline, squiggly-underline, strikeout, rubber stamp, caret, ink, and file attachment annotations. - Sound annotations do not have a pop-up window but may also have associated text specified by the Contents entry. - A subset of markup annotations are intended to markup text of a document (e.g. highlight, strikeout, jagged, underline) and they are derived from TextMarkup base class. Notes: The pop-up annotation type must not appear by itself; it must be associated with a markup annotation that uses it to display text. The meaning of an annotation's Contents entry varies by annotation type. Typically, it is the text that shall be displayed for the annotation or, if the annotation does not display text, an alternate description of the annotation's contents in human-readable form. When separating text into paragraphs, a CARRIAGE RETURN (0Dh) must be used. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def GetTitle(self): r""" Returns the title of the markup annotation. :rtype: string :return: A string representing the title of the markup annotation, or null is the title is not specified. Notes: The title is The text label that is displayed in the title bar of the annotation's pop-up window when open and active Markup annotation. This entry is also used to identify the user who added the annotation. It corresponds to the 'T' field of the annotation's dictionary. """ return _PDFNetPython.Markup_GetTitle(self)
[docs] def SetTitle(self, args): r""" Overload 1: Sets the title of the markup annotation. (Optional; PDF 1.1) :type title: string :param title: A string. Notes: The title is The text label that is displayed in the title bar of the annotation's pop-up window when open and active Markup annotation. This entry is also used to identify the user who added the annotation. It corresponds to the 'T' field of the annotation's dictionary. | Overload 2: Sets the title of the markup annotation. (Optional; PDF 1.1) :type title: string :param title: A string. Notes: The title is The text label that is displayed in the title bar of the annotation's pop-up window when open and active Markup annotation. This entry is also used to identify the user who added the annotation. It corresponds to the 'T' field of the annotation's dictionary. """ return _PDFNetPython.Markup_SetTitle(self, args)
[docs] def GetPopup(self): r""" Returns the Popup object associated with this markup annotation. :rtype: :py:class:`Popup` :return: A Popup object that is associated with this markup annotation. Notes: The Popup is An indirect reference to a pop-up annotation for entering or editing the text associated with this annotation. """ return _PDFNetPython.Markup_GetPopup(self)
[docs] def SetPopup(self, ppup): r""" Sets the Popup object associated with this markup annotation. (Optional; PDF 1.3 ) :type ppup: :py:class:`Popup` :param ppup: A Popup object that is associated with this markup annotation. Notes: the Popup is An indirect reference to a pop-up annotation for entering or editing the text associated with this annotation. """ return _PDFNetPython.Markup_SetPopup(self, ppup)
[docs] def GetOpacity(self): r""" :rtype: double :return: The opacity value. Default value: 1.0. Notes: This value is applied to all visible elements of the annotation in its closed state (including its background and border) but not to the pop-up window that appears when the annotation is opened. When an appearance stream is presented with the annotation, this entry is ignored.(However, if the compliant viewer regenerates the annotation's appearance stream, it may incorporate this Opacity entry into the stream's content.) This corresponds to the 'CA' field of the annotation's dictionary. """ return _PDFNetPython.Markup_GetOpacity(self)
[docs] def SetOpacity(self, op): r""" Sets the opacity value for the annotation. (Optional; PDF 1.4 ) :type op: double :param op: A number indicating the Markup annotation's opacity value. Default value: 1.0. Notes: This value is applied to all visible elements of the annotation in its closed state (including its background and border) but not to the pop-up window that appears when the annotation is opened. When an appearance stream is presented with the annotation, this entry is ignored.(However, if the compliant viewer regenerates the annotation's appearance stream, it may incorporate this Opacity entry into the stream's content.) This corresponds to the 'CA' field of the annotation's dictionary. """ return _PDFNetPython.Markup_SetOpacity(self, op)
[docs] def GetSubject(self): r""" Returns the subject of the Markup annotation. (PDF 1.5) :rtype: string :return: A string representing the subject of the Markup annotation. Notes: The subject is a short piece of text description about the annotation. This corresponds to the 'Subj' field of the annotation's dictionary. """ return _PDFNetPython.Markup_GetSubject(self)
[docs] def SetSubject(self, contents): r""" Sets subject of the Markup annotation. (Optional; PDF 1.5 ) :type contents: string :param contents: A string representing the subject of the Markup annotation. Notes: The subject is a short piece of text description about the annotation. This corresponds to the 'Subj' field of the annotation's dictionary. """ return _PDFNetPython.Markup_SetSubject(self, contents)
[docs] def GetCreationDates(self): r""" :rtype: :py:class:`Date` :return: The creation date for the markup annotation. Notes: This corresponds to the 'CreationDate' field of the markup annotation's dictionary. """ return _PDFNetPython.Markup_GetCreationDates(self)
[docs] def SetCreationDates(self, dt): r""" Sets the creation date for the markup annotation. (Optional; PDF 1.5 ) :type dt: :py:class:`Date` :param dt: A Date object indicating the date the markup annotation is created. Notes: This corresponds to the 'CreationDate' field of the markup annotation's dictionary. """ return _PDFNetPython.Markup_SetCreationDates(self, dt)
e_None = _PDFNetPython.Markup_e_None r""" No effect.""" e_Cloudy = _PDFNetPython.Markup_e_Cloudy r""" Use "cloudy" border."""
[docs] def GetBorderEffect(self): r""" :rtype: int :return: the border effect of the markup annotation. Default value: e_None. Beginning with PDF 1.5, some annotations (square, circle, and polygon) may have a 'BE' entry, which is a border effect dictionary that specifies an effect that shall be applied to the border of the annotations. Beginning with PDF 1.6, the free text annotation may also have a BE entry. Notes: When "e_Cloudy" is chosen,the width and dash array specified by the annotation's BorderStyle entry needs to be taken into consideration. """ return _PDFNetPython.Markup_GetBorderEffect(self)
[docs] def SetBorderEffect(self, args): r""" Sets the border effect of the markup annotation. (Optional; PDF 1.5 ) Beginning with PDF 1.5, some annotations (square, circle, and polygon) may have a 'BE' entry, which is a border effect dictionary that specifies an effect that shall be applied to the border of the annotations. Beginning with PDF 1.6, the free text annotation may also have a BE entry. :type effect: int :param effect: An entry from the enum "BorderEffect" that represents the border effect of the Markup annotation. Default value: e_None. Notes: When "e_Cloudy" is chosen,the width and dash array specified by the annotation's BorderStyle entry needs to be taken into consideration. """ return _PDFNetPython.Markup_SetBorderEffect(self, args)
[docs] def GetBorderEffectIntensity(self): r""" :rtype: double :return: A number describing the intensity of the border effect, in the range 0 to 2. Beginning with PDF 1.5, some annotations (square, circle, and polygon) may have a 'BE' entry, which is a border effect dictionary that specifies an effect that shall be applied to the border of the annotations. Beginning with PDF 1.6, the free text annotation may also have a BE entry. """ return _PDFNetPython.Markup_GetBorderEffectIntensity(self)
[docs] def SetBorderEffectIntensity(self, intensity=0): r""" Sets the border effect intensity of the markup annotation. (Optional; valid only if Border effect is Cloudy) Beginning with PDF 1.5, some annotations (square, circle, and polygon) may have a 'BE' entry, which is a border effect dictionary that specifies an effect that shall be applied to the border of the annotations. Beginning with PDF 1.6, the free text annotation may also have a BE entry. :type intensity: double :param intensity: A number describing the intensity of the border effect, in the range 0 (which is default) to 2. Notes: this parameter applies only if Border effect is e_Cloudy. """ return _PDFNetPython.Markup_SetBorderEffectIntensity(self, intensity)
[docs] def GetInteriorColor(self): r""" Returns the interior color of the annotation. :rtype: :py:class:`ColorPt` :return: A ColorPt object that denotes the color of the annotation. Notes: The color can be in different color spaces: Gray, RGB, or CMYK. Call "GetInteriorColorCompNum" to access the color space information. According to PDF Reference Manual interior color is not the property that is expected for Markup annotations in general, but it applies to many derived annotations (Line,Square,Circle,Polygon,PolyLine,Redaction) and therefore get()/set() methods are provided in the base class Markup. Annotations that do not use interior color will ignore the interior color ('IC' entry), if present in their annotation dictionary. In case no color is specified, CMYK white is returned. """ return _PDFNetPython.Markup_GetInteriorColor(self)
[docs] def GetInteriorColorCompNum(self): r""" Returns the number indicating the interior color space of the annotation. :rtype: int :return: An integer indicating the number of channels forming the color space. 3 corresponds to RGB, 4 corresponds to CMYK, and 1 corresponds to Gray. If the interior is transparent, the return value is 0. """ return _PDFNetPython.Markup_GetInteriorColorCompNum(self)
[docs] def SetInteriorColor(self, c, CompNum): r""" Sets the interior color of the Markup annotation. :type c: :py:class:`ColorPt` :param c: A ColorPt object that denotes the color of the Markup annotation. :type CompNum: int :param CompNum: An integer indicating the number of channels forming the color space used. It also defines the length of the array to be allocated for storing the entries of c. Notes: It is necessary to make sure the consistency between the type of parameter c and the value of parameter CompNum. RGB ColorPt corresponds to 3, CMYK ColorPt corresponds to 4, Gray ColorPt corresponds to 1, and transparent corresponds to 0. According to PDF Reference Manual interior color is not the property that is expected for Markup annotations in general, but it applies to many derived annotation classes and therefore get()/set() methods are provided in the base class Markup. Annotations that do not use interior color will ignore the interior color ('IC' entry), if present in their annotation dictionary. Entries out of the specified color space array length will be discarded. Missing entries for a specified color space will lead to potential exceptions. """ return _PDFNetPython.Markup_SetInteriorColor(self, c, CompNum)
[docs] def GetContentRect(self): r""" Returns the inner bounding rectangle of the Markup annotation. :rtype: :py:class:`Rect` :return: A rectangle specifying the region where content should be displayed. Notes: This rectangle can be same as or inside of the annotation's rectangle. If it is smaller, such a difference may occur in situations where a border effect causes the size of the annotation Rect entry to increase beyond that of the rectangle. For FreeText annotation with a callout, content rectangle specifies an inner region for the text to be displayed. According to PDF Reference Manual content rectangle is not the property that is expected for Markup annotations in general, but it applies to many derived annotation classes (FreeText,Square,Circle,Caret) and therefore get()/set() methods are provided in the base class Markup. Annotations that do not use this property will ignore the content rectangle ('RD' entry), if present in their annotation dictionary. """ return _PDFNetPython.Markup_GetContentRect(self)
[docs] def SetContentRect(self, cr): r""" Sets the inner bounding rectangle of the Markup annotation. (Optional) :type cr: :py:class:`Rect` :param cr: A Rect struct to be assign to the 'RD' entry of the annotation dictionary. Notes: This rectangle can be same as or inside of the annotation's rectangle. If it is smaller, such a difference may occur in situations where a border effect causes the size of the annotation Rect entry to increase beyond that of the rectangle. For FreeText annotation with a callout, content rectangle specifies an inner region for the text to be displayed. According to PDF Reference Manual content rectangle is not the property that is expected for Markup annotations in general, but it applies to many derived annotation classes (FreeText,Square,Circle,Caret) and therefore get()/set() methods are provided in the base class Markup. Annotations that do not use this property will ignore the content rectangle ('RD' entry), if present in their annotation dictionary. """ return _PDFNetPython.Markup_SetContentRect(self, cr)
[docs] def GetPadding(self): r""" Returns the rectangle difference between overall annotation rectangle and content rectangle. :rtype: :py:class:`Rect` :return: A set of four numbers represented as a Rect struct. Notes: The four numbers of the returning struct specify the difference between two rectangles: the Rect entry of the annotation and the actual bounding box of the underlying rectangle. Such a difference may occur in situations where a border effect causes the size of the annotation Rect entry to increase beyond that of the rectangle. The four numbers of the returning struct correspond to the differences in default user space, between the left, top, right, and bottom of the two above mentioned rectangles. GetPadding() and GetContentRectangle() both use 'RD' entry of the annotation dictionary, but represent it to user in different ways. See also: GetContentRect() """ return _PDFNetPython.Markup_GetPadding(self)
[docs] def SetPadding(self, args): return _PDFNetPython.Markup_SetPadding(self, args)
[docs] def RotateAppearance(self, angle): r""" Rotates the appearance of the Markup annotation. :type angle: double :param angle: The new rotation Notes: Apply a rotation to an existing appearance. This rotation will be reflected in the bounding rect of the annot (which will be updated), but not in any other part of the annotation dictionary. This will effectively create a custom appearance for the annotation, and any subsequent calls to `RefreshAppearance` will clear this transformation. """ return _PDFNetPython.Markup_RotateAppearance(self, angle)
def __init__(self, args): _PDFNetPython.Markup_swiginit(self, _PDFNetPython.new_Markup(args)) __swig_destroy__ = _PDFNetPython.delete_Markup
# Register Markup in _PDFNetPython: _PDFNetPython.Markup_swigregister(Markup)
[docs] class FileAttachment(Markup): r""" A file attachment annotation contains a reference to a file, which may be embedded in the PDF document. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_Graph = _PDFNetPython.FileAttachment_e_Graph r""" The icon has graph appearance""" e_PushPin = _PDFNetPython.FileAttachment_e_PushPin r"""The icon has a push pin appearance.""" e_Paperclip = _PDFNetPython.FileAttachment_e_Paperclip r"""The icon has a paper clip appearance""" e_Tag = _PDFNetPython.FileAttachment_e_Tag r""" The icon has tag appearance""" e_Unknown = _PDFNetPython.FileAttachment_e_Unknown r""" The icon has unrecognized appearance type"""
[docs] @staticmethod def CreateAnnot(args): return _PDFNetPython.FileAttachment_CreateAnnot(args)
[docs] @staticmethod def Create(args): r""" Overload 1: Creates a file attachment annotation. A file attachment annotation contains a reference to a file, which typically is embedded in the PDF file. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, in user space coordinates. Note that FileAttachment icons can differ in their appearance dimensions, so you may want to match these Rectangle dimensions or the aspect ratio to avoid a squished or stretched appearance: e_Graph: 40 x 40 e_PushPin: 28 x 40 e_Paperclip: 14 x 34 e_Tag: 40 x 32 :type fs: :py:class:`FileSpec` :param fs: a file specification object used to initialize the file attachment annotation. :type icon_name: int :param icon_name: The name of an icon to be used in displaying the annotation, default is PushPin. Notes: PDF Viewer applications should provide predefined icon appearances for at least the following standard names: Graph, PushPin, Paperclip, Tag. Additional names may be supported as well. Default value: PushPin. :rtype: :py:class:`FileAttachment` :return: A new file attachment annotation. | Overload 2: Creates a file attachment annotation. A file attachment annotation contains a reference to a file, which typically is embedded in the PDF file. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, in user space coordinates. Note that FileAttachment icons can differ in their appearance dimensions, so you may want to match these Rectangle dimensions or the aspect ratio to avoid a squished or stretched appearance: e_Graph: 40 x 40 e_PushPin: 28 x 40 e_Paperclip: 14 x 34 e_Tag: 40 x 32 :type path: string :param path: The path to the file which should be attached :type icon_name: int :param icon_name: An icon to be used in displaying the annotation, default is PushPin. Notes: PDF Viewer applications should provide predefined icon appearances for at least the following standard names: Graph PushPin Paperclip Tag. Additional names may be supported as well. Default value: PushPin. :rtype: :py:class:`FileAttachment` :return: A new file attachment annotation. | Overload 3: Creates a file attachment annotation. A file attachment annotation contains a reference to a file, which typically is embedded in the PDF file. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, in user space coordinates. Note that FileAttachment icons can differ in their appearance dimensions, so you may want to match these Rectangle dimensions or the aspect ratio to avoid a squished or stretched appearance: e_Graph: 40 x 40 e_PushPin: 28 x 40 e_Paperclip: 14 x 34 e_Tag: 40 x 32 :type path: string :param path: The path to the file which should be attached :param icon_name: An icon to be used in displaying the annotation, default is PushPin. Notes: PDF Viewer applications should provide predefined icon appearances for at least the following standard names: Graph PushPin Paperclip Tag. Additional names may be supported as well. Default value: PushPin. :rtype: :py:class:`FileAttachment` :return: A new file attachment annotation. | Overload 4: Creates a file attachment annotation. This method should be used when a nonstandard icon type is desired in the annotation. A file attachment annotation contains a reference to a file, which typically is embedded in the PDF file. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, in user space coordinates. :type path: string :param path: The path to the file which should be attached :type icon_name: string :param icon_name: The name of an icon to be used in displaying the annotation. Notes: PDF Viewer applications should provide predefined icon appearances for at least the following standard names: Graph PushPin Paperclip Tag. Additional names may be supported as well. Default value: PushPin. :rtype: :py:class:`FileAttachment` :return: A new file attachment annotation. """ return _PDFNetPython.FileAttachment_Create(args)
[docs] def GetFileSpec(self): r""" :rtype: :py:class:`FileSpec` :return: the file specification that contains a file reference or the embedded file data stream. """ return _PDFNetPython.FileAttachment_GetFileSpec(self)
[docs] def SetFileSpec(self, file): r""" Sets the file specification. :type file: :py:class:`FileSpec` :param file: The file specification to associate with this annotation.. The file specification contains a file reference or the embedded file data stream. """ return _PDFNetPython.FileAttachment_SetFileSpec(self, file)
[docs] def Export(self, args): r""" The function saves the data referenced by this File Attachment to an external file. If the file is embedded, the function saves the embedded file. If the file is not embedded, the function will copy the external file. If the file is not embedded and the external file can't be found, the function returns false. :type save_as: string :param save_as: An optional parameter indicating the filepath and filename where the data should be saved. If this parameter is not specified the function will attempt to save the file using FileSpec.GetFilePath(). :rtype: boolean :return: true is the file was saved successfully, false otherwise. """ return _PDFNetPython.FileAttachment_Export(self, args)
[docs] def GetIcon(self): r""" :rtype: int :return: the type the associated icon style. e_PushPin Notes: The annotation dictionary's appearance stream, if present, will take precedence over this entry when displaying the annotation in the viewer. """ return _PDFNetPython.FileAttachment_GetIcon(self)
[docs] def SetIcon(self, args): r""" Sets the icon style associated with FileAttachment annotation. (Optional) :type type: int :param type: icon style. e_PushPin Notes: The annotation dictionary's appearance stream, if present, will take precedence over this entry when displaying the annotation in the viewer. """ return _PDFNetPython.FileAttachment_SetIcon(self, args)
[docs] def GetIconName(self): r""" Returns the name of the icon associated with the FileAttachment annotation. :rtype: string :return: A string denoting the name of the icon. See also: GetIcon() GetIconName() returns the icon name as it appears in the annotation dictionary, while GetIcon() returns the same icon name converted to enumeration value. Notes: The annotation dictionary's appearance stream, if present, will take precedence over this entry when displaying the annotation in the viewer. """ return _PDFNetPython.FileAttachment_GetIconName(self)
[docs] def SetIconName(self, iname): r""" Sets the name of the icon associated with the FileAttachment annotation. (Optional) :type iname: string :param iname: A string.denoting the name of the icon. Notes: this method should be used to assign non-standard icon type to the annotation. See also: SetIcon() The annotation dictionary's appearance stream, if present, will take precedence over this entry when displaying the annotation in the viewer. """ return _PDFNetPython.FileAttachment_SetIconName(self, iname)
def __init__(self, args): _PDFNetPython.FileAttachment_swiginit(self, _PDFNetPython.new_FileAttachment(args)) __swig_destroy__ = _PDFNetPython.delete_FileAttachment
# Register FileAttachment in _PDFNetPython: _PDFNetPython.FileAttachment_swigregister(FileAttachment)
[docs] def FileAttachment_CreateAnnot(args): return _PDFNetPython.FileAttachment_CreateAnnot(args)
[docs] def FileAttachment_Create(args): r""" Overload 1: Creates a file attachment annotation. A file attachment annotation contains a reference to a file, which typically is embedded in the PDF file. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, in user space coordinates. Note that FileAttachment icons can differ in their appearance dimensions, so you may want to match these Rectangle dimensions or the aspect ratio to avoid a squished or stretched appearance: e_Graph: 40 x 40 e_PushPin: 28 x 40 e_Paperclip: 14 x 34 e_Tag: 40 x 32 :type fs: :py:class:`FileSpec` :param fs: a file specification object used to initialize the file attachment annotation. :type icon_name: int :param icon_name: The name of an icon to be used in displaying the annotation, default is PushPin. Notes: PDF Viewer applications should provide predefined icon appearances for at least the following standard names: Graph, PushPin, Paperclip, Tag. Additional names may be supported as well. Default value: PushPin. :rtype: :py:class:`FileAttachment` :return: A new file attachment annotation. | Overload 2: Creates a file attachment annotation. A file attachment annotation contains a reference to a file, which typically is embedded in the PDF file. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, in user space coordinates. Note that FileAttachment icons can differ in their appearance dimensions, so you may want to match these Rectangle dimensions or the aspect ratio to avoid a squished or stretched appearance: e_Graph: 40 x 40 e_PushPin: 28 x 40 e_Paperclip: 14 x 34 e_Tag: 40 x 32 :type path: string :param path: The path to the file which should be attached :type icon_name: int :param icon_name: An icon to be used in displaying the annotation, default is PushPin. Notes: PDF Viewer applications should provide predefined icon appearances for at least the following standard names: Graph PushPin Paperclip Tag. Additional names may be supported as well. Default value: PushPin. :rtype: :py:class:`FileAttachment` :return: A new file attachment annotation. | Overload 3: Creates a file attachment annotation. A file attachment annotation contains a reference to a file, which typically is embedded in the PDF file. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, in user space coordinates. Note that FileAttachment icons can differ in their appearance dimensions, so you may want to match these Rectangle dimensions or the aspect ratio to avoid a squished or stretched appearance: e_Graph: 40 x 40 e_PushPin: 28 x 40 e_Paperclip: 14 x 34 e_Tag: 40 x 32 :type path: string :param path: The path to the file which should be attached :param icon_name: An icon to be used in displaying the annotation, default is PushPin. Notes: PDF Viewer applications should provide predefined icon appearances for at least the following standard names: Graph PushPin Paperclip Tag. Additional names may be supported as well. Default value: PushPin. :rtype: :py:class:`FileAttachment` :return: A new file attachment annotation. | Overload 4: Creates a file attachment annotation. This method should be used when a nonstandard icon type is desired in the annotation. A file attachment annotation contains a reference to a file, which typically is embedded in the PDF file. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, in user space coordinates. :type path: string :param path: The path to the file which should be attached :type icon_name: string :param icon_name: The name of an icon to be used in displaying the annotation. Notes: PDF Viewer applications should provide predefined icon appearances for at least the following standard names: Graph PushPin Paperclip Tag. Additional names may be supported as well. Default value: PushPin. :rtype: :py:class:`FileAttachment` :return: A new file attachment annotation. """ return _PDFNetPython.FileAttachment_Create(args)
[docs] class QuadPoint(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): _PDFNetPython.QuadPoint_swiginit(self, _PDFNetPython.new_QuadPoint(args)) p1 = property(_PDFNetPython.QuadPoint_p1_get, _PDFNetPython.QuadPoint_p1_set) p2 = property(_PDFNetPython.QuadPoint_p2_get, _PDFNetPython.QuadPoint_p2_set) p3 = property(_PDFNetPython.QuadPoint_p3_get, _PDFNetPython.QuadPoint_p3_set) p4 = property(_PDFNetPython.QuadPoint_p4_get, _PDFNetPython.QuadPoint_p4_set) __swig_destroy__ = _PDFNetPython.delete_QuadPoint
# Register QuadPoint in _PDFNetPython: _PDFNetPython.QuadPoint_swigregister(QuadPoint)
[docs] class TextMarkup(Markup): r""" A TextMarkup is a base class for highlight, underline, strikeout, and squiggly annotations. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def GetQuadPointCount(self): r""" Returns the number of QuadPoints in the QuadPoints array of the TextMarkup annotation (PDF 1.6) :rtype: int :return: The number of QuadPoints. Notes: QuadPoints specify the coordinates of quadrilaterals in default user space. Each quadrilateral encompasses a word or group of contiguous words in the text underlying the annotation. The four points(p1, p2, p3, p4) of a QuadPoint specify the quadrilateral's four vertices in counterclockwise order. The text needs to be oriented with respect to the edge connecting points (p1) and (p2). The annotation dictionary's Appearance entry, if present, takes precedence over QuadPoints. """ return _PDFNetPython.TextMarkup_GetQuadPointCount(self)
[docs] def GetQuadPoint(self, idx): r""" Returns the QuadPoint located at a certain index of the QuadPoint array. (PDF 1.6) :type idx: int :param idx: The index where the QuadPoint is located. The index starts at zero and must be less than return value of GetQuadPointCount(). :rtype: :py:class:`QuadPoint` :return: The QuadPoint located at a certain index of the QuadPoint array of the TextMarkup annotation. Notes: QuadPoints specify the coordinates of quadrilaterals in default user space. Each quadrilateral encompasses a word or group of contiguous words in the text underlying the annotation. The four points(p1, p2, p3, p4) of a QuadPoint specify the quadrilateral's four vertices in counterclockwise order. The text needs to be oriented with respect to the edge connecting points (p1) and (p2). The annotation dictionary's Appearance entry, if present, takes precedence over QuadPoints. """ return _PDFNetPython.TextMarkup_GetQuadPoint(self, idx)
[docs] def SetQuadPoint(self, idx, qp): r""" Sets the QuadPoint to be located at a certain index of the QuadPoint array. (Optional; PDF 1.6 ) :type idx: int :param idx: The index where the QuadPoint is to be located (the index is counted from 0). :type qp: :py:class:`QuadPoint` :param qp: The QuadPoint to be located at a certain index of the QuadPoint array of the TextMarkup annotation. To make this QuadPoint compatible with Adobe Acrobat|Reader, you can use either clockwise or counterclockwise order, but the points p3 and p4 must be swapped. This is because those readers do not follow the PDF specification for TextMarkup QuadPoints. Notes: An array of n QuadPoints specifying the coordinates of n quadrilaterals in default user space. Each quadrilateral shall encompasses a word or group of contiguous words in the text underlying the annotation. The coordinates for each quadrilateral shall be given in the order p1, p2, p3, p4 specifying the quadrilateral's four vertices in counterclockwise order. The text shall be oriented with respect to the edge connecting points (p1) and (p2). The annotation dictionary's Appearance(AP) entry, if present, shall take precedence over QuadPoints. """ return _PDFNetPython.TextMarkup_SetQuadPoint(self, idx, qp)
def __init__(self, args): _PDFNetPython.TextMarkup_swiginit(self, _PDFNetPython.new_TextMarkup(args)) __swig_destroy__ = _PDFNetPython.delete_TextMarkup
# Register TextMarkup in _PDFNetPython: _PDFNetPython.TextMarkup_swigregister(TextMarkup)
[docs] class Ink(Markup): r""" An ink annotation (PDF 1.3) represents a freehand "scribble" composed of one or more disjoint paths. When opened, it shall display a pop-up window containing the text of the associated note. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new Ink annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Ink annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Ink annotation's bounds in default user space units. :rtype: :py:class:`Ink` :return: A newly created blank Ink annotation. """ return _PDFNetPython.Ink_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.Ink_CreateAnnot(doc, pos)
[docs] def GetPathCount(self): r""" Returns number of paths in the annotation. :rtype: int :return: An integer representing the number of paths in the 'InkList' entry of the annotation dictionary. Notes: Each path is an array of Point objects specifying points along the path. When drawn, the points shall be connected by straight lines or curves in an implementation-dependent way. """ return _PDFNetPython.Ink_GetPathCount(self)
[docs] def GetPointCount(self, pathindex): r""" Returns number of points in a certain stroked path in the InkList. :type pathindex: int :param pathindex: path index for each the point count is returned. Index starts at 0. :rtype: int :return: An integer representing the number of points in the stroked path of the Ink list. See also: GetPathCount() """ return _PDFNetPython.Ink_GetPointCount(self, pathindex)
[docs] def GetPoint(self, pathindex, pointindex): r""" Returns the specific point in a given path. :type pathindex: int :param pathindex: path index for each the point is returned. Index starts at 0. :type pointindex: int :param pointindex: index of point in the path. Index starts at 0. :rtype: :py:class:`Point` :return: A Point object for specified path and point index. Notes: Each path is an array of Point objects specifying points along the path. When drawn, the points shall be connected by straight lines or curves in an implementation-dependent way. """ return _PDFNetPython.Ink_GetPoint(self, pathindex, pointindex)
[docs] def SetPoint(self, pathindex, pointindex, pt): r""" Sets the specific point in the Ink List, adding it if needed. :type pathindex: int :param pathindex: An unsigned integer indicating the index of the path. :type pointindex: int :param pointindex: An unsigned integer indicating the index of the point within the stroked path indicated by the parameter "pathindex". :type pt: :py:class:`Point` :param pt: A Point object that is to be assigned. Notes: Ink annotation contains an array of paths. Each path is an array of Point objects specifying points along the path. When drawn, the points shall be connected by straight lines or curves in an implementation-dependent way. """ return _PDFNetPython.Ink_SetPoint(self, pathindex, pointindex, pt)
[docs] def Erase(self, pt1, pt2, width): r""" Erase a rectangle area formed by pt1pt2 with width :type pt1: :py:class:`Point` :param pt1: A point object that is one end of the eraser segment :type pt2: :py:class:`Point` :param pt2: A point object that is the other end of the eraser segment :type width: double :param width: The half width of the eraser :rtype: boolean :return: Whether an ink stroke was erased """ return _PDFNetPython.Ink_Erase(self, pt1, pt2, width)
[docs] def GetHighlightIntent(self): r""" Retrieves whether the Ink will draw like a highlighter. :rtype: boolean :return: true if the Ink will draw like a highlighter. (multiply blend mode) If false it will draw in normal mode. (normal blend mode) """ return _PDFNetPython.Ink_GetHighlightIntent(self)
[docs] def SetHighlightIntent(self, highlight): r""" Enables or disables the Ink drawing like a highlighter. :type highlight: boolean :param highlight: true if the Ink will draw like a highlighter. (multiply blend mode) If false it will draw in normal mode. (normal blend mode) """ return _PDFNetPython.Ink_SetHighlightIntent(self, highlight)
def __init__(self, args): _PDFNetPython.Ink_swiginit(self, _PDFNetPython.new_Ink(args)) __swig_destroy__ = _PDFNetPython.delete_Ink
# Register Ink in _PDFNetPython: _PDFNetPython.Ink_swigregister(Ink)
[docs] def Ink_Create(doc, pos): r""" Creates a new Ink annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Ink annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Ink annotation's bounds in default user space units. :rtype: :py:class:`Ink` :return: A newly created blank Ink annotation. """ return _PDFNetPython.Ink_Create(doc, pos)
[docs] def Ink_CreateAnnot(doc, pos): return _PDFNetPython.Ink_CreateAnnot(doc, pos)
[docs] class Destination(object): r""" A destination defines a particular view of a document, consisting of the following: - The page of the document to be displayed - The location of the document window on that page - The magnification (zoom) factor to use when displaying the page Destinations may be associated with Bookmarks, Annotations, and Remote Go-To Actions. Destination is a utility class used to simplify work with PDF Destinations; Please refer to section 8.2.1 'Destinations' in PDF Reference Manual for details. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_XYZ = _PDFNetPython.Destination_e_XYZ e_Fit = _PDFNetPython.Destination_e_Fit e_FitH = _PDFNetPython.Destination_e_FitH e_FitV = _PDFNetPython.Destination_e_FitV e_FitR = _PDFNetPython.Destination_e_FitR e_FitB = _PDFNetPython.Destination_e_FitB e_FitBH = _PDFNetPython.Destination_e_FitBH e_FitBV = _PDFNetPython.Destination_e_FitBV
[docs] @staticmethod def CreateXYZ(page, left, top, zoom): r""" Create a new 'XYZ' Destination. The new Destination displays the page designated by 'page', with the coordinates ('left', 'top') positioned at the top-left corner of the window and the contents of the page magnified by the factor 'zoom'. A null value for any of the parameters 'left', 'top', or 'zoom' specifies that the current value of that parameter is to be retained unchanged. A 'zoom' value of 0 has the same meaning as a null value. the page within the window in the other dimension. :type page: :py:class:`Page` :param page: Page object to display :type left: double :param left: horizontal coordinate of the left edge of the window :type top: double :param top: vertical coordinate of the top edge of the window :type zoom: double :param zoom: amount to zoom the page by """ return _PDFNetPython.Destination_CreateXYZ(page, left, top, zoom)
[docs] @staticmethod def CreateFit(page): r""" Create a new 'Fit' Destination. The new Destination displays the page designated by 'page', with its contents magnified just enough to fit the entire page within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the page within the window in the other dimension. :type page: :py:class:`Page` :param page: Page object to display """ return _PDFNetPython.Destination_CreateFit(page)
[docs] @staticmethod def CreateFitH(page, top): r""" Create a new 'FitH' Destination. The new Destination displays the page designated by 'page', with the vertical coordinate 'top' positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of the page within the window. :type page: :py:class:`Page` :param page: Page object to display :type top: double :param top: vertical coordinate of the top edge of the window """ return _PDFNetPython.Destination_CreateFitH(page, top)
[docs] @staticmethod def CreateFitV(page, left): r""" Create a new 'FitV' Destination. The new Destination displays the page designated by 'page', with the horizontal coordinate 'left' positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of the page within the window. :type page: :py:class:`Page` :param page: Page object to display :type left: double :param left: horizontal coordinate of the left edge of the window """ return _PDFNetPython.Destination_CreateFitV(page, left)
[docs] @staticmethod def CreateFitR(page, left, bottom, right, top): r""" Create a new 'FitR' Destination. The new Destination displays the page designated by 'page', with its contents magnified just enough to fit the rectangle specified by the coordinates 'left', 'bottom', 'right', and 'top' entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the rectangle within the window in the other dimension. :type page: :py:class:`Page` :param page: Page object to display :type left: double :param left: horizontal coordinate of the left edge of the window :type bottom: double :param bottom: vertical coordinate of the bottom edge of the window :type right: double :param right: horizontal coordinate of the right edge of the window :type top: double :param top: vertical coordinate of the top edge of the window """ return _PDFNetPython.Destination_CreateFitR(page, left, bottom, right, top)
[docs] @staticmethod def CreateFitB(page): r""" Create a new 'FitB' Destination. The new Destination displays the page designated by 'page', with its contents magnified just enough to fit its bounding box entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the bounding box within the window in the other dimension. :type page: :py:class:`Page` :param page: Page object to display """ return _PDFNetPython.Destination_CreateFitB(page)
[docs] @staticmethod def CreateFitBH(page, top): r""" Create a new 'FitBH' Destination. The new Destination displays the page designated by 'page', with the vertical coordinate 'top' positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of its bounding box within the window. :type page: :py:class:`Page` :param page: Page object to display :type top: double :param top: vertical coordinate of the top edge of the window """ return _PDFNetPython.Destination_CreateFitBH(page, top)
[docs] @staticmethod def CreateFitBV(page, left): r""" Create a new 'FitBV' Destination. The new Destination displays Display the page designated by 'page', with the horizontal coordinate 'left' positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of its bounding box within the window. :type page: :py:class:`Page` :param page: Page object to display :type left: double :param left: horizontal coordinate of the left edge of the window """ return _PDFNetPython.Destination_CreateFitBV(page, left)
[docs] def IsValid(self): r""" :rtype: boolean :return: True if this is a valid Destination and can be resolved, false otherwise. Notes: If this method returns false the underlying SDF/Cos object is null and the Action object should be treated as null as well. """ return _PDFNetPython.Destination_IsValid(self)
[docs] def GetFitType(self): r""" :rtype: int :return: destination's FitType. :raises: An Exception is thrown if this is not a valid Destination. """ return _PDFNetPython.Destination_GetFitType(self)
[docs] def GetPage(self): r""" :rtype: :py:class:`Page` :return: the Page that this destination refers to. :raises: An Exception is thrown if this is not a valid Destination. """ return _PDFNetPython.Destination_GetPage(self)
[docs] def SetPage(self, page): r""" Modify the destination so that it refers to the new 'page' as the destination page. :type page: :py:class:`Page` :param page: The new page associated with this Destination. :raises: An Exception is thrown if this is not a valid Destination. """ return _PDFNetPython.Destination_SetPage(self, page)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: the object to the underlying SDF/Cos object. The returned SDF/Cos object is an explicit destination (i.e. the Obj is either an array defining the destination, using the syntax shown in Table 8.2 in PDF Reference Manual), or a dictionary with a 'D' entry whose value is such an array. The latter form allows additional attributes to be associated with the destination """ return _PDFNetPython.Destination_GetSDFObj(self)
[docs] def GetExplicitDestObj(self): r""" :rtype: :py:class:`Obj` :return: the explicit destination SDF/Cos object. This is always an Array as shown in Table 8.2 in PDF Reference Manual. :raises: An Exception is thrown if this is not a valid Destination. """ return _PDFNetPython.Destination_GetExplicitDestObj(self)
def __init__(self, args): _PDFNetPython.Destination_swiginit(self, _PDFNetPython.new_Destination(args)) mp_dest = property(_PDFNetPython.Destination_mp_dest_get, _PDFNetPython.Destination_mp_dest_set) __swig_destroy__ = _PDFNetPython.delete_Destination
# Register Destination in _PDFNetPython: _PDFNetPython.Destination_swigregister(Destination)
[docs] def Destination_CreateXYZ(page, left, top, zoom): r""" Create a new 'XYZ' Destination. The new Destination displays the page designated by 'page', with the coordinates ('left', 'top') positioned at the top-left corner of the window and the contents of the page magnified by the factor 'zoom'. A null value for any of the parameters 'left', 'top', or 'zoom' specifies that the current value of that parameter is to be retained unchanged. A 'zoom' value of 0 has the same meaning as a null value. the page within the window in the other dimension. :type page: :py:class:`Page` :param page: Page object to display :type left: double :param left: horizontal coordinate of the left edge of the window :type top: double :param top: vertical coordinate of the top edge of the window :type zoom: double :param zoom: amount to zoom the page by """ return _PDFNetPython.Destination_CreateXYZ(page, left, top, zoom)
[docs] def Destination_CreateFit(page): r""" Create a new 'Fit' Destination. The new Destination displays the page designated by 'page', with its contents magnified just enough to fit the entire page within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the page within the window in the other dimension. :type page: :py:class:`Page` :param page: Page object to display """ return _PDFNetPython.Destination_CreateFit(page)
[docs] def Destination_CreateFitH(page, top): r""" Create a new 'FitH' Destination. The new Destination displays the page designated by 'page', with the vertical coordinate 'top' positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of the page within the window. :type page: :py:class:`Page` :param page: Page object to display :type top: double :param top: vertical coordinate of the top edge of the window """ return _PDFNetPython.Destination_CreateFitH(page, top)
[docs] def Destination_CreateFitV(page, left): r""" Create a new 'FitV' Destination. The new Destination displays the page designated by 'page', with the horizontal coordinate 'left' positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of the page within the window. :type page: :py:class:`Page` :param page: Page object to display :type left: double :param left: horizontal coordinate of the left edge of the window """ return _PDFNetPython.Destination_CreateFitV(page, left)
[docs] def Destination_CreateFitR(page, left, bottom, right, top): r""" Create a new 'FitR' Destination. The new Destination displays the page designated by 'page', with its contents magnified just enough to fit the rectangle specified by the coordinates 'left', 'bottom', 'right', and 'top' entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the rectangle within the window in the other dimension. :type page: :py:class:`Page` :param page: Page object to display :type left: double :param left: horizontal coordinate of the left edge of the window :type bottom: double :param bottom: vertical coordinate of the bottom edge of the window :type right: double :param right: horizontal coordinate of the right edge of the window :type top: double :param top: vertical coordinate of the top edge of the window """ return _PDFNetPython.Destination_CreateFitR(page, left, bottom, right, top)
[docs] def Destination_CreateFitB(page): r""" Create a new 'FitB' Destination. The new Destination displays the page designated by 'page', with its contents magnified just enough to fit its bounding box entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the bounding box within the window in the other dimension. :type page: :py:class:`Page` :param page: Page object to display """ return _PDFNetPython.Destination_CreateFitB(page)
[docs] def Destination_CreateFitBH(page, top): r""" Create a new 'FitBH' Destination. The new Destination displays the page designated by 'page', with the vertical coordinate 'top' positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of its bounding box within the window. :type page: :py:class:`Page` :param page: Page object to display :type top: double :param top: vertical coordinate of the top edge of the window """ return _PDFNetPython.Destination_CreateFitBH(page, top)
[docs] def Destination_CreateFitBV(page, left): r""" Create a new 'FitBV' Destination. The new Destination displays Display the page designated by 'page', with the horizontal coordinate 'left' positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of its bounding box within the window. :type page: :py:class:`Page` :param page: Page object to display :type left: double :param left: horizontal coordinate of the left edge of the window """ return _PDFNetPython.Destination_CreateFitBV(page, left)
[docs] class Action(object): r""" Actions are typically what happens when a user clicks on a link or bookmark. Instead of simply jumping to a destination in the document, an annotation or outline item can specify an action for the viewer application to perform, such as launching an application, playing a sound, or changing an annotation's appearance state. Notes: Although the Action class provides utility functions for most commonly used action types, it is possible to read, write, and edit any action type using SDF API and dictionary entries described in Section 8.5 in the PDF Reference Manual. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def CreateGoto(args): r""" Overload 1: Creates a new 'GoTo'action. GoTo action takes the user to the specified Destination view located in the same document. :type dest: :py:class:`Destination` :param dest: A Destination for the new Action. Notes: This method can only be used for destinations in the same document as the source document. For cross-document links use Action::CreateGotoRemote(). | Overload 2: Creates a new 'GoTo' action using a 'Named Destination'. GoTo action takes the user to the specified 'Named Destination' view located in the same document. :type key: UChar :param key: - a string buffer representing the destination name. The named destination will be stored in document's '/Dest' SDF::NameTree. :type key_sz: int :param key_sz: The size in bytes of the key buffer. :type dest: :py:class:`Destination` :param dest: The explicit destination used to create the named destination. """ return _PDFNetPython.Action_CreateGoto(args)
[docs] @staticmethod def CreateGotoRemote(args): r""" Overload 1: Creates a new 'GoToR'action. A remote go-to action is similar to an ordinary go-to action but jumps to a destination in another PDF file instead of the current file. :type file: :py:class:`FileSpec` :param file: The file referred to by the action. :type page_num: int :param page_num: A page number within the remote document. The first page is numbered 0. _window A flag specifying whether to open the destination document in a new window. If new_window is false, the destination document replaces the current document in the same window, otherwise the viewer application should behave in accordance with the current user preference. | Overload 2: Creates a new 'GoToR'action. See the above method for details. :type file: :py:class:`FileSpec` :param file: The file referred to by the action. :type page_num: int :param page_num: A page number within the remote document. The first page is numbered 0. :type new_window: boolean :param new_window: A flag specifying whether to open the destination document in a new window. If new_window is false, the destination document replaces the current document in the same window, otherwise the viewer application should behave in accordance with the current user preference. """ return _PDFNetPython.Action_CreateGotoRemote(args)
[docs] @staticmethod def CreateURI(args): r""" Overload 1: Create a new URI action. The URI action is typically resolved by opening a URL in the default web browser. :type doc: :py:class:`SDFDoc` :param doc: The document in which to create the action. :type uri: string :param uri: The uniform resource identifier to resolve, encoded in 7-bit ASCII. A uniform resource identifier (URI) is a string that identifies (resolves to) a resource on the Internet; typically a file that is the destination of a hypertext link, although it can also resolve to a query or other entity. (URIs are described in Internet RFC 2396, Uniform Resource Identifiers (URI). | Overload 2: Create a new URI action. The URI action is typically resolved by opening a URL in the default web browser. :type doc: :py:class:`SDFDoc` :param doc: The document in which to create the action. :type uri: string :param uri: The uniform resource identifier to resolve, encoded in UTF-8. A uniform resource identifier (URI) is a string that identifies (resolves to) a resource on the Internet; typically a file that is the destination of a hypertext link, although it can also resolve to a query or other entity. (URIs are described in Internet RFC 2396, Uniform Resource Identifiers (URI). """ return _PDFNetPython.Action_CreateURI(args)
[docs] @staticmethod def CreateSubmitForm(url): r""" Creates a new 'SubmitForm'action. A submit-form action transmits the names and values of selected interactive form fields to a specified uniform resource locator (URL), presumably the address of a Web server that will process them and send back a response. :type url: :py:class:`FileSpec` :param url: A URL file specification giving the uniform resource locator (URL) of the script at the Web server that will process the submission. """ return _PDFNetPython.Action_CreateSubmitForm(url)
[docs] @staticmethod def CreateLaunch(doc, path): r""" Creates a new 'Launch' action. A launch action opens up a file using the most appropriate program. :type doc: :py:class:`SDFDoc` :param doc: the document in which to create the action :type path: string :param path: the full path of the file to be opened """ return _PDFNetPython.Action_CreateLaunch(doc, path)
[docs] @staticmethod def CreateHideField(sdfdoc, field): r""" Creates a new 'Show/Hide Field' action. A show/hide field action shows or hide certain fields when it's invoked. :type sdfdoc: :py:class:`SDFDoc` :param sdfdoc: the document in which to create the action :param list_length: the number of fields to hide :type field: std::vector< std::string,std::allocator< std::string > > :param field: the list of fields to hide """ return _PDFNetPython.Action_CreateHideField(sdfdoc, field)
[docs] @staticmethod def CreateImportData(doc, path): r""" Creates a new 'Import Data' action. An import data action imports form data from a FDF file into a PDF document. :type doc: :py:class:`SDFDoc` :param doc: the document in which to create the action :type path: string :param path: the full path of the FDF file """ return _PDFNetPython.Action_CreateImportData(doc, path)
[docs] @staticmethod def CreateResetForm(doc): r""" Creates a new 'Reset Form' action. A reset form action reset chosen form fields to their default value. :type doc: :py:class:`SDFDoc` :param doc: the document in which to create the action """ return _PDFNetPython.Action_CreateResetForm(doc)
[docs] @staticmethod def CreateJavaScript(doc, script): r""" Creates a new 'JavaScript' action. A javascript action executes a JavaScript script when it's invoked. :type doc: :py:class:`SDFDoc` :param doc: the document in which to create the action :type script: string :param script: the JavaScript script to be executed """ return _PDFNetPython.Action_CreateJavaScript(doc, script)
def __eq__(self, in_action): r""" Compares two Action objects for equality. :type in_action: :py:class:`Action` :param in_action: A reference to an existing Action object. :rtype: boolean :return: True if the both Actions share the same underlying SDF/Cos object; otherwise false. """ return _PDFNetPython.Action___eq__(self, in_action)
[docs] def IsValid(self): r""" Indicates whether the Action is valid (non-null). :rtype: boolean :return: True if this is a valid (non-null) Action; otherwise false. Notes: If this method returns false the underlying SDF/Cos object is null and the Action object should be treated as null as well. """ return _PDFNetPython.Action_IsValid(self)
e_GoTo = _PDFNetPython.Action_e_GoTo r""" Go to a destination in the current document.""" e_GoToR = _PDFNetPython.Action_e_GoToR r""" ('Go-to remote') Go to a destination in another document.""" e_GoToE = _PDFNetPython.Action_e_GoToE r""" ('Go-to embedded'; PDF 1.6) Go to a destination in an embedded file.""" e_Launch = _PDFNetPython.Action_e_Launch r""" Launch an application, usually to open a file.""" e_Thread = _PDFNetPython.Action_e_Thread r""" Begin reading an article thread.""" e_URI = _PDFNetPython.Action_e_URI r""" Resolve a uniform resource identifier.""" e_Sound = _PDFNetPython.Action_e_Sound r""" Play a sound.""" e_Movie = _PDFNetPython.Action_e_Movie r""" Play a movie.""" e_Hide = _PDFNetPython.Action_e_Hide r""" Set an annotation's Hidden flag.""" e_Named = _PDFNetPython.Action_e_Named r""" Execute an action predefined by the viewer application.""" e_SubmitForm = _PDFNetPython.Action_e_SubmitForm r""" Send data to a uniform resource locator.""" e_ResetForm = _PDFNetPython.Action_e_ResetForm r""" Set fields to their default values.""" e_ImportData = _PDFNetPython.Action_e_ImportData r""" Import field values from a file.""" e_JavaScript = _PDFNetPython.Action_e_JavaScript r""" Execute a JavaScript script.""" e_SetOCGState = _PDFNetPython.Action_e_SetOCGState r""" (PDF 1.5) Set the states of optional content groups.""" e_Rendition = _PDFNetPython.Action_e_Rendition r""" (PDF 1.5) Controls the playing of multimedia content.""" e_Trans = _PDFNetPython.Action_e_Trans r""" Updates the display of a document, using a transition dictionary.""" e_GoTo3DView = _PDFNetPython.Action_e_GoTo3DView r""" (PDF 1.6) Set the current view of a 3D annotation""" e_RichMediaExecute = _PDFNetPython.Action_e_RichMediaExecute r""" Adobe supplement to ISO 32000; specifies a command to be sent to rich media annotation's handler""" e_Unknown = _PDFNetPython.Action_e_Unknown r""" Unknown Action type"""
[docs] def GetType(self): r""" :rtype: int :return: The type of this Action. """ return _PDFNetPython.Action_GetType(self)
[docs] def Execute(self): r""" Executes current action; this will only work for some action types that can be executed only using the information contained in the action object or the associated PDF doc. See also PDFViewCtrl::ExecuteAction() """ return _PDFNetPython.Action_Execute(self)
[docs] def ExecuteKeyStrokeAction(self, data): r""" Executes KeyStrokeAction, this shall be performed when the user modifies a character in a text field or combo box or modifies the selecton in a scrollable list box. This action checks the added text for validity and reject or modify it. :type data: KeyStrokeEventData :param data: Data that contains previous text, added text,and added position information. """ return _PDFNetPython.Action_ExecuteKeyStrokeAction(self, data)
[docs] def NeedsWriteLock(self): r""" Test if the action needs writeLock :rtype: boolean :return: ture if needs, otherwise false """ return _PDFNetPython.Action_NeedsWriteLock(self)
[docs] def GetNext(self): r""" :rtype: :py:class:`Obj` :return: The next action dictionary, an array of action dictionaries, or NULL if there are no additional actions. Sequences of actions can be chained together. For example, the effect of clicking a link annotation with the mouse might be to play a sound, jump to a new page, and start up a movie. Note that the Next entry is not restricted to a single action but may contain an array of actions, each of which in turn may have a Next entry of its own. The actions may thus form a tree instead of a simple linked list. Actions within each Next array are executed in order, each followed in turn by any actions specified in its Next entry, and so on recursively. """ return _PDFNetPython.Action_GetNext(self)
[docs] def GetDest(self): r""" :rtype: :py:class:`Destination` :return: The Action's Destination view. Notes: This only works for Actions whose subtype is "GoTo". All named destinations are automatically resolved to the explicit destination so you can access destination members directly. """ return _PDFNetPython.Action_GetDest(self)
e_exclude = _PDFNetPython.Action_e_exclude e_include_no_value_fields = _PDFNetPython.Action_e_include_no_value_fields e_export_format = _PDFNetPython.Action_e_export_format e_get_method = _PDFNetPython.Action_e_get_method e_submit_coordinates = _PDFNetPython.Action_e_submit_coordinates e_xfdf = _PDFNetPython.Action_e_xfdf e_include_append_saves = _PDFNetPython.Action_e_include_append_saves e_include_annotations = _PDFNetPython.Action_e_include_annotations e_submit_pdf = _PDFNetPython.Action_e_submit_pdf e_canonical_format = _PDFNetPython.Action_e_canonical_format e_excl_non_user_annots = _PDFNetPython.Action_e_excl_non_user_annots e_excl_F_key = _PDFNetPython.Action_e_excl_F_key e_embed_form = _PDFNetPython.Action_e_embed_form
[docs] def GetFormActionFlag(self, flag): r""" :type flag: int :param flag: Action flag to get the value from. :rtype: boolean :return: boolean value of the given action flag. Notes: Action flags are currently only used by submit and reset form actions. """ return _PDFNetPython.Action_GetFormActionFlag(self, flag)
[docs] def SetFormActionFlag(self, flag, value): r""" Set the value of a given field flag. :type flag: int :param flag: Action flag to get the value from. :type value: boolean :param value: Boolean to set the value of the flag to. Action flags are currently only used by submit and reset form actions. """ return _PDFNetPython.Action_SetFormActionFlag(self, flag, value)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: Pointer to the underlying SDF/Cos object. """ return _PDFNetPython.Action_GetSDFObj(self)
[docs] @staticmethod def CreateInternal(impl): return _PDFNetPython.Action_CreateInternal(impl)
[docs] def GetHandleInternal(self): return _PDFNetPython.Action_GetHandleInternal(self)
def __init__(self, args): _PDFNetPython.Action_swiginit(self, _PDFNetPython.new_Action(args)) mp_action = property(_PDFNetPython.Action_mp_action_get, _PDFNetPython.Action_mp_action_set) __swig_destroy__ = _PDFNetPython.delete_Action
# Register Action in _PDFNetPython: _PDFNetPython.Action_swigregister(Action)
[docs] def Action_CreateGoto(args): r""" Overload 1: Creates a new 'GoTo'action. GoTo action takes the user to the specified Destination view located in the same document. :type dest: :py:class:`Destination` :param dest: A Destination for the new Action. Notes: This method can only be used for destinations in the same document as the source document. For cross-document links use Action::CreateGotoRemote(). | Overload 2: Creates a new 'GoTo' action using a 'Named Destination'. GoTo action takes the user to the specified 'Named Destination' view located in the same document. :type key: UChar :param key: - a string buffer representing the destination name. The named destination will be stored in document's '/Dest' SDF::NameTree. :type key_sz: int :param key_sz: The size in bytes of the key buffer. :type dest: :py:class:`Destination` :param dest: The explicit destination used to create the named destination. """ return _PDFNetPython.Action_CreateGoto(args)
[docs] def Action_CreateGotoRemote(args): r""" Overload 1: Creates a new 'GoToR'action. A remote go-to action is similar to an ordinary go-to action but jumps to a destination in another PDF file instead of the current file. :type file: :py:class:`FileSpec` :param file: The file referred to by the action. :type page_num: int :param page_num: A page number within the remote document. The first page is numbered 0. _window A flag specifying whether to open the destination document in a new window. If new_window is false, the destination document replaces the current document in the same window, otherwise the viewer application should behave in accordance with the current user preference. | Overload 2: Creates a new 'GoToR'action. See the above method for details. :type file: :py:class:`FileSpec` :param file: The file referred to by the action. :type page_num: int :param page_num: A page number within the remote document. The first page is numbered 0. :type new_window: boolean :param new_window: A flag specifying whether to open the destination document in a new window. If new_window is false, the destination document replaces the current document in the same window, otherwise the viewer application should behave in accordance with the current user preference. """ return _PDFNetPython.Action_CreateGotoRemote(args)
[docs] def Action_CreateURI(args): r""" Overload 1: Create a new URI action. The URI action is typically resolved by opening a URL in the default web browser. :type doc: :py:class:`SDFDoc` :param doc: The document in which to create the action. :type uri: string :param uri: The uniform resource identifier to resolve, encoded in 7-bit ASCII. A uniform resource identifier (URI) is a string that identifies (resolves to) a resource on the Internet; typically a file that is the destination of a hypertext link, although it can also resolve to a query or other entity. (URIs are described in Internet RFC 2396, Uniform Resource Identifiers (URI). | Overload 2: Create a new URI action. The URI action is typically resolved by opening a URL in the default web browser. :type doc: :py:class:`SDFDoc` :param doc: The document in which to create the action. :type uri: string :param uri: The uniform resource identifier to resolve, encoded in UTF-8. A uniform resource identifier (URI) is a string that identifies (resolves to) a resource on the Internet; typically a file that is the destination of a hypertext link, although it can also resolve to a query or other entity. (URIs are described in Internet RFC 2396, Uniform Resource Identifiers (URI). """ return _PDFNetPython.Action_CreateURI(args)
[docs] def Action_CreateSubmitForm(url): r""" Creates a new 'SubmitForm'action. A submit-form action transmits the names and values of selected interactive form fields to a specified uniform resource locator (URL), presumably the address of a Web server that will process them and send back a response. :type url: :py:class:`FileSpec` :param url: A URL file specification giving the uniform resource locator (URL) of the script at the Web server that will process the submission. """ return _PDFNetPython.Action_CreateSubmitForm(url)
[docs] def Action_CreateLaunch(doc, path): r""" Creates a new 'Launch' action. A launch action opens up a file using the most appropriate program. :type doc: :py:class:`SDFDoc` :param doc: the document in which to create the action :type path: string :param path: the full path of the file to be opened """ return _PDFNetPython.Action_CreateLaunch(doc, path)
[docs] def Action_CreateHideField(sdfdoc, field): r""" Creates a new 'Show/Hide Field' action. A show/hide field action shows or hide certain fields when it's invoked. :type sdfdoc: :py:class:`SDFDoc` :param sdfdoc: the document in which to create the action :param list_length: the number of fields to hide :type field: std::vector< std::string,std::allocator< std::string > > :param field: the list of fields to hide """ return _PDFNetPython.Action_CreateHideField(sdfdoc, field)
[docs] def Action_CreateImportData(doc, path): r""" Creates a new 'Import Data' action. An import data action imports form data from a FDF file into a PDF document. :type doc: :py:class:`SDFDoc` :param doc: the document in which to create the action :type path: string :param path: the full path of the FDF file """ return _PDFNetPython.Action_CreateImportData(doc, path)
[docs] def Action_CreateResetForm(doc): r""" Creates a new 'Reset Form' action. A reset form action reset chosen form fields to their default value. :type doc: :py:class:`SDFDoc` :param doc: the document in which to create the action """ return _PDFNetPython.Action_CreateResetForm(doc)
[docs] def Action_CreateJavaScript(doc, script): r""" Creates a new 'JavaScript' action. A javascript action executes a JavaScript script when it's invoked. :type doc: :py:class:`SDFDoc` :param doc: the document in which to create the action :type script: string :param script: the JavaScript script to be executed """ return _PDFNetPython.Action_CreateJavaScript(doc, script)
[docs] def Action_CreateInternal(impl): return _PDFNetPython.Action_CreateInternal(impl)
[docs] class PageSet(object): r""" PageSet is a container of page numbers ordered following a linear sequence. The page numbers are integers and must be greater than zero. Duplicates are allowed. (NOTE: This is not a mathematical set) """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_all = _PDFNetPython.PageSet_e_all e_even = _PDFNetPython.PageSet_e_even e_odd = _PDFNetPython.PageSet_e_odd __swig_destroy__ = _PDFNetPython.delete_PageSet
[docs] def AddPage(self, one_page): r""" Add a value to the sequence. :type one_page: int :param one_page: The page number being added """ return _PDFNetPython.PageSet_AddPage(self, one_page)
[docs] def AddRange(self, args): r""" Add a range of values to the sequence. Reverse ordering is legal. :type range_start: int :param range_start: The starting value in the range :type range_end: int :param range_end: The ending value in the range :type filter: int :param filter: -e_all: Default, includes all pages in the range -e_odd: Includes odd numbers in the range (discards even numbers) -e_even: Includes even numbers in the range (discards odd numbers) """ return _PDFNetPython.PageSet_AddRange(self, args)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.PageSet_Destroy(self)
def __init__(self, args): _PDFNetPython.PageSet_swiginit(self, _PDFNetPython.new_PageSet(args)) mp_impl = property(_PDFNetPython.PageSet_mp_impl_get, _PDFNetPython.PageSet_mp_impl_set)
# Register PageSet in _PDFNetPython: _PDFNetPython.PageSet_swigregister(PageSet)
[docs] class Config(object): r""" The OCG::Config object represents an optional-content (OC) configuration structure (see section 4.10.3 in PDF Reference), used to persist a set of visibility states and other optional-content information in a PDF file A document has a default configuration, saved in the D entry in the 'OCProperties' dictionary (that can be obtained using pdfdoc.GetOCConfig()), and can have a list of other configurations, saved as an array in the 'Configs' entry in the OCProperties dictionary. Configurations are typically used to initialize the OCG ON-OFF states for an optional-content context (OCG::Context). The OCG order in the configuration is the order in which the groups appear in the Layers panel of a PDF viewer. The configuration can also define a set of mutually exclusive OCGs, called a radio button group. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, default_config): r""" Creates a new optional-content configuration object in the document. :type doc: :py:class:`PDFDoc` :param doc: The document in which the new OCG::Config will be created. :type default_config: boolean :param default_config: If true, the configuration will be set as the default OCG configuration (i.e. listed as a D entry under 'OCProperties' dictionary). :rtype: :py:class:`Config` :return: The newly created configuration object. """ return _PDFNetPython.Config_Create(doc, default_config)
[docs] def IsValid(self): r""" :rtype: boolean :return: true is this is a valid (non-null) configuration, false otherwise. """ return _PDFNetPython.Config_IsValid(self)
[docs] def GetOrder(self): r""" :rtype: :py:class:`Obj` :return: the Obj array that specifies the order of optional content (OC) groups in this configuration or NULL if the configuration does not contain any OCGs. The order of OCGs in the array is used to represent the order in which the group names are displayed in the Layers panel of a PDF viewer application. For more information, please refer to Section 4.10.3 in the PDF Reference. """ return _PDFNetPython.Config_GetOrder(self)
[docs] def SetOrder(self, ocgs_array): r""" Sets the user interface display order of optional-content groups (OCGs) in this configuration. This is the order in which the group names are displayed in the Layers panel of a PDF viewer. :type ocgs_array: :py:class:`Obj` :param ocgs_array: The SDF/Cos object containing the OCG order array. For more information, please refer to section 4.10.3 in the PDF Reference. """ return _PDFNetPython.Config_SetOrder(self, ocgs_array)
[docs] def GetName(self): r""" :rtype: string :return: the name of an optional-content configuration (suitable for presentation in a user interface). """ return _PDFNetPython.Config_GetName(self)
[docs] def SetName(self, name): r""" Sets the name of an optional-content configuration (suitable for presentation in a user interface). The method stores the specified string as the Name entry in the configuration's SDF/Cos dictionary. :type name: string :param name: The new name string. """ return _PDFNetPython.Config_SetName(self, name)
[docs] def GetCreator(self): r""" :rtype: string :return: the creator property of an optional-content configuration. The string is used to represent the name of the application or feature that created this configuration. """ return _PDFNetPython.Config_GetCreator(self)
[docs] def SetCreator(self, name): r""" Sets the creator property of an optional-content configuration. Stores the specified string as the Creator entry in the configuration's SDF/Cos dictionary. :type name: string :param name: The new creator string. """ return _PDFNetPython.Config_SetCreator(self, name)
[docs] def GetInitBaseState(self): r""" :rtype: string :return: the base initialization state. This state is used to initialize the states of all the OCGs in a document when this configuration is applied. The value of this entry must be one of the following names: ON: The states of all groups are turned ON. OFF: The states of all groups are turned OFF. Unchanged: The states of all groups are left unchanged. After base initialization, the contents of the ON and OFF arrays are processed, overriding the state of the groups included in the arrays. Notes: If BaseState is present in the document's default configuration dictionary, its value must be "ON". ON. """ return _PDFNetPython.Config_GetInitBaseState(self)
[docs] def GetInitOnStates(self): r""" :rtype: :py:class:`Obj` :return: the "ON" initialization array from the configuration dictionary or NULL if the array is not present. The returned object is an array of optional content groups whose state should be set to ON when this configuration is applied. Note: If the BaseState entry is ON, this entry is redundant. """ return _PDFNetPython.Config_GetInitOnStates(self)
[docs] def GetInitOffStates(self): r""" :rtype: :py:class:`Obj` :return: the "OFF" initialization array from the configuration dictionary or NULL if the array is not present. The returned object is an array of optional content groups whose state should be set to OFF when this configuration is applied. Note: If the BaseState entry is OFF, this entry is redundant. """ return _PDFNetPython.Config_GetInitOffStates(self)
[docs] def SetInitBaseState(self, args): r""" Sets the base initialization state. For more info, please see GetInitBaseState(). :type state: string :param state: new base state ("ON", "OFF", or "Unchanged"). """ return _PDFNetPython.Config_SetInitBaseState(self, args)
[docs] def SetInitOnStates(self, on_array): r""" Sets the 'ON' initialization array in the configuration dictionary. :type on_array: :py:class:`Obj` :param on_array: the initialization array to be used Notes: For more info, please see SetInitOnStates() and section 4.10.3 in PDF Reference. """ return _PDFNetPython.Config_SetInitOnStates(self, on_array)
[docs] def SetInitOffStates(self, off_array): r""" Sets the 'OFF' initialization array in the configuration dictionary. :type off_array: :py:class:`Obj` :param off_array: the initialization array to be used. Notes: For more info, please see SetInitOffStates() and section 4.10.3 in PDF Reference. """ return _PDFNetPython.Config_SetInitOffStates(self, off_array)
[docs] def GetIntent(self): r""" :rtype: :py:class:`Obj` :return: OCG configuration intent. An intent is a name object (or an array of name objects) broadly describing the intended use, which can be either "View" or "Design". A group's content is considered to be optional (that is, the group's state is considered in its visibility) if any intent in its list matches an intent of the context. The intent list of the context is usually set from the intent list of the document configuration. If the configuration has no Intent entry, the default value of "View" is used. """ return _PDFNetPython.Config_GetIntent(self)
[docs] def SetIntent(self, intent): r""" Sets the Intent entry in an optional-content configuration's SDF/Cos dictionary. For more information, see GetIntent(). :type intent: :py:class:`Obj` :param intent: The new Intent entry value (a name object or an array of name objects). """ return _PDFNetPython.Config_SetIntent(self, intent)
[docs] def GetLockedOCGs(self): r""" :rtype: :py:class:`Obj` :return: the list of locked OCGs or NULL if there are no locked OCGs. The on/off state of a locked OCG cannot be toggled by the user through the user interface. """ return _PDFNetPython.Config_GetLockedOCGs(self)
[docs] def SetLockedOCGs(self, locked_ocg_array): r""" Sets the array of locked OCGs. The on/off state of a locked OCG cannot be toggled by the user through the user interface. :type locked_ocg_array: :py:class:`Obj` :param locked_ocg_array: An SDF/Cos array of OCG objects to be locked in this configuration, or an empty array if the configuration should not contain locked OCGs. The default is the empty array. """ return _PDFNetPython.Config_SetLockedOCGs(self, locked_ocg_array)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: Pointer to the underlying SDF/Cos object. """ return _PDFNetPython.Config_GetSDFObj(self)
def __init__(self, args): _PDFNetPython.Config_swiginit(self, _PDFNetPython.new_Config(args)) mp_obj = property(_PDFNetPython.Config_mp_obj_get, _PDFNetPython.Config_mp_obj_set) __swig_destroy__ = _PDFNetPython.delete_Config
# Register Config in _PDFNetPython: _PDFNetPython.Config_swigregister(Config)
[docs] def Config_Create(doc, default_config): r""" Creates a new optional-content configuration object in the document. :type doc: :py:class:`PDFDoc` :param doc: The document in which the new OCG::Config will be created. :type default_config: boolean :param default_config: If true, the configuration will be set as the default OCG configuration (i.e. listed as a D entry under 'OCProperties' dictionary). :rtype: :py:class:`Config` :return: The newly created configuration object. """ return _PDFNetPython.Config_Create(doc, default_config)
[docs] class Group(object): r""" The OCG::Group object represents an optional-content group. This corresponds to a PDF OCG dictionary representing a collection of graphic objects that can be made visible or invisible (Section 4.10.1 'Optional Content Groups' in PDF Reference). Any graphic content of the PDF can be made optional, including page contents, XObjects, and annotations. The specific content objects in the group have an OC entry in the PDF as part of the surrounding marked content or in the XObject dictionary. The group itself is a named object that can be typically manipulated through a Layers panel in a PDF viewer. In the simplest case, the group's ON-OFF state makes the associated content visible or hidden. The ON-OFF state of a group can be toggled for a particular context (OCG::Context), and a set of states is kept in a configuration (OCG::Config). The visibility can depend on more than one group in an optional-content membership dictionary (OCG::OCMD), and can also be affected by the context's draw mode (OCGContext::OCDrawMode). A group has an Intent entry, broadly describing the intended use. A group's content is considered to be optional (that is, the group's state is considered in its visibility) if any intent in its list matches an intent of the context. The intent list of the context is usually set from the intent list of the document configuration. A Usage dictionary entry provides more specific intended usage information than an intent entry. Possible key values are: CreatorInfo, Language, Export, Zoom, Print, View, User, PageElement. The usage value can act as a kind of metadata, describing the sort of things that belong to the group, such as text in French, fine detail on a map, or a watermark. The usage values can also be used by the AutoState mechanism to make decisions about what groups should be on and what groups should be off. The AutoState mechanism considers the usage information in the OCGs, the AS array of the configuration, and external factors; for example, the language the application is running in, the current zoom level on the page, or whether the page is being printed. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, name): r""" Creates a new optional-content group (OCG) object in the document. :type doc: :py:class:`PDFDoc` :param doc: The document in which the new OCG will be created. :type name: string :param name: The name of the optional-content group. :rtype: :py:class:`Group` :return: The newly created OCG::Group object. """ return _PDFNetPython.Group_Create(doc, name)
[docs] def IsValid(self): r""" :rtype: boolean :return: True if this is a valid (non-null) OCG, false otherwise. """ return _PDFNetPython.Group_IsValid(self)
[docs] def GetName(self): r""" :rtype: string :return: the name of this optional-content group (OCG). """ return _PDFNetPython.Group_GetName(self)
[docs] def SetName(self, name): r""" Sets the name of this optional-content group (OCG). :type name: string :param name: The new name. """ return _PDFNetPython.Group_SetName(self, name)
[docs] def GetCurrentState(self, context): r""" :rtype: boolean :return: true if this OCG object is in the ON state in a given context, false otherwise. :type context: :py:class:`Context` :param context: The context for which to get the group's state. """ return _PDFNetPython.Group_GetCurrentState(self, context)
[docs] def SetCurrentState(self, context, state): r""" Sets the current ON-OFF state of the optional-content group (OCG) object in a given context. :type context: :py:class:`Context` :param context: The context for which to set the group's state. :type state: boolean :param state: The new state. """ return _PDFNetPython.Group_SetCurrentState(self, context, state)
[docs] def GetInitialState(self, config): r""" :rtype: boolean :return: The initial state (ON or OFF) of the optional-content group (OCG) object in a given configuration. :type config: :py:class:`Config` :param config: The configuration for which to get the group's initial state. Notes: If the configuration has a BaseState of Unchanged, and the OCG is not listed explicitly in its ON list or OFF list, then the initial state is taken from the OCG's current state in the document's default context. """ return _PDFNetPython.Group_GetInitialState(self, config)
[docs] def SetInitialState(self, config, state): r""" Sets the initial state (ON or OFF) of the optional-content group (OCG) object in a given configuration. :type config: :py:class:`Config` :param config: The configuration for which to set the group's initial state. :type state: boolean :param state: The new initial state, true if the state is ON, false if it is OFF. """ return _PDFNetPython.Group_SetInitialState(self, config, state)
[docs] def GetIntent(self): r""" :rtype: :py:class:`Obj` :return: OCG intent. An intent is a name object (or an array of name objects) broadly describing the intended use, which can be either "View" or "Design". A group's content is considered to be optional (that is, the group's state is considered in its visibility) if any intent in its list matches an intent of the context. The intent list of the context is usually set from the intent list of the document configuration. """ return _PDFNetPython.Group_GetIntent(self)
[docs] def SetIntent(self, intent): r""" Sets the Intent entry in an optional-content group's SDF/Cos dictionary. For more information, see GetIntent(). :type intent: :py:class:`Obj` :param intent: The new Intent entry value (a name object or an array of name objects). """ return _PDFNetPython.Group_SetIntent(self, intent)
[docs] def IsLocked(self, config): r""" :rtype: boolean :return: true if this OCG is locked in a given configuration, false otherwise. The on/off state of a locked OCG cannot be toggled by the user through the user interface. :type config: :py:class:`Config` :param config: The OC configuration. """ return _PDFNetPython.Group_IsLocked(self, config)
[docs] def SetLocked(self, config, locked): r""" Sets the locked state of an OCG in a given configuration. The on/off state of a locked OCG cannot be toggled by the user through the user interface. :type config: :py:class:`Config` :param config: IN/OUT The optional-content configuration. :type locked: boolean :param locked: true if the OCG should be locked, false otherwise. """ return _PDFNetPython.Group_SetLocked(self, config, locked)
[docs] def HasUsage(self): r""" :rtype: boolean :return: true if this group is associated with a Usage dictionary, false otherwise. """ return _PDFNetPython.Group_HasUsage(self)
[docs] def GetUsage(self, key): r""" :rtype: :py:class:`Obj` :return: The usage information associated with the given key in the Usage dictionary for the group, or a NULL if the entry is not present. A Usage dictionary entry provides more specific intended usage information than an intent entry. :type key: string :param key: The usage key in the usage dictionary entry. The possible key values are: CreatorInfo, Language, Export, Zoom, Print, View, User, PageElement. """ return _PDFNetPython.Group_GetUsage(self, key)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: Pointer to the underlying SDF/Cos object. """ return _PDFNetPython.Group_GetSDFObj(self)
def __init__(self, args): _PDFNetPython.Group_swiginit(self, _PDFNetPython.new_Group(args)) mp_obj = property(_PDFNetPython.Group_mp_obj_get, _PDFNetPython.Group_mp_obj_set) __swig_destroy__ = _PDFNetPython.delete_Group
# Register Group in _PDFNetPython: _PDFNetPython.Group_swigregister(Group)
[docs] def Group_Create(doc, name): r""" Creates a new optional-content group (OCG) object in the document. :type doc: :py:class:`PDFDoc` :param doc: The document in which the new OCG will be created. :type name: string :param name: The name of the optional-content group. :rtype: :py:class:`Group` :return: The newly created OCG::Group object. """ return _PDFNetPython.Group_Create(doc, name)
[docs] class Context(object): r""" The OCG::Context object represents an optional-content context in a document, within which document objects such as words or annotations are visible or hidden. The context keeps track of the ON-OFF states of all of the optional-content groups (OCGs) in a document. Content is or is not visible with respect to the OCG states stored in a specific context. Unlike other objects in OCG namespace, the OCG::Context does not correspond to any explicit PDF structure. Each PDFView has a default context (PDF::GetOCGContext()) that it uses for on-screen drawing and that determines the default state for any drawing. The context has flags that control whether to draw content that is marked as optional, and whether to draw content that is not marked as optional. When enumerating page content, OCG::Context can be passed as a parameter in ElementReader.Begin() method. When using PDFDraw, PDFRasterizer, or PDFView class to render PDF pages use PDFDraw::SetOCGContext() method to select an OC context. There can be more than one Context object, representing different combinations of OCG states. You can change the states of OCGs within any context. You can build contexts with your own combination of OCG states, and issue drawing or enumeration commands using that context. For example, you can pass an optional-content context to ElementReader.Begin(). You can save the resulting state information as part of the configuration (e.g. using Config::SetInit methods), but the context itself has no corresponding PDF representation, and is not saved. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_Context
[docs] def IsValid(self): r""" :rtype: boolean :return: true is this is a valid (non-null) context, false otherwise. """ return _PDFNetPython.Context_IsValid(self)
[docs] def GetState(self, group): r""" :rtype: boolean :return: the ON-OFF states (true or false) for the given optional-content group (OCG) in this OC context. :type group: :py:class:`Group` :param group: The optional-content group (OCG) that is queried. """ return _PDFNetPython.Context_GetState(self, group)
[docs] def SetState(self, group, state): r""" Sets the ON-OFF states for the given optional-content group (OCG) in this context. :type group: :py:class:`Group` :param group: The optional-content group (OCG) that is queried. :type state: boolean :param state: true for 'ON' and false for 'OFF'. """ return _PDFNetPython.Context_SetState(self, group, state)
[docs] def ResetStates(self, all_on): r""" Sets the sates of all OCGs in the context to ON or OFF. :type all_on: boolean :param all_on: A flag used to specify whether the OCG states should be set to ON (if true), or OFF (if false). """ return _PDFNetPython.Context_ResetStates(self, all_on)
[docs] def SetNonOCDrawing(self, draw_non_OC): r""" Sets the non-OC status for this context. Content that is not marked as optional content is drawn (or element.IsOCVisible()) when 'draw_non_OC' is true, and not drawn/visible otherwise. :type draw_non_OC: boolean :param draw_non_OC: A flag specifying whether the content that is not marked as optional should be treated as visible. """ return _PDFNetPython.Context_SetNonOCDrawing(self, draw_non_OC)
[docs] def GetNonOCDrawing(self): r""" :rtype: boolean :return: the non-OC status for this context. The flag indicates whether the content that is not marked as optional should be treated as visible. For more information, please see SetNonOCDrawing(). """ return _PDFNetPython.Context_GetNonOCDrawing(self)
e_VisibleOC = _PDFNetPython.Context_e_VisibleOC r""" Draw or enumerate optional content that is visible, according to the current state of Optional Content Groups (OCGs) and Optional Content Membership Dictionaries (OCMDs). This is the default mode. """ e_AllOC = _PDFNetPython.Context_e_AllOC r""" Draw or enumerate all optional content, regardless of its visibility state. If the context's 'SetNonOCDrawing' is enabled, all contents of document are shown. """ e_NoOC = _PDFNetPython.Context_e_NoOC r""" Draw or enumerate no optional content, regardless of its visibility state. If the context's 'SetNonOCDrawing' is not enabled, nothing is drawn, resulting in a blank page. """
[docs] def SetOCDrawMode(self, oc_draw_mode): r""" Sets the drawing and enumeration type for this context. This type, together with the visibility determined by the OCG and OCMD states, controls whether content that is marked as optional content is drawn or enumerated. :type oc_draw_mode: int :param oc_draw_mode: A flag specifying the visibility of optional content. """ return _PDFNetPython.Context_SetOCDrawMode(self, oc_draw_mode)
[docs] def GetOCMode(self): r""" :rtype: int :return: the drawing and enumeration type for this context. For more information, please see SetOCMode() and OCG::Context::OCDrawMode. """ return _PDFNetPython.Context_GetOCMode(self)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.Context_Destroy(self)
[docs] @staticmethod def CreateInternal(impl): return _PDFNetPython.Context_CreateInternal(impl)
[docs] def GetHandleInternal(self): return _PDFNetPython.Context_GetHandleInternal(self)
def __init__(self, args): _PDFNetPython.Context_swiginit(self, _PDFNetPython.new_Context(args)) mp_obj = property(_PDFNetPython.Context_mp_obj_get, _PDFNetPython.Context_mp_obj_set)
# Register Context in _PDFNetPython: _PDFNetPython.Context_swigregister(Context)
[docs] def Context_CreateInternal(impl): return _PDFNetPython.Context_CreateInternal(impl)
[docs] class OCMD(object): r""" The OCMD object represents an Optional Content Membership Dictionary (OCMD) that allows the visibility of optional content to depend on the states in a set of optional-content groups (OCG::Group). The object directly corresponds to the OCMD dictionary (Section 4.10.1 'Optional Content Groups' in PDF Reference). An OCMD collects a set of OCGs. It sets a visibility policy, so that content in the member groups is visible only when all groups are ON or OFF, or when any of the groups is ON or OFF. This makes it possible to set up complex dependencies among groups. For example, an object can be visible only if some other conditions are met (such as if another layer is visible). """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_AllOn = _PDFNetPython.OCMD_e_AllOn r""" visible only if all of the entries in OCGs are ON.""" e_AnyOn = _PDFNetPython.OCMD_e_AnyOn r""" visible if any of the entries in OCGs are ON.""" e_AnyOff = _PDFNetPython.OCMD_e_AnyOff r""" visible if any of the entries in OCGs are OFF.""" e_AllOff = _PDFNetPython.OCMD_e_AllOff r""" visible only if all of the entries in OCGs are OFF."""
[docs] @staticmethod def Create(doc, ocgs, vis_policy): r""" Creates a new optional-content membership dictionary (OCMD) object in the given document for the given groups and visibility policy. :type doc: :py:class:`PDFDoc` :param doc: The document in which the new OCMD will be created. :type ocgs: :py:class:`Obj` :param ocgs: An array of optional-content groups (OCGs) to be members of the dictionary. :param policy: The visibility policy that determines the visibility of content with respect to the ON-OFF state of OCGs listed in the dictionary. :rtype: :py:class:`OCMD` :return: The newly created OCG::OCMD object. """ return _PDFNetPython.OCMD_Create(doc, ocgs, vis_policy)
[docs] def IsValid(self): r""" :rtype: boolean :return: True if this is a valid (non-null) OCMD, false otherwise. """ return _PDFNetPython.OCMD_IsValid(self)
[docs] def GetOCGs(self): r""" Returns the optional-content groups listed under 'OCGs' entry in the object dictionary. :rtype: :py:class:`Obj` :return: A dictionary (for a single OCG::Group object), an SDF::Obj array (for multiple OCG::Group objects) or NULL (for an empty OCMD). """ return _PDFNetPython.OCMD_GetOCGs(self)
[docs] def GetVisibilityPolicy(self): r""" Returns the optional-content membership dictionary's visibility policy, which determines the visibility of content with respect to the ON-OFF state of OCGs listed in the dictionary. :rtype: int :return: The visibility policy. """ return _PDFNetPython.OCMD_GetVisibilityPolicy(self)
[docs] def SetVisibilityPolicy(self, vis_policy): r""" Sets the optional-content membership dictionary's visibility policy, which determines the visibility of content with respect to the ON-OFF state of OCGs listed in the dictionary. :type vis_policy: int :param vis_policy: New visibility policy. """ return _PDFNetPython.OCMD_SetVisibilityPolicy(self, vis_policy)
[docs] def GetVisibilityExpression(self): r""" :rtype: :py:class:`Obj` :return: If the PDOCMD has a visibility expression entry, return the SDF::Obj array object representing the expression, otherwise returns NULL. """ return _PDFNetPython.OCMD_GetVisibilityExpression(self)
[docs] def IsCurrentlyVisible(self, context): r""" :rtype: boolean :return: true if content tagged with this OCMD is visible in the given context, false if it is hidden. Based on the optional-content groups listed in the dictionary, the current ON-OFF state of those groups within the specified context, and the dictionary's visibility policy, test whether the content tagged with this dictionary would be visible. :type context: :py:class:`Context` :param context: The context in which the visibility of content is tested. """ return _PDFNetPython.OCMD_IsCurrentlyVisible(self, context)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: Pointer to the underlying SDF/Cos object. """ return _PDFNetPython.OCMD_GetSDFObj(self)
def __init__(self, args): _PDFNetPython.OCMD_swiginit(self, _PDFNetPython.new_OCMD(args)) mp_obj = property(_PDFNetPython.OCMD_mp_obj_get, _PDFNetPython.OCMD_mp_obj_set) __swig_destroy__ = _PDFNetPython.delete_OCMD
# Register OCMD in _PDFNetPython: _PDFNetPython.OCMD_swigregister(OCMD)
[docs] def OCMD_Create(doc, ocgs, vis_policy): r""" Creates a new optional-content membership dictionary (OCMD) object in the given document for the given groups and visibility policy. :type doc: :py:class:`PDFDoc` :param doc: The document in which the new OCMD will be created. :type ocgs: :py:class:`Obj` :param ocgs: An array of optional-content groups (OCGs) to be members of the dictionary. :param policy: The visibility policy that determines the visibility of content with respect to the ON-OFF state of OCGs listed in the dictionary. :rtype: :py:class:`OCMD` :return: The newly created OCG::OCMD object. """ return _PDFNetPython.OCMD_Create(doc, ocgs, vis_policy)
[docs] class PDFAOptions(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, level): r""" Constructor. :type level: int :param level: The PDF/A conformance level. """ _PDFNetPython.PDFAOptions_swiginit(self, _PDFNetPython.new_PDFAOptions(level)) __swig_destroy__ = _PDFNetPython.delete_PDFAOptions
[docs] def GetConformance(self): r""" Gets the value Conformance from the options object The PDF/A conformance level. :rtype: int :return: a PDFACompliance::Conformance, the current value for Conformance. """ return _PDFNetPython.PDFAOptions_GetConformance(self)
[docs] def SetConformance(self, value): r""" Sets the value for Conformance in the options object The PDF/A conformance level. :type value: int :param value:: the new value for Conformance :rtype: :py:class:`PDFAOptions` :return: this object, for call chaining """ return _PDFNetPython.PDFAOptions_SetConformance(self, value)
[docs] def GetDPI(self): r""" Gets the value DPI from the options object DPI used for flattening. :rtype: int :return: a UInt32, the current value for DPI. """ return _PDFNetPython.PDFAOptions_GetDPI(self)
[docs] def SetDPI(self, value): r""" Sets the value for DPI in the options object DPI used for flattening. :type value: int :param value:: the new value for DPI :rtype: :py:class:`PDFAOptions` :return: this object, for call chaining """ return _PDFNetPython.PDFAOptions_SetDPI(self, value)
[docs] def GetFirstStop(self): r""" Gets the value FirstStop from the options object Whether to stop processing after the first PDF/A error is detected. :rtype: boolean :return: a bool, the current value for FirstStop. """ return _PDFNetPython.PDFAOptions_GetFirstStop(self)
[docs] def SetFirstStop(self, value): r""" Sets the value for FirstStop in the options object Whether to stop processing after the first PDF/A error is detected. :type value: boolean :param value:: the new value for FirstStop :rtype: :py:class:`PDFAOptions` :return: this object, for call chaining """ return _PDFNetPython.PDFAOptions_SetFirstStop(self, value)
[docs] def GetFlattenTransparency(self): r""" Gets the value FlattenTransparency from the options object Whether to flatten transparency in PDF/A-1 mode. :rtype: boolean :return: a bool, the current value for FlattenTransparency. """ return _PDFNetPython.PDFAOptions_GetFlattenTransparency(self)
[docs] def SetFlattenTransparency(self, value): r""" Sets the value for FlattenTransparency in the options object Whether to flatten transparency in PDF/A-1 mode. :type value: boolean :param value:: the new value for FlattenTransparency :rtype: :py:class:`PDFAOptions` :return: this object, for call chaining """ return _PDFNetPython.PDFAOptions_SetFlattenTransparency(self, value)
[docs] def GetMaxRefObjs(self): r""" Gets the value MaxRefObjs from the options object The maximum number of object references per error condition. :rtype: int :return: a UInt32, the current value for MaxRefObjs. """ return _PDFNetPython.PDFAOptions_GetMaxRefObjs(self)
[docs] def SetMaxRefObjs(self, value): r""" Sets the value for MaxRefObjs in the options object The maximum number of object references per error condition. :type value: int :param value:: the new value for MaxRefObjs :rtype: :py:class:`PDFAOptions` :return: this object, for call chaining """ return _PDFNetPython.PDFAOptions_SetMaxRefObjs(self, value)
[docs] def GetPassword(self): r""" Gets the value Password from the options object The password to be used for encrypted PDF documents. :rtype: string :return: a string, the current value for Password. """ return _PDFNetPython.PDFAOptions_GetPassword(self)
[docs] def SetPassword(self, value): r""" Sets the value for Password in the options object The password to be used for encrypted PDF documents. :type value: string :param value:: the new value for Password :rtype: :py:class:`PDFAOptions` :return: this object, for call chaining """ return _PDFNetPython.PDFAOptions_SetPassword(self, value)
# Register PDFAOptions in _PDFNetPython: _PDFNetPython.PDFAOptions_swigregister(PDFAOptions)
[docs] class PDFACompliance(object): r""" PDFACompliance class is used to validate PDF documents for PDF/A (ISO 19005:1/2/3) compliance or to convert existing PDF files to PDF/A compliant documents. The conversion option analyzes the content of existing PDF files and performs a sequence of modifications in order to produce a PDF/A compliant document. Features that are not suitable for long-term archiving (such as encryption, obsolete compression schemes, missing fonts, or device-dependent color) are replaced with their PDF/A compliant equivalents. Because the conversion process applies only necessary changes to the source file, the information loss is minimal. Also, because the converter provides a detailed report for each change, it is simple to inspect changes and to determine whether the conversion loss is acceptable. The validation option in PDF/A Manager can be used to quickly determine whether a PDF file fully complies with the PDF/A specification according to the international standard ISO 19005:1/2/3. For files that are not compliant, the validation option can be used to produce a detailed report of compliance violations as well as a list of relevant error objects. Key Functions: - Checks if a PDF file is compliant with PDF/A (ISO 19005:1/2/3) specification. - Converts any PDF to a PDF/A compliant document. - Supports PDF/A-1a, PDF/A-1b, PDF/A-2b - Produces a detailed report of compliance violations and associated PDF objects. - Keeps the required changes a minimum, preserving the consistency of the original. - Tracks all changes to allow for automatic assessment of data loss. - Allows user to customize compliance checks or omit specific changes. - Preserves tags, logical structure, and color information in existing PDF documents. - Offers automatic font substitution, embedding, and subsetting options. - Supports automation and batch operation. PDF/A Converter is designed to be used in unattended mode in high throughput server or batch environments """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_NoConformance = _PDFNetPython.PDFACompliance_e_NoConformance e_Level1A = _PDFNetPython.PDFACompliance_e_Level1A e_Level1B = _PDFNetPython.PDFACompliance_e_Level1B e_Level2A = _PDFNetPython.PDFACompliance_e_Level2A e_Level2B = _PDFNetPython.PDFACompliance_e_Level2B e_Level2U = _PDFNetPython.PDFACompliance_e_Level2U e_Level3A = _PDFNetPython.PDFACompliance_e_Level3A e_Level3B = _PDFNetPython.PDFACompliance_e_Level3B e_Level3U = _PDFNetPython.PDFACompliance_e_Level3U e_Level4 = _PDFNetPython.PDFACompliance_e_Level4 e_Level4E = _PDFNetPython.PDFACompliance_e_Level4E e_Level4F = _PDFNetPython.PDFACompliance_e_Level4F e_PDFA0_1_0 = _PDFNetPython.PDFACompliance_e_PDFA0_1_0 r""" Invalid PDF structure.""" e_PDFA0_1_1 = _PDFNetPython.PDFACompliance_e_PDFA0_1_1 r""" Corrupt document.""" e_PDFA0_1_2 = _PDFNetPython.PDFACompliance_e_PDFA0_1_2 r""" Corrupt content stream.""" e_PDFA0_1_3 = _PDFNetPython.PDFACompliance_e_PDFA0_1_3 r""" Using JPEG2000 compression (PDF 1.4 compatibility).""" e_PDFA0_1_4 = _PDFNetPython.PDFACompliance_e_PDFA0_1_4 r""" Contains compressed object streams (PDF 1.4 compatibility).""" e_PDFA0_1_5 = _PDFNetPython.PDFACompliance_e_PDFA0_1_5 r""" Contains cross-reference streams (PDF 1.4 compatibility).""" e_PDFA1_2_1 = _PDFNetPython.PDFACompliance_e_PDFA1_2_1 r""" Document does not start with % character.""" e_PDFA1_2_2 = _PDFNetPython.PDFACompliance_e_PDFA1_2_2 r""" File header line not followed by % and 4 characters > 127.""" e_PDFA1_3_1 = _PDFNetPython.PDFACompliance_e_PDFA1_3_1 r""" The trailer dictionary does not contain ID.""" e_PDFA1_3_2 = _PDFNetPython.PDFACompliance_e_PDFA1_3_2 r""" Trailer dictionary contains Encrypt.""" e_PDFA1_3_3 = _PDFNetPython.PDFACompliance_e_PDFA1_3_3 r""" Data after last EOF marker.""" e_PDFA1_3_4 = _PDFNetPython.PDFACompliance_e_PDFA1_3_4 r""" Linearized file: ID in 1st page and last trailer are different.""" e_PDFA1_4_1 = _PDFNetPython.PDFACompliance_e_PDFA1_4_1 r""" Subsection header: starting object number and range not separated by a single space.""" e_PDFA1_4_2 = _PDFNetPython.PDFACompliance_e_PDFA1_4_2 r""" 'xref' and cross reference subsection header not separated by a single EOL marker.""" e_PDFA1_6_1 = _PDFNetPython.PDFACompliance_e_PDFA1_6_1 r""" Invalid hexadecimal strings used.""" e_PDFA1_7_1 = _PDFNetPython.PDFACompliance_e_PDFA1_7_1 r""" The 'stream' token is not followed by CR and LF or a single LF.""" e_PDFA1_7_2 = _PDFNetPython.PDFACompliance_e_PDFA1_7_2 r""" The 'endstream' token is not preceded by EOL.""" e_PDFA1_7_3 = _PDFNetPython.PDFACompliance_e_PDFA1_7_3 r""" The value of Length does not match the number of bytes.""" e_PDFA1_7_4 = _PDFNetPython.PDFACompliance_e_PDFA1_7_4 r""" A stream object dictionary contains the F, FFilter, or FDecodeParms keys.""" e_PDFA1_8_1 = _PDFNetPython.PDFACompliance_e_PDFA1_8_1 r""" Object number and generation number are not separated by a single white-space.""" e_PDFA1_8_2 = _PDFNetPython.PDFACompliance_e_PDFA1_8_2 r""" Generation number and 'obj' are not separated by a single white-space.""" e_PDFA1_8_3 = _PDFNetPython.PDFACompliance_e_PDFA1_8_3 r""" Object number not preceded by EOL marker""" e_PDFA1_8_4 = _PDFNetPython.PDFACompliance_e_PDFA1_8_4 r""" 'endobj' not preceded by EOL marker""" e_PDFA1_8_5 = _PDFNetPython.PDFACompliance_e_PDFA1_8_5 r""" 'obj' not followed by EOL marker""" e_PDFA1_8_6 = _PDFNetPython.PDFACompliance_e_PDFA1_8_6 r""" 'endobj' not followed by EOL marker""" e_PDFA1_8_7 = _PDFNetPython.PDFACompliance_e_PDFA1_8_7 r""" Invalid UTF8 string """ e_PDFA1_10_1 = _PDFNetPython.PDFACompliance_e_PDFA1_10_1 r""" Using LZW compression.""" e_PDFA1_11_1 = _PDFNetPython.PDFACompliance_e_PDFA1_11_1 r""" A file specification dictionary contains a non-compliant embedded file (EF key).""" e_PDFA1_11_2 = _PDFNetPython.PDFACompliance_e_PDFA1_11_2 r""" Contains the EmbeddedFiles key""" e_PDFA1_12_1 = _PDFNetPython.PDFACompliance_e_PDFA1_12_1 r""" Array contains more than 8191 elements""" e_PDFA1_12_2 = _PDFNetPython.PDFACompliance_e_PDFA1_12_2 r""" Dictionary contains more than 4095 elements""" e_PDFA1_12_3 = _PDFNetPython.PDFACompliance_e_PDFA1_12_3 r""" Name with more than 127 bytes""" e_PDFA1_12_4 = _PDFNetPython.PDFACompliance_e_PDFA1_12_4 r""" Contains an integer value outside of the allowed range [-2^31, 2^31-1],""" e_PDFA1_12_5 = _PDFNetPython.PDFACompliance_e_PDFA1_12_5 r""" Exceeds the maximum number (8,388,607) of indirect objects in a PDF file.""" e_PDFA1_12_6 = _PDFNetPython.PDFACompliance_e_PDFA1_12_6 r""" The number of nested q/Q operators is greater than 28.""" e_PDFA1_13_1 = _PDFNetPython.PDFACompliance_e_PDFA1_13_1 r""" Optional content (layers) not allowed.""" e_PDFA2_2_1 = _PDFNetPython.PDFACompliance_e_PDFA2_2_1 r""" DestOutputProfile-s in OutputIntents array do not match.""" e_PDFA2_3_2 = _PDFNetPython.PDFACompliance_e_PDFA2_3_2 r""" Not a valid ICC color profile.""" e_PDFA2_3_3 = _PDFNetPython.PDFACompliance_e_PDFA2_3_3 r""" The N entry does not match the number of color components in the embedded ICC profile.""" e_PDFA2_3_3_1 = _PDFNetPython.PDFACompliance_e_PDFA2_3_3_1 r""" Device-specific color space used, but no GTS_PDFA1 OutputIntent.""" e_PDFA2_3_3_2 = _PDFNetPython.PDFACompliance_e_PDFA2_3_3_2 r""" Device-specific color space, does not match OutputIntent.""" e_PDFA2_3_4_1 = _PDFNetPython.PDFACompliance_e_PDFA2_3_4_1 r""" Device-specific color space used in an alternate color space.""" e_PDFA2_4_1 = _PDFNetPython.PDFACompliance_e_PDFA2_4_1 r""" Image with Alternates key.""" e_PDFA2_4_2 = _PDFNetPython.PDFACompliance_e_PDFA2_4_2 r""" Image with OPI key.""" e_PDFA2_4_3 = _PDFNetPython.PDFACompliance_e_PDFA2_4_3 r""" Image with invalid rendering intent.""" e_PDFA2_4_4 = _PDFNetPython.PDFACompliance_e_PDFA2_4_4 r""" Image with Interpolate key set to true.""" e_PDFA2_5_1 = _PDFNetPython.PDFACompliance_e_PDFA2_5_1 r""" XObject with OPI key.""" e_PDFA2_5_2 = _PDFNetPython.PDFACompliance_e_PDFA2_5_2 r""" PostScript XObject.""" e_PDFA2_6_1 = _PDFNetPython.PDFACompliance_e_PDFA2_6_1 r""" Contains a reference XObject.""" e_PDFA2_7_1 = _PDFNetPython.PDFACompliance_e_PDFA2_7_1 r""" Contains an XObject that is not supported (e.g. PostScript XObject).""" e_PDFA2_8_1 = _PDFNetPython.PDFACompliance_e_PDFA2_8_1 r""" Contains an invalid Transfer Curve in the extended graphics state.""" e_PDFA2_9_1 = _PDFNetPython.PDFACompliance_e_PDFA2_9_1 r""" Use of an invalid rendering intent.""" e_PDFA2_10_1 = _PDFNetPython.PDFACompliance_e_PDFA2_10_1 r""" Illegal operator.""" e_PDFA3_2_1 = _PDFNetPython.PDFACompliance_e_PDFA3_2_1 r""" Embedded font is damaged.""" e_PDFA3_3_1 = _PDFNetPython.PDFACompliance_e_PDFA3_3_1 r""" Incompatible CIDSystemInfo entries""" e_PDFA3_3_2 = _PDFNetPython.PDFACompliance_e_PDFA3_3_2 r""" Type 2 CIDFont without CIDToGIDMap""" e_PDFA3_3_3_1 = _PDFNetPython.PDFACompliance_e_PDFA3_3_3_1 r""" CMap not embedded""" e_PDFA3_3_3_2 = _PDFNetPython.PDFACompliance_e_PDFA3_3_3_2 r""" Inconsistent WMode in embedded CMap dictionary and stream.""" e_PDFA3_4_1 = _PDFNetPython.PDFACompliance_e_PDFA3_4_1 r""" The font is not embedded.""" e_PDFA3_5_1 = _PDFNetPython.PDFACompliance_e_PDFA3_5_1 r""" Embedded composite (Type0) font program does not define all font glyphs.""" e_PDFA3_5_2 = _PDFNetPython.PDFACompliance_e_PDFA3_5_2 r""" Embedded Type1 font program does not define all font glyphs.""" e_PDFA3_5_3 = _PDFNetPython.PDFACompliance_e_PDFA3_5_3 r""" Embedded TrueType font program does not define all font glyphs.""" e_PDFA3_5_4 = _PDFNetPython.PDFACompliance_e_PDFA3_5_4 r""" The font descriptor dictionary does not include a CIDSet stream for CIDFont subset.""" e_PDFA3_5_5 = _PDFNetPython.PDFACompliance_e_PDFA3_5_5 r""" The font descriptor dictionary does not include a CharSet string for Type1 font subset.""" e_PDFA3_5_6 = _PDFNetPython.PDFACompliance_e_PDFA3_5_6 r""" CIDSet in subset font is incomplete.""" e_PDFA3_6_1 = _PDFNetPython.PDFACompliance_e_PDFA3_6_1 r""" Widths in embedded font are inconsistent with /Widths entry in the font dictionary.""" e_PDFA3_7_1 = _PDFNetPython.PDFACompliance_e_PDFA3_7_1 r""" A non-symbolic TrueType font must use WinAnsiEncoding or MacRomanEncoding.""" e_PDFA3_7_2 = _PDFNetPython.PDFACompliance_e_PDFA3_7_2 r""" A symbolic TrueType font must not specify encoding.""" e_PDFA3_7_3 = _PDFNetPython.PDFACompliance_e_PDFA3_7_3 r""" A symbolic TrueType font does not have exactly one entry in cmap table.""" e_PDFA4_1 = _PDFNetPython.PDFACompliance_e_PDFA4_1 r""" Transparency used (ExtGState with soft mask).""" e_PDFA4_2 = _PDFNetPython.PDFACompliance_e_PDFA4_2 r""" Transparency used (XObject with soft mask).""" e_PDFA4_3 = _PDFNetPython.PDFACompliance_e_PDFA4_3 r""" Transparency used (Page or Form XObject with transparency group).""" e_PDFA4_4 = _PDFNetPython.PDFACompliance_e_PDFA4_4 r""" Transparency used (Blend mode is not 'Normal').""" e_PDFA4_5 = _PDFNetPython.PDFACompliance_e_PDFA4_5 r""" Transparency used ('CA' value is not 1.0).""" e_PDFA4_6 = _PDFNetPython.PDFACompliance_e_PDFA4_6 r""" Transparency used ('ca' value is not 1.0).""" e_PDFA5_2_1 = _PDFNetPython.PDFACompliance_e_PDFA5_2_1 r""" Unknown annotation type.""" e_PDFA5_2_2 = _PDFNetPython.PDFACompliance_e_PDFA5_2_2 r""" FileAttachment annotation is not permitted.""" e_PDFA5_2_3 = _PDFNetPython.PDFACompliance_e_PDFA5_2_3 r""" Sound annotation is not permitted.""" e_PDFA5_2_4 = _PDFNetPython.PDFACompliance_e_PDFA5_2_4 r""" Movie annotation is not permitted.""" e_PDFA5_2_5 = _PDFNetPython.PDFACompliance_e_PDFA5_2_5 r""" Redact annotation is not permitted.""" e_PDFA5_2_6 = _PDFNetPython.PDFACompliance_e_PDFA5_2_6 r""" 3D annotation is not permitted.""" e_PDFA5_2_7 = _PDFNetPython.PDFACompliance_e_PDFA5_2_7 r""" Caret annotation is not permitted.""" e_PDFA5_2_8 = _PDFNetPython.PDFACompliance_e_PDFA5_2_8 r""" Watermark annotation is not permitted.""" e_PDFA5_2_9 = _PDFNetPython.PDFACompliance_e_PDFA5_2_9 r""" Polygon annotation is not permitted.""" e_PDFA5_2_10 = _PDFNetPython.PDFACompliance_e_PDFA5_2_10 r""" PolyLine annotation is not permitted.""" e_PDFA5_2_11 = _PDFNetPython.PDFACompliance_e_PDFA5_2_11 r""" Screen annotation is not permitted.""" e_PDFA5_3_1 = _PDFNetPython.PDFACompliance_e_PDFA5_3_1 r""" An annotation dictionary contains the CA key with a value other than 1.0.""" e_PDFA5_3_2_1 = _PDFNetPython.PDFACompliance_e_PDFA5_3_2_1 r""" An annotation dictionary is missing F key.""" e_PDFA5_3_2_2 = _PDFNetPython.PDFACompliance_e_PDFA5_3_2_2 r""" An annotation's 'Print' flag is not set.""" e_PDFA5_3_2_3 = _PDFNetPython.PDFACompliance_e_PDFA5_3_2_3 r""" An annotation's 'Hidden' flag is set.""" e_PDFA5_3_2_4 = _PDFNetPython.PDFACompliance_e_PDFA5_3_2_4 r""" An annotation's 'Invisible' flag is set.""" e_PDFA5_3_2_5 = _PDFNetPython.PDFACompliance_e_PDFA5_3_2_5 r""" An annotation's 'NoView' flag is set.""" e_PDFA5_3_3_1 = _PDFNetPython.PDFACompliance_e_PDFA5_3_3_1 r""" An annotation's C entry present but no OutputIntent present""" e_PDFA5_3_3_2 = _PDFNetPython.PDFACompliance_e_PDFA5_3_3_2 r""" An annotation's C entry present but OutputIntent has non-RGB destination profile""" e_PDFA5_3_3_3 = _PDFNetPython.PDFACompliance_e_PDFA5_3_3_3 r""" An annotation's IC entry present but no OutputIntent present""" e_PDFA5_3_3_4 = _PDFNetPython.PDFACompliance_e_PDFA5_3_3_4 r""" An annotation's IC entry present and OutputIntent has non-RGB destination profile""" e_PDFA5_3_4_0 = _PDFNetPython.PDFACompliance_e_PDFA5_3_4_0 r""" Annotation is missing AP entry.""" e_PDFA5_3_4_1 = _PDFNetPython.PDFACompliance_e_PDFA5_3_4_1 r""" An annotation AP dictionary has entries other than the N entry.""" e_PDFA5_3_4_2 = _PDFNetPython.PDFACompliance_e_PDFA5_3_4_2 r""" An annotation AP dictionary does not contain N entry""" e_PDFA5_3_4_3 = _PDFNetPython.PDFACompliance_e_PDFA5_3_4_3 r""" AP has an N entry whose value is invalid.""" e_PDFA6_1_1 = _PDFNetPython.PDFACompliance_e_PDFA6_1_1 r""" Contains an action type that is not permitted.""" e_PDFA6_1_2 = _PDFNetPython.PDFACompliance_e_PDFA6_1_2 r""" Contains a non-predefined Named action.""" e_PDFA6_2_1 = _PDFNetPython.PDFACompliance_e_PDFA6_2_1 r""" The document catalog dictionary contains AA entry.""" e_PDFA6_2_2 = _PDFNetPython.PDFACompliance_e_PDFA6_2_2 r""" Contains the JavaScript key.""" e_PDFA6_2_3 = _PDFNetPython.PDFACompliance_e_PDFA6_2_3 r""" Invalid destination.""" e_PDFA7_2_1 = _PDFNetPython.PDFACompliance_e_PDFA7_2_1 r""" The document catalog does not contain Metadata stream.""" e_PDFA7_2_2 = _PDFNetPython.PDFACompliance_e_PDFA7_2_2 r""" The Metadata object stream contains Filter key.""" e_PDFA7_2_3 = _PDFNetPython.PDFACompliance_e_PDFA7_2_3 r""" The XMP Metadata stream is not valid.""" e_PDFA7_2_4 = _PDFNetPython.PDFACompliance_e_PDFA7_2_4 r""" XMP property not predefined and no extension schema present.""" e_PDFA7_2_5 = _PDFNetPython.PDFACompliance_e_PDFA7_2_5 r""" XMP not included in 'xpacket'.""" e_PDFA7_3_1 = _PDFNetPython.PDFACompliance_e_PDFA7_3_1 r""" Document information entry 'Title' not synchronized with XMP.""" e_PDFA7_3_2 = _PDFNetPython.PDFACompliance_e_PDFA7_3_2 r""" Document information entry 'Author' not synchronized with XMP.""" e_PDFA7_3_3 = _PDFNetPython.PDFACompliance_e_PDFA7_3_3 r""" Document information entry 'Subject' not synchronized with XMP.""" e_PDFA7_3_4 = _PDFNetPython.PDFACompliance_e_PDFA7_3_4 r""" Document information entry 'Keywords' not synchronized with XMP.""" e_PDFA7_3_5 = _PDFNetPython.PDFACompliance_e_PDFA7_3_5 r""" Document information entry 'Creator' not synchronized with XMP.""" e_PDFA7_3_6 = _PDFNetPython.PDFACompliance_e_PDFA7_3_6 r""" Document information entry 'Producer' not synchronized with XMP.""" e_PDFA7_3_7 = _PDFNetPython.PDFACompliance_e_PDFA7_3_7 r""" Document information entry 'CreationDate' not synchronized with XMP.""" e_PDFA7_3_8 = _PDFNetPython.PDFACompliance_e_PDFA7_3_8 r""" Document information entry 'ModDate' not synchronized with XMP.""" e_PDFA7_3_9 = _PDFNetPython.PDFACompliance_e_PDFA7_3_9 r""" Wrong value type for predefined XMP property.""" e_PDFA7_5_1 = _PDFNetPython.PDFACompliance_e_PDFA7_5_1 r""" 'bytes' and 'encoding' attributes are allowed in the header of an XMP packet.""" e_PDFA7_8_1 = _PDFNetPython.PDFACompliance_e_PDFA7_8_1 r""" XMP Extension schema doesn't have a description.""" e_PDFA7_8_2 = _PDFNetPython.PDFACompliance_e_PDFA7_8_2 r""" XMP Extension schema is not valid. Required property 'namespaceURI' might be missing in PDF/A Schema value Type.""" e_PDFA7_8_3 = _PDFNetPython.PDFACompliance_e_PDFA7_8_3 r""" 'pdfaExtension:schemas' not found.""" e_PDFA7_8_4 = _PDFNetPython.PDFACompliance_e_PDFA7_8_4 r""" 'pdfaExtension:schemas' is using a wrong value type.""" e_PDFA7_8_5 = _PDFNetPython.PDFACompliance_e_PDFA7_8_5 r""" 'pdfaExtension:property' not found.""" e_PDFA7_8_6 = _PDFNetPython.PDFACompliance_e_PDFA7_8_6 r""" 'pdfaExtension:property' is using a wrong value type.""" e_PDFA7_8_7 = _PDFNetPython.PDFACompliance_e_PDFA7_8_7 r""" 'pdfaProperty:name' not found.""" e_PDFA7_8_8 = _PDFNetPython.PDFACompliance_e_PDFA7_8_8 r""" 'pdfaProperty:name' is using a wrong value type.""" e_PDFA7_8_9 = _PDFNetPython.PDFACompliance_e_PDFA7_8_9 r""" A description for a property is missing in 'pdfaSchema:property' sequence.""" e_PDFA7_8_10 = _PDFNetPython.PDFACompliance_e_PDFA7_8_10 r""" 'pdfaProperty:valueType' not found.""" e_PDFA7_8_11 = _PDFNetPython.PDFACompliance_e_PDFA7_8_11 r""" The required namespace prefix for extension schema is 'pdfaExtension'.""" e_PDFA7_8_12 = _PDFNetPython.PDFACompliance_e_PDFA7_8_12 r""" The required field namespace prefix is 'pdfaSchema'.""" e_PDFA7_8_13 = _PDFNetPython.PDFACompliance_e_PDFA7_8_13 r""" The required field namespace prefix is 'pdfaProperty'.""" e_PDFA7_8_14 = _PDFNetPython.PDFACompliance_e_PDFA7_8_14 r""" The required field namespace prefix is 'pdfaType'.""" e_PDFA7_8_15 = _PDFNetPython.PDFACompliance_e_PDFA7_8_15 r""" The required field namespace prefix is 'pdfaField'.""" e_PDFA7_8_16 = _PDFNetPython.PDFACompliance_e_PDFA7_8_16 r""" 'pdfaSchema:valueType' not found.""" e_PDFA7_8_17 = _PDFNetPython.PDFACompliance_e_PDFA7_8_17 r""" 'pdfaSchema:valueType' is using a wrong value type.""" e_PDFA7_8_18 = _PDFNetPython.PDFACompliance_e_PDFA7_8_18 r""" Required property 'valueType' missing in PDF/A Schema Value Type.""" e_PDFA7_8_19 = _PDFNetPython.PDFACompliance_e_PDFA7_8_19 r""" 'pdfaType :type' not found.""" e_PDFA7_8_20 = _PDFNetPython.PDFACompliance_e_PDFA7_8_20 r""" 'pdfaType :type' is using a wrong value type.""" e_PDFA7_8_21 = _PDFNetPython.PDFACompliance_e_PDFA7_8_21 r""" 'pdfaType:description' not found.""" e_PDFA7_8_22 = _PDFNetPython.PDFACompliance_e_PDFA7_8_22 r""" 'pdfaType:namespaceURI' not found.""" e_PDFA7_8_23 = _PDFNetPython.PDFACompliance_e_PDFA7_8_23 r""" 'pdfaType:field' is using a wrong value type.""" e_PDFA7_8_24 = _PDFNetPython.PDFACompliance_e_PDFA7_8_24 r""" 'pdfaField:name' not found.""" e_PDFA7_8_25 = _PDFNetPython.PDFACompliance_e_PDFA7_8_25 r""" 'pdfaField:name' is using a wrong value type.""" e_PDFA7_8_26 = _PDFNetPython.PDFACompliance_e_PDFA7_8_26 r""" 'pdfaField:valueType' not found.""" e_PDFA7_8_27 = _PDFNetPython.PDFACompliance_e_PDFA7_8_27 r""" 'pdfaField:valueType' is using a wrong type.""" e_PDFA7_8_28 = _PDFNetPython.PDFACompliance_e_PDFA7_8_28 r""" 'pdfaField:description' not found.""" e_PDFA7_8_29 = _PDFNetPython.PDFACompliance_e_PDFA7_8_29 r""" 'pdfaField:description' is using a wrong type.""" e_PDFA7_8_30 = _PDFNetPython.PDFACompliance_e_PDFA7_8_30 r""" Required description for 'pdfaField::valueType' is missing.""" e_PDFA7_8_31 = _PDFNetPython.PDFACompliance_e_PDFA7_8_31 r""" A property doesn't match its custom schema type.""" e_PDFA7_11_1 = _PDFNetPython.PDFACompliance_e_PDFA7_11_1 r""" Missing PDF/A identifier""" e_PDFA7_11_2 = _PDFNetPython.PDFACompliance_e_PDFA7_11_2 r""" Invalid PDF/A identifier namespace""" e_PDFA7_11_3 = _PDFNetPython.PDFACompliance_e_PDFA7_11_3 r""" Invalid PDF/A conformance level.""" e_PDFA7_11_4 = _PDFNetPython.PDFACompliance_e_PDFA7_11_4 r""" Invalid PDF/A part number.""" e_PDFA7_11_5 = _PDFNetPython.PDFACompliance_e_PDFA7_11_5 r""" Invalid PDF/A amendment identifier.""" e_PDFA9_1 = _PDFNetPython.PDFACompliance_e_PDFA9_1 r""" An interactive form field contains an action.""" e_PDFA9_2 = _PDFNetPython.PDFACompliance_e_PDFA9_2 r""" The NeedAppearances flag in the interactive form dictionary is set to true.""" e_PDFA9_3 = _PDFNetPython.PDFACompliance_e_PDFA9_3 r""" AcroForms contains XFA.""" e_PDFA9_4 = _PDFNetPython.PDFACompliance_e_PDFA9_4 r""" Catalog contains NeedsRendering.""" e_PDFA3_8_1 = _PDFNetPython.PDFACompliance_e_PDFA3_8_1 r""" The font dictionary is missing 'ToUnicode' entry.""" e_PDFA8_2_2 = _PDFNetPython.PDFACompliance_e_PDFA8_2_2 r""" The PDF is not marked as Tagged PDF.""" e_PDFA8_3_3_1 = _PDFNetPython.PDFACompliance_e_PDFA8_3_3_1 r""" Bad StructTreeRoot""" e_PDFA8_3_3_2 = _PDFNetPython.PDFACompliance_e_PDFA8_3_3_2 r""" Each structure element dictionary in the structure hierarchy must have a Type entry with the name value of StructElem.""" e_PDFA8_3_4_1 = _PDFNetPython.PDFACompliance_e_PDFA8_3_4_1 r""" A non-standard structure type does not map to a standard type.""" e_PDFA1_2_3 = _PDFNetPython.PDFACompliance_e_PDFA1_2_3 r""" Bad file header.""" e_PDFA1_10_2 = _PDFNetPython.PDFACompliance_e_PDFA1_10_2 r""" Invalid use of Crypt filter.""" e_PDFA1_10_3 = _PDFNetPython.PDFACompliance_e_PDFA1_10_3 r""" Bad stream Filter.""" e_PDFA1_12_10 = _PDFNetPython.PDFACompliance_e_PDFA1_12_10 r""" Bad Permission Dictionary""" e_PDFA1_13_5 = _PDFNetPython.PDFACompliance_e_PDFA1_13_5 r""" Page dimensions are outside of the allowed range (3-14400).""" e_PDFA2_3_10 = _PDFNetPython.PDFACompliance_e_PDFA2_3_10 r""" Contains DestOutputProfileRef""" e_PDFA2_4_2_10 = _PDFNetPython.PDFACompliance_e_PDFA2_4_2_10 r""" OPM is 1""" e_PDFA2_4_2_11 = _PDFNetPython.PDFACompliance_e_PDFA2_4_2_11 r""" Incorrect colorant specification in DeviceN""" e_PDFA2_4_2_12 = _PDFNetPython.PDFACompliance_e_PDFA2_4_2_12 r""" tintTransform is different in Separations with the same colorant name.""" e_PDFA2_4_2_13 = _PDFNetPython.PDFACompliance_e_PDFA2_4_2_13 r""" alternateSpace is different in Separations with the same colorant name.""" e_PDFA2_5_10 = _PDFNetPython.PDFACompliance_e_PDFA2_5_10 r""" HTP entry in ExtGState.""" e_PDFA2_5_11 = _PDFNetPython.PDFACompliance_e_PDFA2_5_11 r""" Unsupported HalftoneType.""" e_PDFA2_5_12 = _PDFNetPython.PDFACompliance_e_PDFA2_5_12 r""" Uses HalftoneName key.""" e_PDFA2_8_3_1 = _PDFNetPython.PDFACompliance_e_PDFA2_8_3_1 r""" JPEG2000: Only the JPX baseline is supported.""" e_PDFA2_8_3_2 = _PDFNetPython.PDFACompliance_e_PDFA2_8_3_2 r""" JPEG2000: Invalid number of colour channels.""" e_PDFA2_8_3_3 = _PDFNetPython.PDFACompliance_e_PDFA2_8_3_3 r""" JPEG2000: Invalid color space.""" e_PDFA2_8_3_4 = _PDFNetPython.PDFACompliance_e_PDFA2_8_3_4 r""" JPEG2000: The bit-depth JPEG2000 data must be in range 1-38.""" e_PDFA2_8_3_5 = _PDFNetPython.PDFACompliance_e_PDFA2_8_3_5 r""" JPEG2000: All colour channels in the JPEG2000 data must have the same bit-depth.""" e_PDFA2_10_20 = _PDFNetPython.PDFACompliance_e_PDFA2_10_20 r""" Page Group entry is missing in a document without OutputIntent.""" e_PDFA2_10_21 = _PDFNetPython.PDFACompliance_e_PDFA2_10_21 r""" Invalid blend mode.""" e_PDFA11_0_0 = _PDFNetPython.PDFACompliance_e_PDFA11_0_0 r""" Catalog contains Requirements key.""" e_PDFA6_10_0 = _PDFNetPython.PDFACompliance_e_PDFA6_10_0 r""" PresSteps is not allowed""" e_PDFA6_10_1 = _PDFNetPython.PDFACompliance_e_PDFA6_10_1 r""" AlternatePresentations not allowed""" e_PDFA6_2_11_5 = _PDFNetPython.PDFACompliance_e_PDFA6_2_11_5 r""" Some characters map to 0 or FFFE.""" e_PDFA6_2_11_6 = _PDFNetPython.PDFACompliance_e_PDFA6_2_11_6 r""" Some text can't be mapped to Unicode""" e_PDFA6_2_11_7 = _PDFNetPython.PDFACompliance_e_PDFA6_2_11_7 r""" PUA characters are missing ActualText""" e_PDFA6_2_11_8 = _PDFNetPython.PDFACompliance_e_PDFA6_2_11_8 r""" Use of .notdef glyph""" e_PDFA6_9_1 = _PDFNetPython.PDFACompliance_e_PDFA6_9_1 r""" Optional content Missing Name entry""" e_PDFA6_9_3 = _PDFNetPython.PDFACompliance_e_PDFA6_9_3 r""" Optional content Contains AS entry""" e_PDFA8_1 = _PDFNetPython.PDFACompliance_e_PDFA8_1 r""" FileSpec is missing F or UF key""" e_PDFA_3E1 = _PDFNetPython.PDFACompliance_e_PDFA_3E1 r""" Embedded file has no MIME type entry""" e_PDFA_3E1_1 = _PDFNetPython.PDFACompliance_e_PDFA_3E1_1 r""" Embedded file Params has no ModDate entry""" e_PDFA_3E2 = _PDFNetPython.PDFACompliance_e_PDFA_3E2 r""" Embedded file has no AFRelationship""" e_PDFA_3E3 = _PDFNetPython.PDFACompliance_e_PDFA_3E3 r""" Doc catalog is missing AF entry""" e_PDFA_4_6_1_3_4 = _PDFNetPython.PDFACompliance_e_PDFA_4_6_1_3_4 r""" The Info key shall not be present in the trailer dictionary unless there exists a PieceInfo entry in the document catalog dictionary.""" e_PDFA_4_6_1_3_5 = _PDFNetPython.PDFACompliance_e_PDFA_4_6_1_3_5 r""" If a document information dictionary is present, it shall only contain a ModDate entry.""" e_PDFA_4_6_1_6_1_3 = _PDFNetPython.PDFACompliance_e_PDFA_4_6_1_6_1_3 r""" 3D stream shall have a Subtype entry with a value which is either U3D or PRC.""" e_PDFA_4_6_7_3_5 = _PDFNetPython.PDFACompliance_e_PDFA_4_6_7_3_5 r""" Invalid PDF/A revision.""" e_PDFA_4_6_2_5_3 = _PDFNetPython.PDFACompliance_e_PDFA_4_6_2_5_3 r""" HTO entry in ExtGState.""" e_PDFA_4_6_6_3_1 = _PDFNetPython.PDFACompliance_e_PDFA_4_6_6_3_1 r""" A document catalog or a page dictionary contains an AA entry and its value contains key(s) not from the following list: E, X, D, U, Fo and Bl.""" e_PDFA_4_6_1_12_1 = _PDFNetPython.PDFACompliance_e_PDFA_4_6_1_12_1 r""" If the Version key is present in the document catalog dictionary, the first character in its value shall be a 2 (32h) and the second character of its value shall be a PERIOD (2Eh) (decimal point). The third character shall be a decimal digit. The number of characters of the value of the Version key shall be exactly 3.""" e_PDFA_4_6_2_4_2_3 = _PDFNetPython.PDFACompliance_e_PDFA_4_6_2_4_2_3 r""" An ICCBased CMYK color space is identical to the current PDF/A OutputIntent color profile or the current transparency blending color space.""" e_PDFA_4_6_2_2_3 = _PDFNetPython.PDFACompliance_e_PDFA_4_6_2_2_3 r""" A content stream's named resource not defined by a resource dictionary""" e_PDFA_4_6_9_5 = _PDFNetPython.PDFACompliance_e_PDFA_4_6_9_5 r""" Doc catalog is missing EmbeddedFiles key""" e_PDFA_4_6_2_10_6_1 = _PDFNetPython.PDFACompliance_e_PDFA_4_6_2_10_6_1 r""" For all non-symbolic TrueType fonts used for rendering, the embedded TrueType font program shall contain at least Microsoft Unicode (3,1 - Platform ID=3, Encoding ID=1), or Macintosh Roman (1,0 - Platform ID=1, Encoding ID=0) 'cmap' subtable that all necessary glyph lookups are able to be carried out""" e_PDFA_4_6_2_10_6_4 = _PDFNetPython.PDFACompliance_e_PDFA_4_6_2_10_6_4 r""" Symbolic TrueType fonts shall not contain an Encoding entry in the font dictionary, and the 'cmap' subtable in the embedded font program shall either contain the Microsoft Symbol (3,0 - Platform ID=3, Encoding ID=0) or the Mac Roman (1,0 - Platform ID=1, Encoding ID=0) encoding.""" e_PDFA_LAST = _PDFNetPython.PDFACompliance_e_PDFA_LAST
[docs] def SaveAs(self, args): r""" Overload 1: Serializes the converted PDF/A document to a file on disk. Notes: This method assumes that the first parameter passed in PDFACompliance ructor (i.e. the convert parameter) is set to 'true'. :type file_path: string :param file_path: - the output file name. :type linearized: boolean :param linearized: - An optional flag used to specify whether the resulting PDF/A document should be web-optimized (linearized). | Overload 2: Serializes the converted PDF/A document to a memory buffer. Notes: This method assumes that the first parameter passed in PDFACompliance ructor (i.e. the convert parameter) is set to 'true'. :type linearized: boolean :param linearized: - An optional flag used to specify whether the resulting PDF/A document should be web-optimized (linearized). :rtype: std::vector< unsigned char,std::allocator< unsigned char > > :return: The converted document saved as a memory buffer. | Overload 3: Serializes the converted PDF/A document to a memory buffer. Notes: This method assumes that the first parameter passed in PDFACompliance ructor (i.e. the convert parameter) is set to 'true'. :param linearized: - An optional flag used to specify whether the resulting PDF/A document should be web-optimized (linearized). :rtype: std::vector< unsigned char,std::allocator< unsigned char > > :return: The converted document saved as a memory buffer. """ return _PDFNetPython.PDFACompliance_SaveAs(self, args)
[docs] def GetErrorCount(self): r""" :rtype: int :return: The number of compliance violations. """ return _PDFNetPython.PDFACompliance_GetErrorCount(self)
[docs] def GetError(self, idx): r""" :rtype: int :return: The error identifier. :type idx: int :param idx: The index in the array of error code identifiers. The array is indexed starting from zero. :raises: throws an Exception if the index is outside the array bounds. """ return _PDFNetPython.PDFACompliance_GetError(self, idx)
[docs] def GetRefObjCount(self, id): r""" :rtype: int :return: The number of object references associated with a given error. :type id: int :param id: error code identifier (obtained using GetError() method). """ return _PDFNetPython.PDFACompliance_GetRefObjCount(self, id)
[docs] def GetRefObj(self, id, err_idx): r""" :rtype: int :return: A specific object reference associated with a given error type. The return value is a PDF object identifier (i.e. object number for 'pdftron.SDF.Obj)) for the that is associated with the error. :type id: int :param id: error code identifier (obtained using GetError() method). :type err_idx: int :param err_idx: The index in the array of object references. The array is indexed starting from zero. :raises: throws an Exception if the index is outside the array bounds. """ return _PDFNetPython.PDFACompliance_GetRefObj(self, id, err_idx)
[docs] @staticmethod def GetPDFAErrorMessage(id): r""" :type id: int :param id: error code identifier (obtained using GetError() method). :rtype: string :return: A descriptive error message for the given error identifier. """ return _PDFNetPython.PDFACompliance_GetPDFAErrorMessage(id)
[docs] @staticmethod def GetDeclaredConformance(in_doc): r""" Retrieves whether document's XMP metadata claims PDF/A conformance and to what part and level. :type in_doc: :py:class:`PDFDoc` :param in_doc: the document :rtype: int :return: Presumptive PDFA part number and conformance level, as an enumerated value. """ return _PDFNetPython.PDFACompliance_GetDeclaredConformance(in_doc)
__swig_destroy__ = _PDFNetPython.delete_PDFACompliance
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.PDFACompliance_Destroy(self)
def __init__(self, args): _PDFNetPython.PDFACompliance_swiginit(self, _PDFNetPython.new_PDFACompliance(args)) mp_pdfac = property(_PDFNetPython.PDFACompliance_mp_pdfac_get, _PDFNetPython.PDFACompliance_mp_pdfac_set)
# Register PDFACompliance in _PDFNetPython: _PDFNetPython.PDFACompliance_swigregister(PDFACompliance)
[docs] def PDFACompliance_GetPDFAErrorMessage(id): r""" :type id: int :param id: error code identifier (obtained using GetError() method). :rtype: string :return: A descriptive error message for the given error identifier. """ return _PDFNetPython.PDFACompliance_GetPDFAErrorMessage(id)
[docs] def PDFACompliance_GetDeclaredConformance(in_doc): r""" Retrieves whether document's XMP metadata claims PDF/A conformance and to what part and level. :type in_doc: :py:class:`PDFDoc` :param in_doc: the document :rtype: int :return: Presumptive PDFA part number and conformance level, as an enumerated value. """ return _PDFNetPython.PDFACompliance_GetDeclaredConformance(in_doc)
[docs] class AttrObj(object): r""" An application or plug-in extension that processes logical structure can attach additional information, called attributes, to any structure element. The attribute information is held in one or more attribute objects associated with the structure element. An attribute object is a dictionary or stream that includes an entry identifying the application or plug-in that owns the attribute information. Other entries represent the attributes: the keys are attribute names, and values are the corresponding attribute values. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): _PDFNetPython.AttrObj_swiginit(self, _PDFNetPython.new_AttrObj(args))
[docs] def GetOwner(self): r""" :rtype: string :return: The name of the application or plug-in extension owning the attribute data. """ return _PDFNetPython.AttrObj_GetOwner(self)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: Pointer to the underlying SDF/Cos object. """ return _PDFNetPython.AttrObj_GetSDFObj(self)
__swig_destroy__ = _PDFNetPython.delete_AttrObj
# Register AttrObj in _PDFNetPython: _PDFNetPython.AttrObj_swigregister(AttrObj)
[docs] class ClassMap(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def IsValid(self): r""" :rtype: boolean :return: true if this is a valid (non-null) ClassMap, false otherwise. If the function returns false the underlying SDF/Cos object is null or is not valid and the ClassMap object should be treated as a null object. """ return _PDFNetPython.ClassMap_IsValid(self)
[docs] def GetSDFObj(self): r""" Returns the ClassMap dictionary. :rtype: :py:class:`Obj` :return: the object to the underlying SDF/Cos object. """ return _PDFNetPython.ClassMap_GetSDFObj(self)
def __init__(self, args): _PDFNetPython.ClassMap_swiginit(self, _PDFNetPython.new_ClassMap(args)) __swig_destroy__ = _PDFNetPython.delete_ClassMap
# Register ClassMap in _PDFNetPython: _PDFNetPython.ClassMap_swigregister(ClassMap)
[docs] class ContentItem(object): r""" Content items are graphical objects that exist in the document independently of the structure tree but are associated with structure elements. Content items are leaf nodes of the structure tree. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_MCR = _PDFNetPython.ContentItem_e_MCR r""" marked-content reference.""" e_MCID = _PDFNetPython.ContentItem_e_MCID r""" marked-content identifier.""" e_OBJR = _PDFNetPython.ContentItem_e_OBJR r""" object reference dictionary.""" e_Unknown = _PDFNetPython.ContentItem_e_Unknown r""" unknown content type."""
[docs] def GetType(self): r""" :rtype: int :return: the content item type. """ return _PDFNetPython.ContentItem_GetType(self)
[docs] def GetParent(self): r"""Find the parent structure element.""" return _PDFNetPython.ContentItem_GetParent(self)
[docs] def GetPage(self): r""" The page on which the marked content is drawn, whether directly as part of page content or indirectly by being in a Form XObject or annotation drawn on that page. """ return _PDFNetPython.ContentItem_GetPage(self)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: Pointer to the underlying SDF/Cos object. """ return _PDFNetPython.ContentItem_GetSDFObj(self)
[docs] def GetMCID(self): r""" :rtype: int :return: mcid (marked-content identifier). Notes: this method only applies to content items with types e_MCR or e_MCID. """ return _PDFNetPython.ContentItem_GetMCID(self)
[docs] def GetContainingStm(self): r""" :rtype: :py:class:`Obj` :return: The stream object that contains the marked-content sequence. The function will return a non-NULL object only if the marked-content sequence resides in a content stream other than the content stream for the page (e.g. in a form XObject). Notes: this method only applies to content items with type e_MCR. """ return _PDFNetPython.ContentItem_GetContainingStm(self)
[docs] def GetStmOwner(self): r""" :rtype: :py:class:`Obj` :return: NULL or the PDF object owning the stream returned by GetContainingStm() (e.g. the annotation to which an appearance stream belongs). Notes: this method only applies to content items with type e_MCR. """ return _PDFNetPython.ContentItem_GetStmOwner(self)
[docs] def GetRefObj(self): r""" :rtype: :py:class:`Obj` :return: The referenced object. Notes: this method only applies to content items with type e_OBJR. """ return _PDFNetPython.ContentItem_GetRefObj(self)
def __init__(self, args): _PDFNetPython.ContentItem_swiginit(self, _PDFNetPython.new_ContentItem(args)) mp_item = property(_PDFNetPython.ContentItem_mp_item_get, _PDFNetPython.ContentItem_mp_item_set) __swig_destroy__ = _PDFNetPython.delete_ContentItem
# Register ContentItem in _PDFNetPython: _PDFNetPython.ContentItem_swigregister(ContentItem)
[docs] class RoleMap(object): r""" RoleMap is a dictionary that maps the names of structure types used in the document to their approximate equivalents in the set of standard structure types. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def IsValid(self): r""" :rtype: boolean :return: true if this is a valid (non-null) RoleMap, false otherwise. If the function returns false the underlying SDF/Cos object is null or is not valid and the RoleMap should be treated as NULL object. """ return _PDFNetPython.RoleMap_IsValid(self)
[docs] def GetDirectMap(self, type): r""" :rtype: string :return: The direct mapping of given StructElement type, or NULL if such mapping is not defined. :type type: string :param type: element type """ return _PDFNetPython.RoleMap_GetDirectMap(self, type)
[docs] def GetSDFObj(self): r""" Returns the RoleMap dictionary. :rtype: :py:class:`Obj` :return: the object to the underlying SDF/Cos dictionary. """ return _PDFNetPython.RoleMap_GetSDFObj(self)
def __init__(self, args): _PDFNetPython.RoleMap_swiginit(self, _PDFNetPython.new_RoleMap(args)) __swig_destroy__ = _PDFNetPython.delete_RoleMap
# Register RoleMap in _PDFNetPython: _PDFNetPython.RoleMap_swigregister(RoleMap)
[docs] class STree(object): r""" STree is the root of the structure tree, which is a central repository for information related to a PDF document's logical structure. There is at most one structure tree in each document. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc): r""" Create a structure tree if it is missing, else return the existing structure tree :type doc: :py:class:`PDFDoc` :param doc: the document in which to create or get the structure tree from :rtype: :py:class:`STree` :return: structure tree of the document """ return _PDFNetPython.STree_Create(doc)
[docs] def Insert(self, kid, insert_before): r""" Inserts the specified kid element after the given position as a kid of the specified structure tree root. :type kid: :py:class:`SElement` :param kid: The kid element to insert. :type insert_before: int :param insert_before: The position after which the kid is inserted. If element currently has no kids, insert_before is ignored. """ return _PDFNetPython.STree_Insert(self, kid, insert_before)
[docs] def IsValid(self): r""" :rtype: boolean :return: true if this is a valid STree object, false otherwise. """ return _PDFNetPython.STree_IsValid(self)
[docs] def GetNumKids(self): r""" :rtype: int :return: The number of kids of the structure tree root. """ return _PDFNetPython.STree_GetNumKids(self)
[docs] def GetKid(self, index): r""" :rtype: :py:class:`SElement` :return: The kid at an array index in the structure tree root. :type index: int :param index: The index of the kid to obtain. """ return _PDFNetPython.STree_GetKid(self, index)
[docs] def GetElement(self, id_buf, id_buf_sz): r""" :rtype: :py:class:`SElement` :return: the element associated with the given ID. :type id_buf: string :param id_buf: A pointer to a buffer containing the ID to search for. :type id_buf_sz: int :param id_buf_sz: The number of characters in id_buf. """ return _PDFNetPython.STree_GetElement(self, id_buf, id_buf_sz)
[docs] def GetRoleMap(self): r""" :rtype: :py:class:`RoleMap` :return: the RoleMap object from the structure tree root. """ return _PDFNetPython.STree_GetRoleMap(self)
[docs] def GetClassMap(self): r""" :rtype: :py:class:`ClassMap` :return: the ClassMap object from the structure tree root. """ return _PDFNetPython.STree_GetClassMap(self)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: Pointer to the underlying SDF/Cos object. """ return _PDFNetPython.STree_GetSDFObj(self)
def __init__(self, args): _PDFNetPython.STree_swiginit(self, _PDFNetPython.new_STree(args)) __swig_destroy__ = _PDFNetPython.delete_STree
# Register STree in _PDFNetPython: _PDFNetPython.STree_swigregister(STree)
[docs] def STree_Create(doc): r""" Create a structure tree if it is missing, else return the existing structure tree :type doc: :py:class:`PDFDoc` :param doc: the document in which to create or get the structure tree from :rtype: :py:class:`STree` :return: structure tree of the document """ return _PDFNetPython.STree_Create(doc)
[docs] class SElement(object): r""" SElement represents PDF structural elements, which are nodes in a tree structure, defining a PDF document's logical structure. Unlike the StructTree, SElement can have two different kinds of children: another SElement or a ContentItem (which can be marked content (MC), or a PDF object reference (OBJR)). """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, struct_type): r""" Creates a new SElement. :type doc: :py:class:`PDFDoc` :param doc: :type struct_type: string :param struct_type: """ return _PDFNetPython.SElement_Create(doc, struct_type)
[docs] def Insert(self, kid, insert_before): r""" Inserts the specified kid SElement into this element. :type insert_before: int :param insert_before: The position after which the kid is inserted. If element currently has no kids, insert_before is ignored. """ return _PDFNetPython.SElement_Insert(self, kid, insert_before)
[docs] def CreateContentItem(self, doc, page, insert_before=-1): r""" :type doc: :py:class:`PDFDoc` :param doc: The document in which the new ContentItem will be created in. :type page: :py:class:`Page` :param page: The page object to insert the ContentItem in. :type insert_before: int :param insert_before: The position after which the kid is inserted. If element currently has no kids, insert_before is ignored. """ return _PDFNetPython.SElement_CreateContentItem(self, doc, page, insert_before)
[docs] def IsValid(self): r""" :rtype: boolean :return: true if this is a valid structure element object, false otherwise. """ return _PDFNetPython.SElement_IsValid(self)
[docs] def GetType(self): r""" :rtype: string :return: The element's structural element type. The type corresponds to the 'S' (i.e. subtype) key in the structure element dictionary. The type identifies the nature of the structure element and its role within the document (such as a chapter, paragraph, or footnote). """ return _PDFNetPython.SElement_GetType(self)
[docs] def GetNumKids(self): r""" :rtype: int :return: The number of direct kids. """ return _PDFNetPython.SElement_GetNumKids(self)
[docs] def IsContentItem(self, index): r""" :rtype: boolean :return: true if the kid at a given array index is a content item, false otherwise. :type index: int :param index: The index of the kid type to obtain. To retrieve a content item at a given array index use GetAsContentItem(index), otherwise use GetAsStructElem(index) """ return _PDFNetPython.SElement_IsContentItem(self, index)
[docs] def GetAsContentItem(self, index): r""" :rtype: :py:class:`ContentItem` :return: The kid at a given array index assuming that the kid is a ContentItem. Notes: use IsContentItem(index) prior to calling this method to make sure that the kid is indeed a ContentItem. :type index: int :param index: The index of the kid to obtain. """ return _PDFNetPython.SElement_GetAsContentItem(self, index)
[docs] def GetAsStructElem(self, index): r""" :rtype: :py:class:`SElement` :return: The kid at a given array index assuming that the kid is a SElement. Notes: use IsContentItem(index) prior to calling this method to make sure that the kid is not a ContentItem and is another SElement. :type index: int :param index: The index of the kid to obtain. """ return _PDFNetPython.SElement_GetAsStructElem(self, index)
[docs] def GetParent(self): r""" :rtype: :py:class:`SElement` :return: The immediate ancestor element of the specified element in the structure tree. Notes: If the element's parent is the structure tree root, the returned SElement will be not valid (i.e. element.IsValid() -> false) and the underlying SDF/Cos object will be NULL. """ return _PDFNetPython.SElement_GetParent(self)
[docs] def GetStructTreeRoot(self): r""" :rtype: :py:class:`STree` :return: The structure tree root of the document that directly or indirectly contains this element. """ return _PDFNetPython.SElement_GetStructTreeRoot(self)
[docs] def HasTitle(self): r""" :rtype: boolean :return: if this SElement has title. The title of the structure element, a text string representing it in human-readable form. """ return _PDFNetPython.SElement_HasTitle(self)
[docs] def GetTitle(self): r""" :rtype: string :return: The title of this structure element. """ return _PDFNetPython.SElement_GetTitle(self)
[docs] def GetID(self): r""" :rtype: :py:class:`Obj` :return: the ID of an element, or NULL if the ID is not defined. """ return _PDFNetPython.SElement_GetID(self)
[docs] def HasActualText(self): r""" :rtype: boolean :return: if this structure element defines ActualText. ActualText is an exact replacement for the structure element and its children. This replacement text is useful when extracting the document's contents in support of accessibility to users with disabilities or for other purposes. """ return _PDFNetPython.SElement_HasActualText(self)
[docs] def GetActualText(self): r""" :rtype: string :return: The ActualText associated with this element. Notes: The ActualText can be defined as an empty string. To differentiate between an ActualText string of zero length and no ActualText being defined, use HasActualText(). """ return _PDFNetPython.SElement_GetActualText(self)
[docs] def HasAlt(self): r""" :rtype: boolean :return: if this structure element defines Alt text. Alt text is an alternate description of the structure element and its children in human-readable form, which is useful when extracting the document's contents in support of accessibility. """ return _PDFNetPython.SElement_HasAlt(self)
[docs] def GetAlt(self): r""" :rtype: string :return: The alternate text associated with this element. Notes: The Alt text can be defined as an empty string. To differentiate between an Alt text string of zero length and no Alt text being defined, use HasAlt(). """ return _PDFNetPython.SElement_GetAlt(self)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: Pointer to the underlying SDF/Cos object. """ return _PDFNetPython.SElement_GetSDFObj(self)
def __init__(self, args): _PDFNetPython.SElement_swiginit(self, _PDFNetPython.new_SElement(args)) mp_elem = property(_PDFNetPython.SElement_mp_elem_get, _PDFNetPython.SElement_mp_elem_set) __swig_destroy__ = _PDFNetPython.delete_SElement
# Register SElement in _PDFNetPython: _PDFNetPython.SElement_swigregister(SElement)
[docs] def SElement_Create(doc, struct_type): r""" Creates a new SElement. :type doc: :py:class:`PDFDoc` :param doc: :type struct_type: string :param struct_type: """ return _PDFNetPython.SElement_Create(doc, struct_type)
[docs] class Bookmark(object): r""" A %PDF document may optionally display a document outline on the screen, allowing the user to navigate interactively from one part of the document to another. The outline consists of a tree-structured hierarchy of Bookmarks (sometimes called outline items), which serve as a 'visual table of contents' to display the document's structure to the user. Each Bookmark has a title that appears on screen, and an Action that specifies what happens when a user clicks on the Bookmark. The typical action for a user-created Bookmark is to move to another location in the current document, although any action (see PDF::Action) can be specified. Bookmark is a utility class used to simplify work with %PDF bookmarks (or outlines; see section 8.2.2 'Document Outline' in %PDF Reference Manual for more details). """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(in_doc, in_title): r""" Creates a new valid Bookmark with given title in the specified document. :type in_doc: :py:class:`PDFDoc` :param in_doc: The document in which a Bookmark is to be created. :type in_title: string :param in_title: The title string value of the new Bookmark. :rtype: :py:class:`Bookmark` :return: The new Bookmark. Notes: The new Bookmark is not linked to the outline tree. Use AddChild()/AddNext()/AddPrev() methods in order to link the Bookmark to the outline tree """ return _PDFNetPython.Bookmark_Create(in_doc, in_title)
def __eq__(self, in_bookmark): r""" Compares two Bookmark objects for equality. :type in_bookmark: :py:class:`Bookmark` :param in_bookmark: A reference to an existing Bookmark object. :rtype: boolean :return: True if the both Bookmarks share the same underlying SDF/Cos object; otherwise false. """ return _PDFNetPython.Bookmark___eq__(self, in_bookmark)
[docs] def IsValid(self): r""" Indicates whether the Bookmark is valid (non-null). :rtype: boolean :return: True if this is a valid (non-null) Bookmark; otherwise false. Notes: If this method returns false the underlying SDF/Cos object is null and the Bookmark object should be treated as null as well. """ return _PDFNetPython.Bookmark_IsValid(self)
[docs] def HasChildren(self): r""" Indicates whether the Bookmark has children. :rtype: boolean :return: True if the Bookmark has children; otherwise false. """ return _PDFNetPython.Bookmark_HasChildren(self)
[docs] def GetNext(self): r""" Returns the Bookmark's next (right) sibling. :rtype: :py:class:`Bookmark` :return: the Bookmark's next (right) sibling. """ return _PDFNetPython.Bookmark_GetNext(self)
[docs] def GetPrev(self): r""" Returns the Bookmark's previous (left) sibling. :rtype: :py:class:`Bookmark` :return: The Bookmark's previous (left) sibling. """ return _PDFNetPython.Bookmark_GetPrev(self)
[docs] def GetFirstChild(self): r""" Returns the Bookmark's first child. :rtype: :py:class:`Bookmark` :return: The Bookmark's first child. """ return _PDFNetPython.Bookmark_GetFirstChild(self)
[docs] def GetLastChild(self): r""" Returns the Bookmark's last child. :rtype: :py:class:`Bookmark` :return: The Bookmark's last child. """ return _PDFNetPython.Bookmark_GetLastChild(self)
[docs] def GetParent(self): r""" Returns the Bookmark's parent Bookmark. :rtype: :py:class:`Bookmark` :return: The Bookmark's parent Bookmark. """ return _PDFNetPython.Bookmark_GetParent(self)
[docs] def Find(self, in_title): r""" Returns the Bookmark specified by the given title string. :type in_title: string :param in_title: The title string value of the Bookmark to find. :rtype: :py:class:`Bookmark` :return: A Bookmark matching the title string value specified. """ return _PDFNetPython.Bookmark_Find(self, in_title)
[docs] def AddChild(self, args): r""" Overload 1: Adds a new Bookmark as the new last child of this Bookmark. :type in_title: string :param in_title: The title string value of the new Bookmark. :rtype: :py:class:`Bookmark` :return: The newly created child Bookmark. Notes: If this Bookmark previously had no children, it will be open after the child is added. | Overload 2: Adds the specified Bookmark as the new last child of this Bookmark. :type in_bookmark: :py:class:`Bookmark` :param in_bookmark: The Bookmark object to be added as a last child of this Bookmark. Notes: Parameter in_bookmark must not be linked to a bookmark tree. If this Bookmark previously had no children, it will be open after the child is added. """ return _PDFNetPython.Bookmark_AddChild(self, args)
[docs] def AddNext(self, args): r""" Overload 1: Adds a new Bookmark to the tree containing this Bookmark, as the new right sibling. :type in_title: string :param in_title: The title string value of the new Bookmark. :rtype: :py:class:`Bookmark` :return: The newly created sibling Bookmark. | Overload 2: Adds the specified Bookmark as the new right sibling to this Bookmark, adjusting the tree containing this Bookmark appropriately. :type in_bookmark: :py:class:`Bookmark` :param in_bookmark: The Bookmark object to be added to this Bookmark. Notes: Parameter in_bookmark must not be linked to a bookmark tree. """ return _PDFNetPython.Bookmark_AddNext(self, args)
[docs] def AddPrev(self, args): r""" Overload 1: Adds a new Bookmark to the tree containing this Bookmark, as the new left sibling. :type in_title: string :param in_title: The title string value of the new Bookmark. :rtype: :py:class:`Bookmark` :return: The newly created sibling Bookmark. | Overload 2: Adds the specified Bookmark as the new left sibling to this Bookmark, adjusting the tree containing this Bookmark appropriately. :type in_bookmark: :py:class:`Bookmark` :param in_bookmark: The Bookmark object to be added to this Bookmark. Notes: Parameter in_bookmark must not be linked to a bookmark tree. """ return _PDFNetPython.Bookmark_AddPrev(self, args)
[docs] def Delete(self): r"""Removes the Bookmark's subtree from the bookmark tree containing it.""" return _PDFNetPython.Bookmark_Delete(self)
[docs] def GetIndent(self): r""" Returns the indentation level of the Bookmark in its containing tree. :rtype: int :return: The indentation level of the Bookmark in its containing tree. Notes: The root level has an indentation level of zero. """ return _PDFNetPython.Bookmark_GetIndent(self)
[docs] def IsOpen(self): r""" Indicates whether the Bookmark is open. :rtype: boolean :return: True if this Bookmark is open; otherwise false. Notes: An open Bookmark shows all its children. """ return _PDFNetPython.Bookmark_IsOpen(self)
[docs] def SetOpen(self, in_open): r""" Opens or closes the Bookmark. :type in_open: boolean :param in_open: Boolean value that contains the status. If true, the Bookmark is opened. Otherwise the Bookmark is closed. Notes: An opened Bookmark shows its children, while a closed Bookmark does not. """ return _PDFNetPython.Bookmark_SetOpen(self, in_open)
[docs] def GetOpenCount(self): r""" Returns the number of opened bookmarks in this subtree. :rtype: int :return: The number of opened bookmarks in this subtree (not including this Bookmark). If the item is closed, a negative integer whose absolute value specifies how many descendants would appear if the item were reopened. """ return _PDFNetPython.Bookmark_GetOpenCount(self)
[docs] def GetTitle(self): r""" Returns the Bookmark's title string. :rtype: string :return: The Bookmark's title string). """ return _PDFNetPython.Bookmark_GetTitle(self)
[docs] def GetTitleObj(self): r""" Returns the Bookmark's title string object. :rtype: :py:class:`Obj` :return: The Bookmark's title string object. """ return _PDFNetPython.Bookmark_GetTitleObj(self)
[docs] def SetTitle(self, title): r""" Sets the Bookmark's title string. :type title: string :param title: The new title string for the bookmark. """ return _PDFNetPython.Bookmark_SetTitle(self, title)
[docs] def GetAction(self): r""" Returns the Bookmark's action. :rtype: :py:class:`Action` :return: The Bookmark's action. """ return _PDFNetPython.Bookmark_GetAction(self)
[docs] def SetAction(self, in_action): r""" Sets the Bookmark's action. :type in_action: :py:class:`Action` :param in_action: The new Action for the Bookmark. """ return _PDFNetPython.Bookmark_SetAction(self, in_action)
[docs] def RemoveAction(self): r"""Removes the Bookmark's action.""" return _PDFNetPython.Bookmark_RemoveAction(self)
[docs] def GetFlags(self): r""" Returns the Bookmark's flags. :rtype: int :return: The flags of the Bookmark object. Bit 1 (least-significant bit) indicates italic font whereas bit 2 indicates bold font. Therefore, 0 indicates normal, 1 is italic, 2 is bold, and 3 is bold-italic. """ return _PDFNetPython.Bookmark_GetFlags(self)
[docs] def SetFlags(self, in_flags): r""" Sets the Bookmark's flags. :type in_flags: int :param in_flags: The new bookmark flags. Bit 1 (the least-significant bit) indicates italic font whereas bit 2 indicates bold font. Therefore, 0 indicates normal, 1 is italic, 2 is bold, and 3 is bold-italic. """ return _PDFNetPython.Bookmark_SetFlags(self, in_flags)
[docs] def GetColor(self): r""" Returns the Bookmark's RGB color value. :param out_r: Reference to a variable that receives the red component of the color. :param out_g: Reference to a variable that receives the green component of the color. :param out_b: Reference to a variable that receives the blue component of the color. Notes: The three numbers out_r, out_g, and out_b are in the range 0.0 to 1.0, representing the components in the DeviceRGB color space of the color to be used for the Bookmark's text. Example: .. code-block:: c++ double red, green, blue; bookmark.GetColor(red, green, blue); """ return _PDFNetPython.Bookmark_GetColor(self)
[docs] def SetColor(self, in_r=0.0, in_g=0.0, in_b=0.0): r""" Sets the Bookmark's color value. :type in_r: double :param in_r: The red component of the color. :type in_g: double :param in_g: The green component of the color. :type in_b: double :param in_b: The blue component of the color. Notes: The three numbers in_r, in_g, and in_b are in the range 0.0 to 1.0, representing the components in the DeviceRGB color space of the color to be used for the Bookmark's text. Default color value is black, [0.0 0.0 0.0]. """ return _PDFNetPython.Bookmark_SetColor(self, in_r, in_g, in_b)
[docs] def GetSDFObj(self): r""" Returns the underlying SDF/Cos object. :rtype: :py:class:`Obj` :return: The underlying SDF/Cos object. Notes: A null (non-valid) bookmark returns a null object. """ return _PDFNetPython.Bookmark_GetSDFObj(self)
[docs] @staticmethod def CreateInternal(impl): return _PDFNetPython.Bookmark_CreateInternal(impl)
[docs] def GetHandleInternal(self): return _PDFNetPython.Bookmark_GetHandleInternal(self)
def __init__(self, args): _PDFNetPython.Bookmark_swiginit(self, _PDFNetPython.new_Bookmark(args)) mp_obj = property(_PDFNetPython.Bookmark_mp_obj_get, _PDFNetPython.Bookmark_mp_obj_set) __swig_destroy__ = _PDFNetPython.delete_Bookmark
# Register Bookmark in _PDFNetPython: _PDFNetPython.Bookmark_swigregister(Bookmark)
[docs] def Bookmark_Create(in_doc, in_title): r""" Creates a new valid Bookmark with given title in the specified document. :type in_doc: :py:class:`PDFDoc` :param in_doc: The document in which a Bookmark is to be created. :type in_title: string :param in_title: The title string value of the new Bookmark. :rtype: :py:class:`Bookmark` :return: The new Bookmark. Notes: The new Bookmark is not linked to the outline tree. Use AddChild()/AddNext()/AddPrev() methods in order to link the Bookmark to the outline tree """ return _PDFNetPython.Bookmark_Create(in_doc, in_title)
[docs] def Bookmark_CreateInternal(impl): return _PDFNetPython.Bookmark_CreateInternal(impl)
[docs] class ContentReplacer(object): r""" ContentReplacer is a utility class for replacing content (text and images) in existing PDF (template) documents. Users can replace content in a PDF page using the following operations: - Replace an image that exists in a target rectangle with a replacement image. - Replace text that exists in a target rectangle with replacement text. - Replace all instances of a specially marked string with replacement string. The following code replaces an image in a target region. This code also replaces the text "[NAME]" and "[JOB_TITLE]" with "John Smith" and "Software Developer" respectively. Notice the square braces ('[' and ']') on the target strings in the original PDFDoc. These square braces are not included in the actual function calls below, as they're implicitly added. .. code-block:: c++ PDFDoc doc("../../TestFiles/BusinessCardTemplate.pdf"); doc.InitSecurityHandler(); ContentReplacer replacer; Page page = doc.GetPage(1); Image img = Image::Create(doc, "../../TestFiles/peppers.jpg"); replacer.AddImage(page.GetMediaBox(), img.GetSDFObj()); replacer.AddString("NAME", "John Smith"); replacer.AddString("JOB_TITLE", "Software Developer"); replacer.Process(page); """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r""" Create a new ContentReplacer object, to which replacement rules will be added. The same object can be used to 'Process' multiple pages. """ _PDFNetPython.ContentReplacer_swiginit(self, _PDFNetPython.new_ContentReplacer()) __swig_destroy__ = _PDFNetPython.delete_ContentReplacer
[docs] def AddImage(self, target_region, replacement_image): r""" Replace the image that best fits into 'target_region' with 'replacement_image'. :type target_region: :py:class:`Rect` :param target_region: - The rectangle defining the area in which an image that best fits the rectangle will be replaced by 'replacement_image'. :type replacement_image: :py:class:`Obj` :param replacement_image: - The 'SDF.Obj' of a 'PDF.Image' object. Notes: The best fit is the image that closest matches 'target_region'. For example if there are two images on the page, one taking up all of the page, and the other smaller, and the smaller one has similar dimensions and position of 'target_region', then the smaller image would be replaced, not the larger. Furthermore, if 'target_region' encloses multiple images, then only the image with the largest area in 'target_region' will be replaced. """ return _PDFNetPython.ContentReplacer_AddImage(self, target_region, replacement_image)
[docs] def AddText(self, target_region, replacement_text): r""" All text inside 'target_region' will be deleted and replaced with 'replacement_text'. :type target_region: :py:class:`Rect` :param target_region: - The rectangle defining the area in which all text will be replaced by 'replacement_text'. :type replacement_text: string :param replacement_text: - The new text that will replace the existing text in 'target_region'. Notes: The 'replacement_text' will be styled in the same font/color/style that is used by the original text. If there are multiple font styles, the most prevalent style will be used. Also, the 'replacement_text' will wrap within the 'target_region', but if it is too long, the overflow text will not be visible, and no surrounding content will be affected. """ return _PDFNetPython.ContentReplacer_AddText(self, target_region, replacement_text)
[docs] def AddString(self, template_text, replacement_text): r""" Any text of the form "[template_text]" will be replaced by "replacement_text". :type template_text: string :param template_text: - The text to remove. :type replacement_text: string :param replacement_text: - The new text that will appear in place of 'template_text'. Notes: Only text wrapped in '[' and ']' will be checked, and if it matches 'template_text', then 'template_text' and the surrounding square braces will be replaced by 'replacement_text'. For example AddString("TITLE", "Doctor") will replace any text consisting of "[TITLE]" with "Doctor". """ return _PDFNetPython.ContentReplacer_AddString(self, template_text, replacement_text)
[docs] def SetMatchStrings(self, start_str, end_str): r""" Change the delimiters from '[' and ']' to arbitary strings. :type start_str: string :param start_str: - The starting delimiter string. :type end_str: string :param end_str: - The ending delimiter string. Notes: While empty strings are allowed as delimiters, a warning is displayed. Otherwise there are no restrictions. For example, after SetMatchStrings("<<", ">>"), AddString("TITLE", "Doctor") will replace any text consisting of "<<TITLE>>" with "Doctor". Similarly, after SetMatchStrings("Beginning...", "...ending."), AddString("TITLE", "Doctor") will replace "Beginning...TITLE...ending." with "Doctor". """ return _PDFNetPython.ContentReplacer_SetMatchStrings(self, start_str, end_str)
[docs] def Process(self, page): r""" Apply the replacement instructions to the target page. Subsequent calls to 'Process' can be made on other pages, and it will apply the same rules. :type page: :py:class:`Page` :param page: - The page to apply the content replacement instructions to. """ return _PDFNetPython.ContentReplacer_Process(self, page)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.ContentReplacer_Destroy(self)
mp_impl = property(_PDFNetPython.ContentReplacer_mp_impl_get, _PDFNetPython.ContentReplacer_mp_impl_set)
# Register ContentReplacer in _PDFNetPython: _PDFNetPython.ContentReplacer_swigregister(ContentReplacer)
[docs] class DiffOptions(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): _PDFNetPython.DiffOptions_swiginit(self, _PDFNetPython.new_DiffOptions()) __swig_destroy__ = _PDFNetPython.delete_DiffOptions
[docs] def GetAddGroupAnnots(self): r""" Gets the value AddGroupAnnots from the options object Whether we should add an annot layer indicating the difference regions :rtype: boolean :return: a bool, the current value for AddGroupAnnots. """ return _PDFNetPython.DiffOptions_GetAddGroupAnnots(self)
[docs] def SetAddGroupAnnots(self, value): r""" Sets the value for AddGroupAnnots in the options object Whether we should add an annot layer indicating the difference regions :type value: boolean :param value:: the new value for AddGroupAnnots :rtype: :py:class:`DiffOptions` :return: this object, for call chaining """ return _PDFNetPython.DiffOptions_SetAddGroupAnnots(self, value)
[docs] def GetBlendMode(self): r""" Gets the value BlendMode from the options object How the two colors should be blended. :rtype: GState::BlendMode :return: a GState::BlendMode, the current value for BlendMode. """ return _PDFNetPython.DiffOptions_GetBlendMode(self)
[docs] def SetBlendMode(self, value): r""" Sets the value for BlendMode in the options object How the two colors should be blended. :type value: GState::BlendMode :param value:: the new value for BlendMode :rtype: :py:class:`DiffOptions` :return: this object, for call chaining """ return _PDFNetPython.DiffOptions_SetBlendMode(self, value)
[docs] def GetColorA(self): r""" Gets the value ColorA from the options object The difference color for the first page. :rtype: :py:class:`ColorPt` :return: a ColorPt, the current value for ColorA. """ return _PDFNetPython.DiffOptions_GetColorA(self)
[docs] def SetColorA(self, value): r""" Sets the value for ColorA in the options object The difference color for the first page. :type value: :py:class:`ColorPt` :param value:: the new value for ColorA :rtype: :py:class:`DiffOptions` :return: this object, for call chaining """ return _PDFNetPython.DiffOptions_SetColorA(self, value)
[docs] def GetColorB(self): r""" Gets the value ColorB from the options object The difference color for the second page :rtype: :py:class:`ColorPt` :return: a ColorPt, the current value for ColorB. """ return _PDFNetPython.DiffOptions_GetColorB(self)
[docs] def SetColorB(self, value): r""" Sets the value for ColorB in the options object The difference color for the second page :type value: :py:class:`ColorPt` :param value:: the new value for ColorB :rtype: :py:class:`DiffOptions` :return: this object, for call chaining """ return _PDFNetPython.DiffOptions_SetColorB(self, value)
[docs] def GetInternalObj(self): return _PDFNetPython.DiffOptions_GetInternalObj(self)
# Register DiffOptions in _PDFNetPython: _PDFNetPython.DiffOptions_swigregister(DiffOptions)
[docs] class TextDiffOptions(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): _PDFNetPython.TextDiffOptions_swiginit(self, _PDFNetPython.new_TextDiffOptions()) __swig_destroy__ = _PDFNetPython.delete_TextDiffOptions
[docs] def GetColorA(self): r""" Gets the value ColorA from the options object The difference color for deletions :rtype: :py:class:`ColorPt` :return: a ColorPt, the current value for ColorA in the form of R, G, B """ return _PDFNetPython.TextDiffOptions_GetColorA(self)
[docs] def SetColorA(self, color): r""" Sets the value for ColorA in the options object The difference color for deletions :type color: :py:class:`ColorPt` :param color:: the new value for ColorA in the form of R, G, B :rtype: :py:class:`TextDiffOptions` :return: this object, for call chaining """ return _PDFNetPython.TextDiffOptions_SetColorA(self, color)
[docs] def GetOpacityA(self): r""" Gets the value OpacityA from the options object The difference opacity for deletions :rtype: double :return: a double, the current value for OpacityA in between 0.0 (transparent) and 1.0 (opaque) """ return _PDFNetPython.TextDiffOptions_GetOpacityA(self)
[docs] def SetOpacityA(self, opacity): r""" Sets the value for OpacityA in the options object The difference opacity for deletions :type opacity: double :param opacity:: the new value for OpacityA in between 0.0 (transparent) and 1.0 (opaque) :rtype: :py:class:`TextDiffOptions` :return: this object, for call chaining """ return _PDFNetPython.TextDiffOptions_SetOpacityA(self, opacity)
[docs] def GetColorB(self): r""" Gets the value ColorB from the options object The difference color for insertions :rtype: :py:class:`ColorPt` :return: a ColorPt, the current value for ColorB in the form of R, G, B """ return _PDFNetPython.TextDiffOptions_GetColorB(self)
[docs] def SetColorB(self, color): r""" Sets the value for ColorB in the options object The difference color for insertions :type color: :py:class:`ColorPt` :param color:: the new value for ColorB in the form of R, G, B :rtype: :py:class:`TextDiffOptions` :return: this object, for call chaining """ return _PDFNetPython.TextDiffOptions_SetColorB(self, color)
[docs] def GetOpacityB(self): r""" Gets the value OpacityB from the options object The difference opacity for insertions :rtype: double :return: a double, the current value for OpacityB in between 0.0 (transparent) and 1.0 (opaque) """ return _PDFNetPython.TextDiffOptions_GetOpacityB(self)
[docs] def SetOpacityB(self, opacity): r""" Sets the value for OpacityB in the options object The difference opacity for insertions :type opacity: double :param opacity:: the new value for OpacityB in between 0.0 (transparent) and 1.0 (opaque) :rtype: :py:class:`TextDiffOptions` :return: this object, for call chaining """ return _PDFNetPython.TextDiffOptions_SetOpacityB(self, opacity)
[docs] def GetExtraMoveColor(self): r""" Gets the value ExtraMoveColor from the options object The difference color for extra moves :rtype: :py:class:`ColorPt` :return: a ColorPt, the current value for ExtraMoveColor in the form of R, G, B """ return _PDFNetPython.TextDiffOptions_GetExtraMoveColor(self)
[docs] def SetExtraMoveColor(self, color): r""" Sets the value for ExtraMoveColor in the options object The difference color for extra moves :type color: :py:class:`ColorPt` :param color:: the new value for ExtraMoveColor in the form of R, G, B :rtype: :py:class:`TextDiffOptions` :return: this object, for call chaining """ return _PDFNetPython.TextDiffOptions_SetExtraMoveColor(self, color)
[docs] def GetExtraMoveOpacity(self): r""" Gets the value ExtraMoveOpacity from the options object The difference opacity for extra moves :rtype: double :return: a double, the current value for ExtraMoveOpacity in between 0.0 (transparent) and 1.0 (opaque) """ return _PDFNetPython.TextDiffOptions_GetExtraMoveOpacity(self)
[docs] def SetExtraMoveOpacity(self, opacity): r""" Sets the value for ExtraMoveOpacity in the options object The difference opacity for extra moves :type opacity: double :param opacity:: the new value for ExtraMoveOpacity in between 0.0 (transparent) and 1.0 (opaque) :rtype: :py:class:`TextDiffOptions` :return: this object, for call chaining """ return _PDFNetPython.TextDiffOptions_SetExtraMoveOpacity(self, opacity)
[docs] def GetCompareUsingZOrder(self): r""" Gets the value CompareUsingZOrder from the options object Whether to use z-order (aka paint order) when comparing text between A and B. On by default. :rtype: boolean :return: a bool, the current value for CompareUsingZOrder. """ return _PDFNetPython.TextDiffOptions_GetCompareUsingZOrder(self)
[docs] def SetCompareUsingZOrder(self, value): r""" Sets the value for CompareUsingZOrder in the options object Whether to use z-order (aka paint order) when comparing text between A and B. On by default. :type value: boolean :param value:: the new value for CompareUsingZOrder :rtype: :py:class:`TextDiffOptions` :return: this object, for call chaining """ return _PDFNetPython.TextDiffOptions_SetCompareUsingZOrder(self, value)
[docs] def GetExtraMoveHighlight(self): r""" Gets the value ExtraMoveHighlight from the options object Whether to highlight text in between short-distance moves when comparing text between A and B. Off by default. :rtype: boolean :return: a bool, the current value for ExtraMoveHighlight. """ return _PDFNetPython.TextDiffOptions_GetExtraMoveHighlight(self)
[docs] def SetExtraMoveHighlight(self, value): r""" Sets the value for ExtraMoveHighlight in the options object Whether to highlight text in between short-distance moves when comparing text between A and B. Off by default. :type value: boolean :param value:: the new value for ExtraMoveHighlight :rtype: :py:class:`TextDiffOptions` :return: this object, for call chaining """ return _PDFNetPython.TextDiffOptions_SetExtraMoveHighlight(self, value)
[docs] def GetShowPlaceholders(self): r""" Gets the value ShowPlaceholders from the options object Whether to show placeholder annotations. On by default. Placeholders are insertion locations in document A and deletion locations in document B. For example, if a word is removed from document B, we can highlight the location of the original word in document A, but there is no word to highlight in B (it's removed). In this case a small "placeholder" annotation is placed in B to identify the location of the removal. :rtype: boolean :return: a bool, the current value for ShowPlaceholders. """ return _PDFNetPython.TextDiffOptions_GetShowPlaceholders(self)
[docs] def SetShowPlaceholders(self, value): r""" Sets the value for ShowPlaceholders in the options object Whether to show placeholder annotations. On by default. Placeholders are insertion locations in document A and deletion locations in document B. For example, if a word is removed from document B, we can highlight the location of the original word in document A, but there is no word to highlight in B (it's removed). In this case a small "placeholder" annotation is placed in B to identify the location of the removal. :type value: boolean :param value:: the new value for ShowPlaceholders :rtype: :py:class:`TextDiffOptions` :return: this object, for call chaining """ return _PDFNetPython.TextDiffOptions_SetShowPlaceholders(self, value)
[docs] def GetCompareStyles(self): r""" Gets the value CompareStyles from the options object Whether to highlight text style differences. Off by default. Text style includes font, size, bold, italic and text color. For example, if a word is italic in document A and is bold in document B, we can highlight the location of the word in both documents. :rtype: boolean :return: a bool, the current value for CompareStyles. """ return _PDFNetPython.TextDiffOptions_GetCompareStyles(self)
[docs] def SetCompareStyles(self, value): r""" Sets the value for CompareStyles in the options object Whether to highlight text style differences. Off by default. Text style includes font, size, bold, italic and text color. For example, if a word is italic in document A and is bold in document B, we can highlight the location of the word in both documents. :type value: boolean :param value:: the new value for CompareStyles :rtype: :py:class:`TextDiffOptions` :return: this object, for call chaining """ return _PDFNetPython.TextDiffOptions_SetCompareStyles(self, value)
[docs] def AddIgnoreZonesForPage(self, regions, page_num): r""" Adds a collection of ignorable regions for the given page, an optional list of page areas not to be included in analysis :type regions: :py:class:`RectCollection` :param regions:: the zones to be added to the ignore list :type page_num: int :param page_num:: the page number the added regions belong to :rtype: :py:class:`TextDiffOptions` :return: this object, for call chaining """ return _PDFNetPython.TextDiffOptions_AddIgnoreZonesForPage(self, regions, page_num)
[docs] def GetInternalObj(self, args): return _PDFNetPython.TextDiffOptions_GetInternalObj(self, args)
# Register TextDiffOptions in _PDFNetPython: _PDFNetPython.TextDiffOptions_swigregister(TextDiffOptions)
[docs] class ConversionOptions(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): _PDFNetPython.ConversionOptions_swiginit(self, _PDFNetPython.new_ConversionOptions(args)) __swig_destroy__ = _PDFNetPython.delete_ConversionOptions
[docs] def GetFileExtension(self): r""" Gets the value of FileExtension from the options object Override file extension used to determine conversion type. :rtype: string :return: a string, the current value for FileExtension. """ return _PDFNetPython.ConversionOptions_GetFileExtension(self)
[docs] def SetFileExtension(self, value): r""" Sets the value for FileExtension in the options object Override file extension used to determine conversion type. :type value: string :param value:: the new value for FileExtension :rtype: :py:class:`ConversionOptions` :return: this object, for call chaining """ return _PDFNetPython.ConversionOptions_SetFileExtension(self, value)
[docs] def GetEnableExternalMediaDownloads(self): r""" Gets the value of EnableExternalMediaDownloads from the options object used to determine if downloading external resources is allowed during conversion. :rtype: boolean :return: a boolean value, the current value for EnableExternalMediaDownloads. """ return _PDFNetPython.ConversionOptions_GetEnableExternalMediaDownloads(self)
[docs] def SetEnableExternalMediaDownloads(self, value): r""" Sets the value for EnableExternalMediaDownloads in the options object used to determine if downloading external resources is allowed during conversion. :type value: boolean :param value:: the new value for EnableExternalMediaDownloads. :rtype: :py:class:`ConversionOptions` :return: this object, for call chaining. """ return _PDFNetPython.ConversionOptions_SetEnableExternalMediaDownloads(self, value)
[docs] def GetInternalObj(self): return _PDFNetPython.ConversionOptions_GetInternalObj(self)
# Register ConversionOptions in _PDFNetPython: _PDFNetPython.ConversionOptions_swigregister(ConversionOptions)
[docs] class OfficeToPDFOptions(ConversionOptions): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): _PDFNetPython.OfficeToPDFOptions_swiginit(self, _PDFNetPython.new_OfficeToPDFOptions()) __swig_destroy__ = _PDFNetPython.delete_OfficeToPDFOptions e_default = _PDFNetPython.OfficeToPDFOptions_e_default r""" Default level of structure tags, good for accessibility.""" e_none = _PDFNetPython.OfficeToPDFOptions_e_none r""" No structure tags. This can be used to get smaller file sizes."""
[docs] def GetApplyPageBreaksToSheet(self): r""" Gets the value ApplyPageBreaksToSheet from the options object Whether we should split Excel workheets into pages so that the output resembles print output. If set to false (the default), Excel sheets will be placed one per page, except in the case where the sheets are very large :rtype: boolean :return: a bool, the current value for ApplyPageBreaksToSheet. """ return _PDFNetPython.OfficeToPDFOptions_GetApplyPageBreaksToSheet(self)
[docs] def SetApplyPageBreaksToSheet(self, value): r""" Sets the value for ApplyPageBreaksToSheet in the options object Whether we should split Excel workheets into pages so that the output resembles print output. If set to false (the default), Excel sheets will be placed one per page, except in the case where the sheets are very large :type value: boolean :param value:: the new value for ApplyPageBreaksToSheet :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetApplyPageBreaksToSheet(self, value)
[docs] def GetDisplayChangeTracking(self): r""" Gets the value DisplayChangeTracking from the options object If this option is true, will display office change tracking markup present in the document (i.e, red strikethrough of deleted content and underlining of new content). Otherwise displays the resolved document content, with no markup. Defaults to true. :rtype: boolean :return: a bool, the current value for DisplayChangeTracking. """ return _PDFNetPython.OfficeToPDFOptions_GetDisplayChangeTracking(self)
[docs] def SetDisplayChangeTracking(self, value): r""" Sets the value for DisplayChangeTracking in the options object If this option is true, will display office change tracking markup present in the document (i.e, red strikethrough of deleted content and underlining of new content). Otherwise displays the resolved document content, with no markup. Defaults to true. :type value: boolean :param value:: the new value for DisplayChangeTracking :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetDisplayChangeTracking(self, value)
[docs] def GetDisplayHiddenText(self): r""" Gets the value DisplayHiddenText from the options object Display any hidden text that is present in the document (i.e., text that has been marked as 'Hidden' in the font style). By default, hidden text will not be displayed. :rtype: boolean :return: a bool, the current value for DisplayHiddenText. """ return _PDFNetPython.OfficeToPDFOptions_GetDisplayHiddenText(self)
[docs] def SetDisplayHiddenText(self, value): r""" Sets the value for DisplayHiddenText in the options object Display any hidden text that is present in the document (i.e., text that has been marked as 'Hidden' in the font style). By default, hidden text will not be displayed. :type value: boolean :param value:: the new value for DisplayHiddenText :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetDisplayHiddenText(self, value)
[docs] def GetExcelDefaultCellBorderWidth(self): r""" Gets the value ExcelDefaultCellBorderWidth from the options object Cell border width for table cells that would normally be drawn with no border. In units of points. Can be used to achieve a similar effect to the "show gridlines" display option within Microsoft Excel. :rtype: double :return: a double, the current value for ExcelDefaultCellBorderWidth. """ return _PDFNetPython.OfficeToPDFOptions_GetExcelDefaultCellBorderWidth(self)
[docs] def SetExcelDefaultCellBorderWidth(self, value): r""" Sets the value for ExcelDefaultCellBorderWidth in the options object Cell border width for table cells that would normally be drawn with no border. In units of points. Can be used to achieve a similar effect to the "show gridlines" display option within Microsoft Excel. :type value: double :param value:: the new value for ExcelDefaultCellBorderWidth :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetExcelDefaultCellBorderWidth(self, value)
[docs] def GetExcelMaxAllowedCellCount(self): r""" Gets the value ExcelMaxAllowedCellCount from the options object Conversion will throw an exception if the number of cells in a Microsoft Excel document is above the set MaxAllowedCellCount. Used for early termination of resource intensive conversions. Setting this value to 250000 will allow the vast majority of Excel documents to convert without issue, while keeping RAM usage to a reasonable level. By default there is no limit to the number of allowed cells. :rtype: int :return: a UInt32, the current value for ExcelMaxAllowedCellCount. """ return _PDFNetPython.OfficeToPDFOptions_GetExcelMaxAllowedCellCount(self)
[docs] def SetExcelMaxAllowedCellCount(self, value): r""" Sets the value for ExcelMaxAllowedCellCount in the options object Conversion will throw an exception if the number of cells in a Microsoft Excel document is above the set MaxAllowedCellCount. Used for early termination of resource intensive conversions. Setting this value to 250000 will allow the vast majority of Excel documents to convert without issue, while keeping RAM usage to a reasonable level. By default there is no limit to the number of allowed cells. :type value: int :param value:: the new value for ExcelMaxAllowedCellCount :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetExcelMaxAllowedCellCount(self, value)
[docs] def GetHideTotalNumberOfPages(self): r""" Gets the value HideTotalNumberOfPages from the options object If the document has an element that displays the total number of pages and the total number of pages is unknown beforehand, remove those elements from the document. :rtype: boolean :return: a bool, the current value for HideTotalNumberOfPages. """ return _PDFNetPython.OfficeToPDFOptions_GetHideTotalNumberOfPages(self)
[docs] def SetHideTotalNumberOfPages(self, value): r""" Sets the value for HideTotalNumberOfPages in the options object If the document has an element that displays the total number of pages and the total number of pages is unknown beforehand, remove those elements from the document. :type value: boolean :param value:: the new value for HideTotalNumberOfPages :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetHideTotalNumberOfPages(self, value)
[docs] def GetIncludeBookmarks(self): r""" Gets the value IncludeBookmarks from the options object When this option is set to false, Word document bookmarks will not be converted into PDF bookmarks. However, Word headings will still be automatically converted into PDF bookmarks. By default, both Word bookmarks and headings are converted into PDF bookmarks, providing a comprehensive navigation structure within the converted PDF. :rtype: boolean :return: a bool, the current value for IncludeBookmarks. """ return _PDFNetPython.OfficeToPDFOptions_GetIncludeBookmarks(self)
[docs] def SetIncludeBookmarks(self, value): r""" Sets the value for IncludeBookmarks in the options object When this option is set to false, Word document bookmarks will not be converted into PDF bookmarks. However, Word headings will still be automatically converted into PDF bookmarks. By default, both Word bookmarks and headings are converted into PDF bookmarks, providing a comprehensive navigation structure within the converted PDF. :type value: boolean :param value:: the new value for IncludeBookmarks :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetIncludeBookmarks(self, value)
[docs] def GetIncrementalSave(self): r""" Gets the value IncrementalSave from the options object If this option is true, the document will be saved incrementally during the conversion, thus reducing the peak memory usage. Save an empty PDFDoc to the target location before the conversion so the incremental saving is done directly to the target location. Otherwise, a temporary file will be used. PDFDoc.Save still has to be called after the conversion is done to finalize the file. Doing PDFDoc.Save with e_incremental flag will reduce the saving time but increase the PDF file size. :rtype: boolean :return: a bool, the current value for IncrementalSave. """ return _PDFNetPython.OfficeToPDFOptions_GetIncrementalSave(self)
[docs] def SetIncrementalSave(self, value): r""" Sets the value for IncrementalSave in the options object If this option is true, the document will be saved incrementally during the conversion, thus reducing the peak memory usage. Save an empty PDFDoc to the target location before the conversion so the incremental saving is done directly to the target location. Otherwise, a temporary file will be used. PDFDoc.Save still has to be called after the conversion is done to finalize the file. Doing PDFDoc.Save with e_incremental flag will reduce the saving time but increase the PDF file size. :type value: boolean :param value:: the new value for IncrementalSave :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetIncrementalSave(self, value)
[docs] def GetLayoutResourcesPluginPath(self): r""" Gets the value LayoutResourcesPluginPath from the options object The path at which the pdftron-provided font resource plugin resides :rtype: string :return: a string, the current value for LayoutResourcesPluginPath. """ return _PDFNetPython.OfficeToPDFOptions_GetLayoutResourcesPluginPath(self)
[docs] def SetLayoutResourcesPluginPath(self, value): r""" Sets the value for LayoutResourcesPluginPath in the options object The path at which the pdftron-provided font resource plugin resides :type value: string :param value:: the new value for LayoutResourcesPluginPath :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetLayoutResourcesPluginPath(self, value)
[docs] def GetLocale(self): r""" Gets the value Locale from the options object ISO 639-1 code of the locale to be applied during conversion. For example: 'en-US', 'ar-SA', 'de-DE', etc. Currently only applied during xls/xlsx conversions. :rtype: string :return: a string, the current value for Locale. """ return _PDFNetPython.OfficeToPDFOptions_GetLocale(self)
[docs] def SetLocale(self, value): r""" Sets the value for Locale in the options object ISO 639-1 code of the locale to be applied during conversion. For example: 'en-US', 'ar-SA', 'de-DE', etc. Currently only applied during xls/xlsx conversions. :type value: string :param value:: the new value for Locale :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetLocale(self, value)
[docs] def GetPassword(self): r""" Gets the value Password from the options object Password used to decrypt password-protected office documents. :rtype: string :return: a string, the current value for Password. """ return _PDFNetPython.OfficeToPDFOptions_GetPassword(self)
[docs] def SetPassword(self, value): r""" Sets the value for Password in the options object Password used to decrypt password-protected office documents. :type value: string :param value:: the new value for Password :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetPassword(self, value)
[docs] def GetResourceDocPath(self): r""" Gets the value ResourceDocPath from the options object The path at which a .docx resource document resides :rtype: string :return: a string, the current value for ResourceDocPath. """ return _PDFNetPython.OfficeToPDFOptions_GetResourceDocPath(self)
[docs] def SetResourceDocPath(self, value): r""" Sets the value for ResourceDocPath in the options object The path at which a .docx resource document resides :type value: string :param value:: the new value for ResourceDocPath :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetResourceDocPath(self, value)
[docs] def GetSmartSubstitutionPluginPath(self): r""" Gets the value SmartSubstitutionPluginPath from the options object The path at which the pdftron-provided font resource plugin resides :rtype: string :return: a string, the current value for SmartSubstitutionPluginPath. """ return _PDFNetPython.OfficeToPDFOptions_GetSmartSubstitutionPluginPath(self)
[docs] def SetSmartSubstitutionPluginPath(self, value): r""" Sets the value for SmartSubstitutionPluginPath in the options object The path at which the pdftron-provided font resource plugin resides :type value: string :param value:: the new value for SmartSubstitutionPluginPath :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetSmartSubstitutionPluginPath(self, value)
[docs] def GetStructureTagLevel(self): r""" Gets the value StructureTagLevel from the options object Specifies the level of document structure tags to include in the PDF for accessibility purposes. :rtype: int :return: a StructureTagLevel, the current value for StructureTagLevel. """ return _PDFNetPython.OfficeToPDFOptions_GetStructureTagLevel(self)
[docs] def SetStructureTagLevel(self, value): r""" Sets the value for StructureTagLevel in the options object Specifies the level of document structure tags to include in the PDF for accessibility purposes. :type value: int :param value:: the new value for StructureTagLevel :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetStructureTagLevel(self, value)
[docs] def GetTemplateLeftDelimiter(self): r""" Gets the value TemplateLeftDelimiter from the options object Left delimiter for template tags. Defaults to '{{'. :rtype: string :return: a string, the current value for TemplateLeftDelimiter. """ return _PDFNetPython.OfficeToPDFOptions_GetTemplateLeftDelimiter(self)
[docs] def SetTemplateLeftDelimiter(self, value): r""" Sets the value for TemplateLeftDelimiter in the options object Left delimiter for template tags. Defaults to '{{'. :type value: string :param value:: the new value for TemplateLeftDelimiter :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetTemplateLeftDelimiter(self, value)
[docs] def GetTemplateParamsJson(self): r""" Gets the value TemplateParamsJson from the options object JSON string representing the data to be merged into a PDFTron office template. For a more featureful template API, see CreateOfficeTemplate. :rtype: string :return: a string, the current value for TemplateParamsJson. """ return _PDFNetPython.OfficeToPDFOptions_GetTemplateParamsJson(self)
[docs] def SetTemplateParamsJson(self, value): r""" Sets the value for TemplateParamsJson in the options object JSON string representing the data to be merged into a PDFTron office template. For a more featureful template API, see CreateOfficeTemplate. :type value: string :param value:: the new value for TemplateParamsJson :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetTemplateParamsJson(self, value)
[docs] def GetTemplateRightDelimiter(self): r""" Gets the value TemplateRightDelimiter from the options object Right delimiter for template tags. Defaults to '}}'. :rtype: string :return: a string, the current value for TemplateRightDelimiter. """ return _PDFNetPython.OfficeToPDFOptions_GetTemplateRightDelimiter(self)
[docs] def SetTemplateRightDelimiter(self, value): r""" Sets the value for TemplateRightDelimiter in the options object Right delimiter for template tags. Defaults to '}}'. :type value: string :param value:: the new value for TemplateRightDelimiter :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetTemplateRightDelimiter(self, value)
[docs] def GetTemplateStrictMode(self): r""" Gets the value TemplateStrictMode from the options object If "Strict Mode" is enabled, when a template key is missing from the json data an exception will be thrown. If "Strict Mode" is disabled (default), the tag will be replaced with no content. :rtype: boolean :return: a bool, the current value for TemplateStrictMode. """ return _PDFNetPython.OfficeToPDFOptions_GetTemplateStrictMode(self)
[docs] def SetTemplateStrictMode(self, value): r""" Sets the value for TemplateStrictMode in the options object If "Strict Mode" is enabled, when a template key is missing from the json data an exception will be thrown. If "Strict Mode" is disabled (default), the tag will be replaced with no content. :type value: boolean :param value:: the new value for TemplateStrictMode :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetTemplateStrictMode(self, value)
[docs] def GetUpdateTableOfContents(self): r""" Gets the value UpdateTableOfContents from the options object Updates the table of contents in the document so it matches the actual locations of headings/bookmarks. By default, the table of contents is not updated. Enabling this option may negatively affect conversion speed. :rtype: boolean :return: a bool, the current value for UpdateTableOfContents. """ return _PDFNetPython.OfficeToPDFOptions_GetUpdateTableOfContents(self)
[docs] def SetUpdateTableOfContents(self, value): r""" Sets the value for UpdateTableOfContents in the options object Updates the table of contents in the document so it matches the actual locations of headings/bookmarks. By default, the table of contents is not updated. Enabling this option may negatively affect conversion speed. :type value: boolean :param value:: the new value for UpdateTableOfContents :rtype: :py:class:`OfficeToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.OfficeToPDFOptions_SetUpdateTableOfContents(self, value)
# Register OfficeToPDFOptions in _PDFNetPython: _PDFNetPython.OfficeToPDFOptions_swigregister(OfficeToPDFOptions)
[docs] class WordToPDFOptions(ConversionOptions): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): _PDFNetPython.WordToPDFOptions_swiginit(self, _PDFNetPython.new_WordToPDFOptions()) __swig_destroy__ = _PDFNetPython.delete_WordToPDFOptions
[docs] def GetLayoutResourcesPluginPath(self): r""" Gets the value LayoutResourcesPluginPath from the options object The path at which the pdftron-provided font resource plugin resides :rtype: string :return: a string, The path at which the pdftron-provided font resource plugin resides. """ return _PDFNetPython.WordToPDFOptions_GetLayoutResourcesPluginPath(self)
[docs] def SetLayoutResourcesPluginPath(self, value): r""" Sets the value for LayoutResourcesPluginPath in the options object The path at which the pdftron-provided font resource plugin resides :type value: string :param value:: The path at which the pdftron-provided font resource plugin resides :rtype: :py:class:`WordToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.WordToPDFOptions_SetLayoutResourcesPluginPath(self, value)
[docs] def GetResourceDocPath(self): r""" Gets the value ResourceDocPath from the options object The path at which the a .docx resource document resides :rtype: string :return: a string, The path at which the a .docx resource document resides. """ return _PDFNetPython.WordToPDFOptions_GetResourceDocPath(self)
[docs] def SetResourceDocPath(self, value): r""" Sets the value for ResourceDocPath in the options object The path at which the a .docx resource document resides :type value: string :param value:: The path at which the a .docx resource document resides :rtype: :py:class:`WordToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.WordToPDFOptions_SetResourceDocPath(self, value)
[docs] def GetSmartSubstitutionPluginPath(self): r""" Gets the value SmartSubstitutionPluginPath from the options object The path at which the pdftron-provided font resource plugin resides :rtype: string :return: a string, The path at which the pdftron-provided font resource plugin resides. """ return _PDFNetPython.WordToPDFOptions_GetSmartSubstitutionPluginPath(self)
[docs] def SetSmartSubstitutionPluginPath(self, value): r""" Sets the value for SmartSubstitutionPluginPath in the options object The path at which the pdftron-provided font resource plugin resides :type value: string :param value:: The path at which the pdftron-provided font resource plugin resides :rtype: :py:class:`WordToPDFOptions` :return: this object, for call chaining """ return _PDFNetPython.WordToPDFOptions_SetSmartSubstitutionPluginPath(self, value)
# Register WordToPDFOptions in _PDFNetPython: _PDFNetPython.WordToPDFOptions_swigregister(WordToPDFOptions)
[docs] class DocumentConversion(object): r""" The class DocumentConversion. Encapsulates the conversion of a single document from one format to another. DocumentConversion instances are created through methods belonging to the Convert class. See Convert.WordToPDFConversion for an example. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr eSuccess = _PDFNetPython.DocumentConversion_eSuccess eIncomplete = _PDFNetPython.DocumentConversion_eIncomplete eFailure = _PDFNetPython.DocumentConversion_eFailure def __init__(self, args): _PDFNetPython.DocumentConversion_swiginit(self, _PDFNetPython.new_DocumentConversion(args)) __swig_destroy__ = _PDFNetPython.delete_DocumentConversion
[docs] def Destroy(self): return _PDFNetPython.DocumentConversion_Destroy(self)
[docs] def TryConvert(self): r""" Perform the conversion. If the result of the conversion is failure, then GetErrorString will contain further information about the failure. :rtype: int :return: Indicates that the conversion succeeded, failed, or was cancelled. """ return _PDFNetPython.DocumentConversion_TryConvert(self)
[docs] def Convert(self): r"""Perform the conversion. Will throw an exception on failure.""" return _PDFNetPython.DocumentConversion_Convert(self)
[docs] def ConvertNextPage(self): r"""Perform the conversion. Will throw an exception on failure. Does nothing if the conversion is already complete. Use GetConversionStatus() to check if there is remaining content to be converted.""" return _PDFNetPython.DocumentConversion_ConvertNextPage(self)
[docs] def GetDoc(self): r""" Gets the PDFDoc from the conversion. Can be accessed at any time during or after conversion. :rtype: :py:class:`PDFDoc` :return: The conversion's PDFDoc. """ return _PDFNetPython.DocumentConversion_GetDoc(self)
[docs] def GetConversionStatus(self): r""" Get the state of the conversion process. Pair this with ConvertNextPage(). :rtype: int :return: . """ return _PDFNetPython.DocumentConversion_GetConversionStatus(self)
[docs] def CancelConversion(self): r"""Cancel the current conversion, forcing TryConvert or Convert to return.""" return _PDFNetPython.DocumentConversion_CancelConversion(self)
[docs] def IsCancelled(self): r""" Has the conversion been cancelled?. :rtype: boolean :return: Returns true if CancelConversion has been called previously. """ return _PDFNetPython.DocumentConversion_IsCancelled(self)
[docs] def HasProgressTracking(self): r""" Determine whether this DocumentConversion has progress reporting capability. :rtype: boolean :return: True if GetProgress is expected to return usable values. """ return _PDFNetPython.DocumentConversion_HasProgressTracking(self)
[docs] def GetProgress(self): r""" Returns a number from 0.0 to 1.0, representing the best estimate of conversion progress. This number is only an indicator, and should not be used to dictate program logic (in particular, it is possible for this method to return 1.0 while there is still work to be done. Use GetConversionStatus() to find out when the conversion is fully complete). :rtype: double :return: The conversion progress. Will never return a smaller number than a previous call. """ return _PDFNetPython.DocumentConversion_GetProgress(self)
[docs] def GetProgressLabel(self): r""" Returns the label for the current conversion stage. May return a blank string. Warning: experimental interface; this method may be renamed or replaced with equivalent functionality in the future. :rtype: string :return: The stage label. """ return _PDFNetPython.DocumentConversion_GetProgressLabel(self)
[docs] def GetNumConvertedPages(self): r""" Returns the number of pages which have been added to the destination document. Will never decrease, and will not change after the conversion status becomes "complete". :rtype: int :return: The number of pages that have been converted. """ return _PDFNetPython.DocumentConversion_GetNumConvertedPages(self)
[docs] def GetErrorString(self): r""" If the conversion finsihed with some kind of error, this returns the value of the error description; otherwise returns an empty string. :rtype: string :return: The error description. Will be blank unless GetConversionStatus returns Failure. """ return _PDFNetPython.DocumentConversion_GetErrorString(self)
[docs] def GetNumWarnings(self): r""" Return the number of warning strings generated during the conversion process. Warning: experimental interface; this method may be renamed or replaced with equivalent functionality in the future. :rtype: int :return: The number of stored warning strings. """ return _PDFNetPython.DocumentConversion_GetNumWarnings(self)
[docs] def GetWarningString(self, index): r""" Retrieve warning strings that have been collected during the conversion process. Warning: experimental interface; this method may be renamed or replaced with equivalent functionality in the future. :type index: int :param index: -- the index of the string to be retrieved. Must be less than GetNumWarnings(). :rtype: string :return: The value of the particular warning string. """ return _PDFNetPython.DocumentConversion_GetWarningString(self, index)
[docs] def GetCurrentExcelSheetName(self): r""" Retrieve the name of the Excel sheet placed on the last converted page if any. :rtype: string :return: The name of the Excel sheet. """ return _PDFNetPython.DocumentConversion_GetCurrentExcelSheetName(self)
[docs] def GetNextExcelSheetCellCount(self): r""" Retrieve the number of cells in the Excel sheet that will be converted next. :rtype: int :return: The number of cells. """ return _PDFNetPython.DocumentConversion_GetNextExcelSheetCellCount(self)
[docs] def SkipNextExcelSheet(self): r"""Skip the next Excel sheet. The sheet will not be converted.""" return _PDFNetPython.DocumentConversion_SkipNextExcelSheet(self)
[docs] @staticmethod def CreateInternal(impl): return _PDFNetPython.DocumentConversion_CreateInternal(impl)
[docs] def GetHandleInternal(self): return _PDFNetPython.DocumentConversion_GetHandleInternal(self)
m_impl = property(_PDFNetPython.DocumentConversion_m_impl_get, _PDFNetPython.DocumentConversion_m_impl_set)
# Register DocumentConversion in _PDFNetPython: _PDFNetPython.DocumentConversion_swigregister(DocumentConversion)
[docs] def DocumentConversion_CreateInternal(impl): return _PDFNetPython.DocumentConversion_CreateInternal(impl)
[docs] class TemplateDocument(object): r""" The class TemplateDocument. Encapsulates a template document that can merged with data to generate any number of PDFs. TemplateDocument instances are created through the Convert class. See Convert.CreateOfficeTemplate. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr eSuccess = _PDFNetPython.TemplateDocument_eSuccess eIncomplete = _PDFNetPython.TemplateDocument_eIncomplete eFailure = _PDFNetPython.TemplateDocument_eFailure def __init__(self, args): _PDFNetPython.TemplateDocument_swiginit(self, _PDFNetPython.new_TemplateDocument(args)) __swig_destroy__ = _PDFNetPython.delete_TemplateDocument
[docs] def Destroy(self): return _PDFNetPython.TemplateDocument_Destroy(self)
[docs] def FillTemplateJson(self, json): r""" Create a PDF by merging JSON data with this template document. :type json: string :param json: -- A JSON dictionary mapping template keys to their replacement content. :rtype: :py:class:`PDFDoc` :return: The PDFDoc from the template filling result. """ return _PDFNetPython.TemplateDocument_FillTemplateJson(self, json)
[docs] def FillTemplateJsonToOffice(self, json, output_path): r""" Create an office file by merging JSON data with this template document. This function currently only supports DOCX input. :type json: string :param json: -- A JSON dictionary mapping template keys to their replacement content. :type output_path: string :param output_path: -- The path where the output file is written. """ return _PDFNetPython.TemplateDocument_FillTemplateJsonToOffice(self, json, output_path)
[docs] def GetTemplateKeysJson(self): r""" Get information about the template keys present in the template document. Returns a JSON dictionary following this form: https://www.pdftron.com/api/web/Core.html#.TemplateSchema. :rtype: string :return: The template keys info JSON dictionary, serialized into a string. """ return _PDFNetPython.TemplateDocument_GetTemplateKeysJson(self)
[docs] def GetErrorString(self): r""" If the template filling finsihed with some kind of error, this returns the value of the error description; otherwise returns an empty string. :rtype: string :return: The error description. Will be blank unless GetConversionStatus returns Failure. """ return _PDFNetPython.TemplateDocument_GetErrorString(self)
[docs] def GetConversionStatus(self): r""" Get the state of the template filling process. :rtype: int :return: . """ return _PDFNetPython.TemplateDocument_GetConversionStatus(self)
[docs] def CancelConversion(self): r"""Cancel the current template filling, forcing FillTemplateJson to return.""" return _PDFNetPython.TemplateDocument_CancelConversion(self)
[docs] def IsCancelled(self): r""" Has the template filling been cancelled?. :rtype: boolean :return: Returns true if CancelConversion has been called previously. """ return _PDFNetPython.TemplateDocument_IsCancelled(self)
[docs] def GetNumWarnings(self): r""" Return the number of warning strings generated during the template filling process. Warning: experimental interface; this method may be renamed or replaced with equivalent functionality in the future. :rtype: int :return: The number of stored warning strings. """ return _PDFNetPython.TemplateDocument_GetNumWarnings(self)
[docs] def GetWarningString(self, index): r""" Retrieve warning strings that have been collected during the template filling process. Warning: experimental interface; this method may be renamed or replaced with equivalent functionality in the future. :type index: int :param index: -- the index of the string to be retrieved. Must be less than GetNumWarnings(). :rtype: string :return: The value of the particular warning string. """ return _PDFNetPython.TemplateDocument_GetWarningString(self, index)
[docs] @staticmethod def CreateInternal(impl): return _PDFNetPython.TemplateDocument_CreateInternal(impl)
[docs] def GetHandleInternal(self): return _PDFNetPython.TemplateDocument_GetHandleInternal(self)
m_impl = property(_PDFNetPython.TemplateDocument_m_impl_get, _PDFNetPython.TemplateDocument_m_impl_set)
# Register TemplateDocument in _PDFNetPython: _PDFNetPython.TemplateDocument_swigregister(TemplateDocument)
[docs] def TemplateDocument_CreateInternal(impl): return _PDFNetPython.TemplateDocument_CreateInternal(impl)
[docs] class CADConvertOptions(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_default_order = _PDFNetPython.CADConvertOptions_e_default_order r""" Default sort order. In this case there is no explicit sort performed, and pages are placed in the order they are encountered in the source document""" e_alphabetic_order = _PDFNetPython.CADConvertOptions_e_alphabetic_order r""" Alphabetic sort order""" e_alphanumeric_order = _PDFNetPython.CADConvertOptions_e_alphanumeric_order r""" Alphanumeric sort order (also called natural sort order)""" def __init__(self): _PDFNetPython.CADConvertOptions_swiginit(self, _PDFNetPython.new_CADConvertOptions()) __swig_destroy__ = _PDFNetPython.delete_CADConvertOptions
[docs] def GetAllowThinLines(self): r""" Gets the value AllowThinLines from the options object Sets drawing line weights to zero :rtype: boolean :return: a bool, the current value for AllowThinLines. """ return _PDFNetPython.CADConvertOptions_GetAllowThinLines(self)
[docs] def SetAllowThinLines(self, value): r""" Sets the value for AllowThinLines in the options object Sets drawing line weights to zero :type value: boolean :param value:: the new value for AllowThinLines :rtype: :py:class:`CADConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.CADConvertOptions_SetAllowThinLines(self, value)
[docs] def GetAutoRotate(self): r""" Gets the value AutoRotate from the options object Maps the orientation to the sheet dimensions :rtype: boolean :return: a bool, the current value for AutoRotate. """ return _PDFNetPython.CADConvertOptions_GetAutoRotate(self)
[docs] def SetAutoRotate(self, value): r""" Sets the value for AutoRotate in the options object Maps the orientation to the sheet dimensions :type value: boolean :param value:: the new value for AutoRotate :rtype: :py:class:`CADConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.CADConvertOptions_SetAutoRotate(self, value)
[docs] def GetBackgroundColor(self): r""" Gets the value BackgroundColor from the options object Sets background color for cad conversion (display palette may be adjusted to contrast the chosen background color) :rtype: :py:class:`ColorPt` :return: a ColorPt, the current value for BackgroundColor. """ return _PDFNetPython.CADConvertOptions_GetBackgroundColor(self)
[docs] def SetBackgroundColor(self, value): r""" Sets the value for BackgroundColor in the options object Sets background color for cad conversion (display palette may be adjusted to contrast the chosen background color) :type value: :py:class:`ColorPt` :param value:: the new value for BackgroundColor :rtype: :py:class:`CADConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.CADConvertOptions_SetBackgroundColor(self, value)
[docs] def GetColorMode(self): r""" Gets the value ColorMode from the options object Sets the color palette used by the drawing export. Possible values are Mono (i.e., monochrome) and Gray (i.e., grayscale), otherwise drawing's original palette is used :rtype: string :return: a string, the current value for ColorMode. """ return _PDFNetPython.CADConvertOptions_GetColorMode(self)
[docs] def SetColorMode(self, value): r""" Sets the value for ColorMode in the options object Sets the color palette used by the drawing export. Possible values are Mono (i.e., monochrome) and Gray (i.e., grayscale), otherwise drawing's original palette is used :type value: string :param value:: the new value for ColorMode :rtype: :py:class:`CADConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.CADConvertOptions_SetColorMode(self, value)
[docs] def GetIncludeModel(self): r""" Gets the value IncludeModel from the options object Instructs the conversion process to include the model layout (default: true). Note that if the model layout is empty, it will never be included in the output :rtype: boolean :return: a bool, the current value for IncludeModel. """ return _PDFNetPython.CADConvertOptions_GetIncludeModel(self)
[docs] def SetIncludeModel(self, value): r""" Sets the value for IncludeModel in the options object Instructs the conversion process to include the model layout (default: true). Note that if the model layout is empty, it will never be included in the output :type value: boolean :param value:: the new value for IncludeModel :rtype: :py:class:`CADConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.CADConvertOptions_SetIncludeModel(self, value)
[docs] def GetLayoutSortOrder(self): r""" Gets the value LayoutSortOrder from the options object Specifies how the layout is sorted during cad to pdf conversion. This affects how each layout is inserted into the output pdf (each layout becomes a pdf page). :rtype: int :return: a LayoutSortOrder, the current value for LayoutSortOrder. """ return _PDFNetPython.CADConvertOptions_GetLayoutSortOrder(self)
[docs] def SetLayoutSortOrder(self, value): r""" Sets the value for LayoutSortOrder in the options object Specifies how the layout is sorted during cad to pdf conversion. This affects how each layout is inserted into the output pdf (each layout becomes a pdf page). :type value: int :param value:: the new value for LayoutSortOrder :rtype: :py:class:`CADConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.CADConvertOptions_SetLayoutSortOrder(self, value)
[docs] def GetMaxXrefDepth(self): r""" Gets the value MaxXrefDepth from the options object Maximum resolution depth for nested xrefs. Root drawing starts at level 0, subsequent nested levels increment by 1. Nested xrefs at levels greater than specified will not be loaded. :rtype: int :return: a UInt32, the current value for MaxXrefDepth. """ return _PDFNetPython.CADConvertOptions_GetMaxXrefDepth(self)
[docs] def SetMaxXrefDepth(self, value): r""" Sets the value for MaxXrefDepth in the options object Maximum resolution depth for nested xrefs. Root drawing starts at level 0, subsequent nested levels increment by 1. Nested xrefs at levels greater than specified will not be loaded. :type value: int :param value:: the new value for MaxXrefDepth :rtype: :py:class:`CADConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.CADConvertOptions_SetMaxXrefDepth(self, value)
[docs] def GetPageHeight(self): r""" Gets the value PageHeight from the options object The height of the output pdf, in millimeters :rtype: double :return: a double, the current value for PageHeight. """ return _PDFNetPython.CADConvertOptions_GetPageHeight(self)
[docs] def SetPageHeight(self, value): r""" Sets the value for PageHeight in the options object The height of the output pdf, in millimeters :type value: double :param value:: the new value for PageHeight :rtype: :py:class:`CADConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.CADConvertOptions_SetPageHeight(self, value)
[docs] def GetPageWidth(self): r""" Gets the value PageWidth from the options object The width of the output pdf, in millimeters :rtype: double :return: a double, the current value for PageWidth. """ return _PDFNetPython.CADConvertOptions_GetPageWidth(self)
[docs] def SetPageWidth(self, value): r""" Sets the value for PageWidth in the options object The width of the output pdf, in millimeters :type value: double :param value:: the new value for PageWidth :rtype: :py:class:`CADConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.CADConvertOptions_SetPageWidth(self, value)
[docs] def GetRasterDPI(self): r""" Gets the value RasterDPI from the options object Rasterization dpi used when rendering 3D content. Currently only applies to .rvt conversions :rtype: double :return: a double, the current value for RasterDPI. """ return _PDFNetPython.CADConvertOptions_GetRasterDPI(self)
[docs] def SetRasterDPI(self, value): r""" Sets the value for RasterDPI in the options object Rasterization dpi used when rendering 3D content. Currently only applies to .rvt conversions :type value: double :param value:: the new value for RasterDPI :rtype: :py:class:`CADConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.CADConvertOptions_SetRasterDPI(self, value)
[docs] def AddSheets(self, value): r""" Adds the Sheets to the Sheets array The list of sheets to be converted -- only applies to .rvt conversions :type value: string :param value:: the new Sheets to be added to Sheets :rtype: :py:class:`CADConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.CADConvertOptions_AddSheets(self, value)
[docs] def GetUseScaleFromDocument(self): r""" Gets the value UseScaleFromDocument from the options object If enabled, sets export paper size equal to layout geometry's coordinate range in mm when ranges are less than 5080 mm. Paper size dimensions are clamped at 5080 mm, and are rescaled if coordinate ranges exceed 5080 mm. Disabled by default. :rtype: boolean :return: a bool, the current value for UseScaleFromDocument. """ return _PDFNetPython.CADConvertOptions_GetUseScaleFromDocument(self)
[docs] def SetUseScaleFromDocument(self, value): r""" Sets the value for UseScaleFromDocument in the options object If enabled, sets export paper size equal to layout geometry's coordinate range in mm when ranges are less than 5080 mm. Paper size dimensions are clamped at 5080 mm, and are rescaled if coordinate ranges exceed 5080 mm. Disabled by default. :type value: boolean :param value:: the new value for UseScaleFromDocument :rtype: :py:class:`CADConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.CADConvertOptions_SetUseScaleFromDocument(self, value)
[docs] def GetZoomToExtents(self): r""" Gets the value ZoomToExtents from the options object If enabled, the layout geometry is zoomed to the paper size, otherwise layout settings are applied. Enabled by default. :rtype: boolean :return: a bool, the current value for ZoomToExtents. """ return _PDFNetPython.CADConvertOptions_GetZoomToExtents(self)
[docs] def SetZoomToExtents(self, value): r""" Sets the value for ZoomToExtents in the options object If enabled, the layout geometry is zoomed to the paper size, otherwise layout settings are applied. Enabled by default. :type value: boolean :param value:: the new value for ZoomToExtents :rtype: :py:class:`CADConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.CADConvertOptions_SetZoomToExtents(self, value)
[docs] def GetInternalObj(self, args): return _PDFNetPython.CADConvertOptions_GetInternalObj(self, args)
# Register CADConvertOptions in _PDFNetPython: _PDFNetPython.CADConvertOptions_swigregister(CADConvertOptions)
[docs] class SVGConvertOptions(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): _PDFNetPython.SVGConvertOptions_swiginit(self, _PDFNetPython.new_SVGConvertOptions()) __swig_destroy__ = _PDFNetPython.delete_SVGConvertOptions
[docs] def GetDefaultFontFamily(self): r""" Gets the value DefaultFontFamily from the options object Name of the font family which is used if a font for some text in the graphics file is either not specified or not available. Default: Arial Unicode MS if available, otherwise Helvetica. :rtype: string :return: a string, the current value for DefaultFontFamily. """ return _PDFNetPython.SVGConvertOptions_GetDefaultFontFamily(self)
[docs] def SetDefaultFontFamily(self, value): r""" Sets the value for DefaultFontFamily in the options object Name of the font family which is used if a font for some text in the graphics file is either not specified or not available. Default: Arial Unicode MS if available, otherwise Helvetica. :type value: string :param value:: the new value for DefaultFontFamily :rtype: :py:class:`SVGConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.SVGConvertOptions_SetDefaultFontFamily(self, value)
[docs] def GetFallbackFontFamily(self): r""" Gets the value FallbackFontFamily from the options object Name of the font family which is used to create a fallback font for each font, in addition to the fallback fonts which may have been specified in the graphics file. Default: empty. :rtype: string :return: a string, the current value for FallbackFontFamily. """ return _PDFNetPython.SVGConvertOptions_GetFallbackFontFamily(self)
[docs] def SetFallbackFontFamily(self, value): r""" Sets the value for FallbackFontFamily in the options object Name of the font family which is used to create a fallback font for each font, in addition to the fallback fonts which may have been specified in the graphics file. Default: empty. :type value: string :param value:: the new value for FallbackFontFamily :rtype: :py:class:`SVGConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.SVGConvertOptions_SetFallbackFontFamily(self, value)
[docs] def GetFallbackHeight(self): r""" Gets the value FallbackHeight from the options object Affects only SVG graphics without absolute size; ignored if ForcedHeight is supplied. Height >= 0 of the SVG graphics for the fitting process. If the value is zero the bounding box is calculated. Default: values in the SVG graphics if present, otherwise 0. :rtype: double :return: a double, the current value for FallbackHeight. """ return _PDFNetPython.SVGConvertOptions_GetFallbackHeight(self)
[docs] def SetFallbackHeight(self, value): r""" Sets the value for FallbackHeight in the options object Affects only SVG graphics without absolute size; ignored if ForcedHeight is supplied. Height >= 0 of the SVG graphics for the fitting process. If the value is zero the bounding box is calculated. Default: values in the SVG graphics if present, otherwise 0. :type value: double :param value:: the new value for FallbackHeight :rtype: :py:class:`SVGConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.SVGConvertOptions_SetFallbackHeight(self, value)
[docs] def GetFallbackWidth(self): r""" Gets the value FallbackWidth from the options object Affects only SVG graphics without absolute size; ignored if ForcedWidth is supplied. Width >= 0 of the SVG graphics for the fitting process. If the value is zero the bounding box is calculated. Default: values in the SVG graphics if present, otherwise 0. :rtype: double :return: a double, the current value for FallbackWidth. """ return _PDFNetPython.SVGConvertOptions_GetFallbackWidth(self)
[docs] def SetFallbackWidth(self, value): r""" Sets the value for FallbackWidth in the options object Affects only SVG graphics without absolute size; ignored if ForcedWidth is supplied. Width >= 0 of the SVG graphics for the fitting process. If the value is zero the bounding box is calculated. Default: values in the SVG graphics if present, otherwise 0. :type value: double :param value:: the new value for FallbackWidth :rtype: :py:class:`SVGConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.SVGConvertOptions_SetFallbackWidth(self, value)
[docs] def GetForceSRGB(self): r""" Gets the value ForceSRGB from the options object If true, all non-sRGB color specifications are ignored and the sRGB fallback color is used instead. This option does not affect referenced images. Default: false. :rtype: boolean :return: a bool, the current value for ForceSRGB. """ return _PDFNetPython.SVGConvertOptions_GetForceSRGB(self)
[docs] def SetForceSRGB(self, value): r""" Sets the value for ForceSRGB in the options object If true, all non-sRGB color specifications are ignored and the sRGB fallback color is used instead. This option does not affect referenced images. Default: false. :type value: boolean :param value:: the new value for ForceSRGB :rtype: :py:class:`SVGConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.SVGConvertOptions_SetForceSRGB(self, value)
[docs] def GetForcedHeight(self): r""" Gets the value ForcedHeight from the options object The height of the SVG graphics is ignored and the specified value is applied instead if a value >= 1 is supplied. Default: height attribute of the graphics. :rtype: double :return: a double, the current value for ForcedHeight. """ return _PDFNetPython.SVGConvertOptions_GetForcedHeight(self)
[docs] def SetForcedHeight(self, value): r""" Sets the value for ForcedHeight in the options object The height of the SVG graphics is ignored and the specified value is applied instead if a value >= 1 is supplied. Default: height attribute of the graphics. :type value: double :param value:: the new value for ForcedHeight :rtype: :py:class:`SVGConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.SVGConvertOptions_SetForcedHeight(self, value)
[docs] def GetForcedWidth(self): r""" Gets the value ForcedWidth from the options object The width of the SVG graphics is ignored and the specified value is applied instead if a value >= 1 is supplied. Default: width attribute of the graphics. :rtype: double :return: a double, the current value for ForcedWidth. """ return _PDFNetPython.SVGConvertOptions_GetForcedWidth(self)
[docs] def SetForcedWidth(self, value): r""" Sets the value for ForcedWidth in the options object The width of the SVG graphics is ignored and the specified value is applied instead if a value >= 1 is supplied. Default: width attribute of the graphics. :type value: double :param value:: the new value for ForcedWidth :rtype: :py:class:`SVGConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.SVGConvertOptions_SetForcedWidth(self, value)
[docs] def GetHonorIccProfile(self): r""" Gets the value HonorIccProfile from the options object If true, honor all ICC profiles in icc-color specifications or implicitly in sRGB colors; otherwise all explicit ICC colors and implicit sRGB colors are interpreted as device-gray/device-rgb/device-cmyk colors. Default: true. :rtype: boolean :return: a bool, the current value for HonorIccProfile. """ return _PDFNetPython.SVGConvertOptions_GetHonorIccProfile(self)
[docs] def SetHonorIccProfile(self, value): r""" Sets the value for HonorIccProfile in the options object If true, honor all ICC profiles in icc-color specifications or implicitly in sRGB colors; otherwise all explicit ICC colors and implicit sRGB colors are interpreted as device-gray/device-rgb/device-cmyk colors. Default: true. :type value: boolean :param value:: the new value for HonorIccProfile :rtype: :py:class:`SVGConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.SVGConvertOptions_SetHonorIccProfile(self, value)
[docs] def GetInline(self): r""" Gets the value Inline from the options object If true, create output inline in the content stream; otherwise a separate Form XObject is created. The inline method suffers from disadvantages related to transparency handling. On the other hand, this option is required if active links in the graphics should be converted (option ConvertLinks). Default: true. :rtype: boolean :return: a bool, the current value for Inline. """ return _PDFNetPython.SVGConvertOptions_GetInline(self)
[docs] def SetInline(self, value): r""" Sets the value for Inline in the options object If true, create output inline in the content stream; otherwise a separate Form XObject is created. The inline method suffers from disadvantages related to transparency handling. On the other hand, this option is required if active links in the graphics should be converted (option ConvertLinks). Default: true. :type value: boolean :param value:: the new value for Inline :rtype: :py:class:`SVGConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.SVGConvertOptions_SetInline(self, value)
[docs] def GetLang(self): r""" Gets the value Lang from the options object Natural language for the graphics file as a BCP 47 language tag consisting of a two- or three-character language code according to ISO 639-1/2 which can be used e.g. in an SVG switch element. Default: the language identifier found in the LANG environment variable. :rtype: string :return: a string, the current value for Lang. """ return _PDFNetPython.SVGConvertOptions_GetLang(self)
[docs] def SetLang(self, value): r""" Sets the value for Lang in the options object Natural language for the graphics file as a BCP 47 language tag consisting of a two- or three-character language code according to ISO 639-1/2 which can be used e.g. in an SVG switch element. Default: the language identifier found in the LANG environment variable. :type value: string :param value:: the new value for Lang :rtype: :py:class:`SVGConvertOptions` :return: this object, for call chaining """ return _PDFNetPython.SVGConvertOptions_SetLang(self, value)
[docs] def GetInternalObj(self, args): return _PDFNetPython.SVGConvertOptions_GetInternalObj(self, args)
# Register SVGConvertOptions in _PDFNetPython: _PDFNetPython.SVGConvertOptions_swigregister(SVGConvertOptions)
[docs] class DataExtractionOptions(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): _PDFNetPython.DataExtractionOptions_swiginit(self, _PDFNetPython.new_DataExtractionOptions()) __swig_destroy__ = _PDFNetPython.delete_DataExtractionOptions
[docs] def GetDeepLearningAssist(self): r""" Gets the value DeepLearningAssist from the options object Specifies if Deep Learning is used with table recognition in the DocStructure engine. The default is false. When true, table recognition accuracy improves at the cost of increased processing time. This only affects the DocStructure engine. :rtype: boolean :return: a bool, the current value for DeepLearningAssist. """ return _PDFNetPython.DataExtractionOptions_GetDeepLearningAssist(self)
[docs] def SetDeepLearningAssist(self, value): r""" Sets the value for DeepLearningAssist in the options object Specifies if Deep Learning is used with table recognition in the DocStructure engine. The default is false. When true, table recognition accuracy improves at the cost of increased processing time. This only affects the DocStructure engine. :type value: boolean :param value:: the new value for DeepLearningAssist :rtype: :py:class:`DataExtractionOptions` :return: this object, for call chaining """ return _PDFNetPython.DataExtractionOptions_SetDeepLearningAssist(self, value)
[docs] def GetFormExtractionEngine(self): r""" Gets the value FormExtractionEngine from the options object Specifies the form extraction engine used in DetectAndAddFormFieldsToPDF, either 'Form' or 'FormKeyValue'. The default is 'Form'. Note: The 'FormKeyValue' engine is experimental and subject to change. :rtype: string :return: a string, the current value for FormExtractionEngine. """ return _PDFNetPython.DataExtractionOptions_GetFormExtractionEngine(self)
[docs] def SetFormExtractionEngine(self, value): r""" Sets the value for FormExtractionEngine in the options object Specifies the form extraction engine used in DetectAndAddFormFieldsToPDF, either 'Form' or 'FormKeyValue'. The default is 'Form'. Note: The 'FormKeyValue' engine is experimental and subject to change. :type value: string :param value:: the new value for FormExtractionEngine :rtype: :py:class:`DataExtractionOptions` :return: this object, for call chaining """ return _PDFNetPython.DataExtractionOptions_SetFormExtractionEngine(self, value)
[docs] def GetLanguage(self): r""" Gets the value Language from the options object Specifies the OCR language(s). Use 3-letter ISO 639-2 language codes, separated by spaces. Example: "eng deu spa fra". The default is English. :rtype: string :return: a string, the current value for Language. """ return _PDFNetPython.DataExtractionOptions_GetLanguage(self)
[docs] def SetLanguage(self, value): r""" Sets the value for Language in the options object Specifies the OCR language(s). Use 3-letter ISO 639-2 language codes, separated by spaces. Example: "eng deu spa fra". The default is English. :type value: string :param value:: the new value for Language :rtype: :py:class:`DataExtractionOptions` :return: this object, for call chaining """ return _PDFNetPython.DataExtractionOptions_SetLanguage(self, value)
[docs] def GetOverlappingFormFieldBehavior(self): r""" Gets the value OverlappingFormFieldBehavior from the options object When a detected form field overlaps with an existing one, keep either the old field (value 'KeepOld'), or the new one (value 'KeepNew', default). :rtype: string :return: a string, the current value for OverlappingFormFieldBehavior. """ return _PDFNetPython.DataExtractionOptions_GetOverlappingFormFieldBehavior(self)
[docs] def SetOverlappingFormFieldBehavior(self, value): r""" Sets the value for OverlappingFormFieldBehavior in the options object When a detected form field overlaps with an existing one, keep either the old field (value 'KeepOld'), or the new one (value 'KeepNew', default). :type value: string :param value:: the new value for OverlappingFormFieldBehavior :rtype: :py:class:`DataExtractionOptions` :return: this object, for call chaining """ return _PDFNetPython.DataExtractionOptions_SetOverlappingFormFieldBehavior(self, value)
[docs] def GetPDFPassword(self): r""" Gets the value PDFPassword from the options object Specifies the password if the PDF requires one. The default is no password. :rtype: string :return: a string, the current value for PDFPassword. """ return _PDFNetPython.DataExtractionOptions_GetPDFPassword(self)
[docs] def SetPDFPassword(self, value): r""" Sets the value for PDFPassword in the options object Specifies the password if the PDF requires one. The default is no password. :type value: string :param value:: the new value for PDFPassword :rtype: :py:class:`DataExtractionOptions` :return: this object, for call chaining """ return _PDFNetPython.DataExtractionOptions_SetPDFPassword(self, value)
[docs] def GetPages(self): r""" Gets the value Pages from the options object Specifies a range of pages to be converted, such as "1-5". By default all pages are converted. The first page has the page number of 1. :rtype: string :return: a string, the current value for Pages. """ return _PDFNetPython.DataExtractionOptions_GetPages(self)
[docs] def SetPages(self, value): r""" Sets the value for Pages in the options object Specifies a range of pages to be converted, such as "1-5". By default all pages are converted. The first page has the page number of 1. :type value: string :param value:: the new value for Pages :rtype: :py:class:`DataExtractionOptions` :return: this object, for call chaining """ return _PDFNetPython.DataExtractionOptions_SetPages(self, value)
# Register DataExtractionOptions in _PDFNetPython: _PDFNetPython.DataExtractionOptions_swigregister(DataExtractionOptions)
[docs] class ConversionMonitor(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def Next(self): return _PDFNetPython.ConversionMonitor_Next(self)
[docs] def Ready(self): return _PDFNetPython.ConversionMonitor_Ready(self)
[docs] def Progress(self): return _PDFNetPython.ConversionMonitor_Progress(self)
[docs] def Filter(self): return _PDFNetPython.ConversionMonitor_Filter(self)
[docs] def Destroy(self): return _PDFNetPython.ConversionMonitor_Destroy(self)
__swig_destroy__ = _PDFNetPython.delete_ConversionMonitor def __nonzero__(self): return _PDFNetPython.ConversionMonitor___nonzero__(self) __bool__ = __nonzero__ mp_impl = property(_PDFNetPython.ConversionMonitor_mp_impl_get, _PDFNetPython.ConversionMonitor_mp_impl_set) def __init__(self, args): _PDFNetPython.ConversionMonitor_swiginit(self, _PDFNetPython.new_ConversionMonitor(args)) m_owner = property(_PDFNetPython.ConversionMonitor_m_owner_get, _PDFNetPython.ConversionMonitor_m_owner_set)
# Register ConversionMonitor in _PDFNetPython: _PDFNetPython.ConversionMonitor_swigregister(ConversionMonitor)
[docs] class Convert(object): r""" Converter is a utility class used to convert documents and files to PDF. Conversion of XPS, EMF and image files to PDF documents is performed internally. Other document formats are converted via native application and printing. .. code-block:: c++ using namespace pdftron; using namespace PDF; PDFDoc pdfdoc; Convert::FromXps(pdfdoc, input_path + "simple-xps.xps" ); Convert::FromEmf(pdfdoc, input_path + "simple-emf.emf" ); Convert::ToPdf(pdfdoc, input_path + test docx file.docx ); // Save the PDF document UString outputFile = output_path + "ConverterTest.pdf"; pdfdoc.Save(outputFile, SDF::SDFDoc::e_remove_unused, NULL); The PDFTron PDFNet printer needs to be installed to convert document formats. On Windows installation of printer drivers requires administrator UAC, manifests have been added to the Convert samples (C++, C# and Visual Basic). To install the printer the process must be running as administrator. Execute: .. code-block:: c++ Convert::Printer::Install(); Installation can take a few seconds, so it is recommended that you install the printer once as part of your deployment process. Duplicated installations will be quick since the presence of the printer is checked before installation is attempted. The printer is a virtual XPS printer supported on Vista and Windows 7, and on Windows XP with the XPS Essentials Pack. There is no need to uninstall the printer after conversions, it can be left installed for later access. To uninstall the printer the process must be running as administrator. Execute: .. code-block:: c++ Convert::Printer::Uninstall(); """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") def __init__(self, args, kwargs): raise AttributeError("Noructor defined") __repr__ = _swig_repr e_very_strict = _PDFNetPython.Convert_e_very_strict r""" Render (flatten) any text that is clipped or occluded.""" e_strict = _PDFNetPython.Convert_e_strict r""" Render text that are marginally clipped or occluded.""" e_default = _PDFNetPython.Convert_e_default r""" Render text that are somewhat clipped or occluded.""" e_keep_most = _PDFNetPython.Convert_e_keep_most r""" Only render text that are seriously clipped or occluded.""" e_keep_all = _PDFNetPython.Convert_e_keep_all r""" Only render text that are completely occluded, or used as a clipping path.""" e_off = _PDFNetPython.Convert_e_off r"""Disable flattening and convert all content as is.""" e_simple = _PDFNetPython.Convert_e_simple r""" Feature reduce PDF to a simple two layer representation consisting of a single background RGB image and a simple top text layer. """ e_fast = _PDFNetPython.Convert_e_fast r""" Feature reduce PDF while trying to preserve some complex PDF features (such as vector figures, transparency, shadings, blend modes, Type3 fonts etc.) for pages that are already fast to render. This option can also result in smaller faster files compared to e_simple, but the pages may have more complex structure. """ e_high_quality = _PDFNetPython.Convert_e_high_quality r""" Preserve vector content where possible. In particular only feature reduce PDF files containing overprint or very complex vector content. Currently this option can only be used with XODOutputOptions. """
[docs] @staticmethod def FromXps(args): r""" Overload 1: Convert the specified XPS document to PDF and append converted pages to the specified PDF document. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_filename: string :param in_filename: the path to the XPS document to convert | Overload 2: Convert the specified XPS document contained in memory to PDF and append converted pages to the specified PDF document. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type buf: string :param buf: the buffer containing the xps document :type buf_sz: int :param buf_sz: the size of the buffer """ return _PDFNetPython.Convert_FromXps(args)
[docs] @staticmethod def FromEmf(in_pdfdoc, in_filename): r""" Convert the specified EMF to PDF and append converted pages to to the specified PDF document. EMF will be fitted to the page. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_filename: string :param in_filename: the path to the EMF document to convert Notes: This method is available only on Windows platforms. """ return _PDFNetPython.Convert_FromEmf(in_pdfdoc, in_filename)
[docs] @staticmethod def FromText(args): r""" Convert the specified plain text file to PDF and append converted pages to the specified PDF document. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_filename: string :param in_filename: the path to the plain text document to convert :type in_options: :py:class:`Obj` :param in_options: the conversion options. The available options are: | Option Name | Type | Note | |-------------------------|---------|---------------------------------------------------------| | BytesPerBite | Integer | In bytes. Use for streaming conversion only. | | FontFace | String | Set the font face used for the conversion. | | FontSize | Integer | Set the font size used for the conversion. | | LineHeightMultiplier | Double | Set the line height multiplier used for the conversion. | | MarginBottom | Double | In inches. Set the bottom margin of the page. | | MarginLeft | Double | In inches. Set the left margin of the page. | | MarginRight | Double | In inches. Set the right margin of the page. | | MarginTop | Double | In inches. Set the top margin of the page. | | PageHeight | Double | In inches. Set the page height. | | PageWidth | Double | In inches. Set the page width. | | UseSourceCodeFormatting | Boolean | Set whether to use mono font for the conversion. | """ return _PDFNetPython.Convert_FromText(args)
[docs] @staticmethod def ToEmf(args): r""" Overload 1: Convert the PDFDoc to EMF and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to EMF :type in_filename: string :param in_filename: the path to the EMF files to create, one file per page Notes: This method is available only on Windows platforms. | Overload 2: Convert the Page to EMF and save to the specified path :type in_page: :py:class:`Page` :param in_page: the Page to convert to EMF :type in_filename: string :param in_filename: the path to the EMF file to create Notes: This method is available only on Windows platforms. """ return _PDFNetPython.Convert_ToEmf(args)
[docs] @staticmethod def ToSvg(args): r""" Overload 1: Convert the PDFDoc to SVG and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to SVG :type in_filename: string :param in_filename: the path to the SVG files to create, one file per page :type in_options: :py:class:`SVGOutputOptions` :param in_options: the conversion options | Overload 2: Convert the PDFDoc to SVG and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to SVG :type in_filename: string :param in_filename: the path to the SVG files to create, one file per page | Overload 3: Convert the Page to SVG and save to the specified path :type in_page: :py:class:`Page` :param in_page: the Page to convert to SVG :type in_filename: string :param in_filename: the path to the SVG file to create :type in_options: :py:class:`SVGOutputOptions` :param in_options: the conversion options | Overload 4: Convert the Page to SVG and save to the specified path :type in_page: :py:class:`Page` :param in_page: the Page to convert to SVG :type in_filename: string :param in_filename: the path to the SVG file to create """ return _PDFNetPython.Convert_ToSvg(args)
[docs] @staticmethod def ToXps(args): r""" Overload 1: Convert the PDFDoc to XPS and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to XPS :type in_filename: string :param in_filename: the path to the document to create :type options: :py:class:`XPSOutputOptions` :param options: the conversion options See also: XPSOutputOptions | Overload 2: Convert the PDFDoc to XPS and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to XPS :type in_filename: string :param in_filename: the path to the document to create | Overload 3: Convert the input file to XPS format and save to the specified path :type in_inputFilename: string :param in_inputFilename: the file to convert to XPS :type in_outputFilename: string :param in_outputFilename: the path to the XPS file to create :type options: :py:class:`XPSOutputOptions` :param options: the conversion options See also: XPSOutputOptions See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 4: Convert the input file to XPS format and save to the specified path :type in_inputFilename: string :param in_inputFilename: the file to convert to XPS :type in_outputFilename: string :param in_outputFilename: the path to the XPS file to create See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. """ return _PDFNetPython.Convert_ToXps(args)
[docs] @staticmethod def PageToHtml(page): r""" Convert a page to HTML and return a string of the html :type page: :py:class:`Page` :param page: the page to convert to HTML :rtype: string :return: a string containing the page's html """ return _PDFNetPython.Convert_PageToHtml(page)
[docs] @staticmethod def PageToHtmlZoned(page, json_zones): return _PDFNetPython.Convert_PageToHtmlZoned(page, json_zones)
[docs] @staticmethod def ToHtml(args): r""" Overload 1: Convert a file to HTML and save to the specified path. In e_reflow_paragraphs mode, this conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to HTML :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`HTMLOutputOptions` :param options: the conversion options See also: HTMLOutputOptions See also: ToPdf() See also: StructuredOutputModule Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 2: Convert a file to HTML and save to the specified path :type in_filename: string :param in_filename: the file to convert to HTML :type out_path: string :param out_path: the path to where generated content will be stored See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 3: Convert the PDF to HTML and save to the specified path. In e_reflow_paragraphs mode, this conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to HTML :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`HTMLOutputOptions` :param options: the conversion options See also: HTMLOutputOptions See also: ToPdf() See also: StructuredOutputModule | Overload 4: Convert the PDF to HTML and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to HTML :type out_path: string :param out_path: the path to where generated content will be stored See also: ToPdf() """ return _PDFNetPython.Convert_ToHtml(args)
[docs] @staticmethod def ToWord(args): r""" Overload 1: Convert a PDF file to Word and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to Word :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`WordOutputOptions` :param options: the conversion options See also: WordOutputOptions See also: StructuredOutputModule | Overload 2: Convert a PDF file to Word and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to Word :type out_path: string :param out_path: the path to where generated content will be stored See also: StructuredOutputModule | Overload 3: Convert PDF to Word and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to Word :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`WordOutputOptions` :param options: the conversion options See also: WordOutputOptions See also: StructuredOutputModule See also: ToPdf() | Overload 4: Convert PDF to Word and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to Word :type out_path: string :param out_path: the path to where generated content will be stored See also: StructuredOutputModule See also: ToPdf() """ return _PDFNetPython.Convert_ToWord(args)
[docs] @staticmethod def ToExcel(args): r""" Overload 1: Convert a PDF file to Excel and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to Excel :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`ExcelOutputOptions` :param options: the conversion options See also: ExcelOutputOptions See also: StructuredOutputModule | Overload 2: Convert a PDF file to Excel and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to Excel :type out_path: string :param out_path: the path to where generated content will be stored See also: StructuredOutputModule | Overload 3: Convert PDF to Excel and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to Excel :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`ExcelOutputOptions` :param options: the conversion options See also: ExcelOutputOptions See also: StructuredOutputModule See also: ToPdf() | Overload 4: Convert PDF to Excel and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to Excel :type out_path: string :param out_path: the path to where generated content will be stored See also: StructuredOutputModule See also: ToPdf() """ return _PDFNetPython.Convert_ToExcel(args)
[docs] @staticmethod def ToPowerPoint(args): r""" Overload 1: Convert a PDF file to PowerPoint and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to PowerPoint :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`PowerPointOutputOptions` :param options: the conversion options See also: PowerPointOutputOptions See also: StructuredOutputModule | Overload 2: Convert a PDF file to PowerPoint and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to PowerPoint :type out_path: string :param out_path: the path to where generated content will be stored See also: StructuredOutputModule | Overload 3: Convert PDF to PowerPoint and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to PowerPoint :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`PowerPointOutputOptions` :param options: the conversion options See also: PowerPointOutputOptions See also: StructuredOutputModule See also: ToPdf() | Overload 4: Convert PDF to PowerPoint and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to PowerPoint :type out_path: string :param out_path: the path to where generated content will be stored See also: StructuredOutputModule See also: ToPdf() """ return _PDFNetPython.Convert_ToPowerPoint(args)
[docs] @staticmethod def ToEpub(args): r""" Overload 1: Convert a file to EPUB format and save to the specified path :type in_filename: string :param in_filename: the file to convert to EPUB :type out_path: string :param out_path: the path to the EPUB file to create :type html_options: :py:class:`HTMLOutputOptions` :param html_options: the conversion options :type epub_options: :py:class:`EPUBOutputOptions` :param epub_options: the conversion options See also: HTMLOutputOptions See also: EPUBOutputOptions See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 2: Convert a file to EPUB format and save to the specified path :type in_filename: string :param in_filename: the file to convert to EPUB :type out_path: string :param out_path: the path to the EPUB file to create :type html_options: :py:class:`HTMLOutputOptions` :param html_options: the conversion options See also: HTMLOutputOptions See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 3: Convert a file to EPUB format and save to the specified path :type in_filename: string :param in_filename: the file to convert to EPUB :type out_path: string :param out_path: the path to the EPUB file to create See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 4: Convert the PDFDoc to EPUB format and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to EPUB :type out_path: string :param out_path: the path to the EPUB file to create :type html_options: :py:class:`HTMLOutputOptions` :param html_options: the conversion options :type epub_options: :py:class:`EPUBOutputOptions` :param epub_options: the conversion options See also: HTMLOutputOptions See also: EPUBOutputOptions See also: ToPdf() | Overload 5: Convert the PDFDoc to EPUB format and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to EPUB :type out_path: string :param out_path: the path to the EPUB file to create :type html_options: :py:class:`HTMLOutputOptions` :param html_options: the conversion options See also: HTMLOutputOptions See also: ToPdf() | Overload 6: Convert the PDFDoc to EPUB format and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to EPUB :type out_path: string :param out_path: the path to the EPUB file to create See also: ToPdf() """ return _PDFNetPython.Convert_ToEpub(args)
[docs] @staticmethod def ToTiff(args): r""" Overload 1: Convert a file to multipage TIFF and save to the specified path :type in_filename: string :param in_filename: the file to convert to multipage TIFF :type out_path: string :param out_path: the path to the TIFF file to create :type options: :py:class:`TiffOutputOptions` :param options: the conversion options See also: TiffOutputOptions | Overload 2: Convert a file to multipage TIFF and save to the specified path :type in_filename: string :param in_filename: the file to convert to multipage TIFF :type out_path: string :param out_path: the path to the TIFF file to create | Overload 3: Convert the PDF to multipage TIFF and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to multipage TIFF :type out_path: string :param out_path: the path to the TIFF file to create :type options: :py:class:`TiffOutputOptions` :param options: the conversion options See also: TiffOutputOptions | Overload 4: Convert the PDF to multipage TIFF and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to multipage TIFF :type out_path: string :param out_path: the path to the TIFF file to create | Overload 5: Convert a file to multipage TIFF and write to the provided filter :type in_filename: string :param in_filename: the file to convert to multipage TIFF :type out_filter: :py:class:`Filter` :param out_filter: the output filter where the TIFF data will be written :type options: :py:class:`TiffOutputOptions` :param options: the conversion options See also: TiffOutputOptions | Overload 6: Convert a file to multipage TIFF and write to the provided filter :type in_filename: string :param in_filename: the file to convert to multipage TIFF :type out_filter: :py:class:`Filter` :param out_filter: the output filter where the TIFF data will be written | Overload 7: Convert the PDF to multipage TIFF and write to the provided filter :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to multipage TIFF :type out_filter: :py:class:`Filter` :param out_filter: the output filter where the TIFF data will be written :type options: :py:class:`TiffOutputOptions` :param options: the conversion options See also: TiffOutputOptions | Overload 8: Convert the PDF to multipage TIFF and write to the provided filter :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to multipage TIFF :type out_filter: :py:class:`Filter` :param out_filter: the output filter where the TIFF data will be written """ return _PDFNetPython.Convert_ToTiff(args)
[docs] @staticmethod def ToXod(args): r""" Overload 1: Convert the input file to XOD format and save to the specified path :type in_filename: string :param in_filename: the file to convert to XOD :type out_filename: string :param out_filename: the path to the XOD file to create :type options: :py:class:`XODOutputOptions` :param options: the conversion options See also: XODOutputOptions See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 2: Convert the input file to XOD format and save to the specified path :type in_filename: string :param in_filename: the file to convert to XOD :type out_filename: string :param out_filename: the path to the XOD file to create See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 3: Convert the input file to XOD format and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to XOD :type out_filename: string :param out_filename: the path to the XOD file to create :type options: :py:class:`XODOutputOptions` :param options: the conversion options See also: XODOutputOptions See also: ToPdf() | Overload 4: Convert the input file to XOD format and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to XOD :type out_filename: string :param out_filename: the path to the XOD file to create See also: ToPdf() | Overload 5: Generate a stream that incrementally converts the input file to XOD format. :type in_filename: string :param in_filename: the file to convert to XOD :type options: :py:class:`XODOutputOptions` :param options: the conversion options :rtype: :py:class:`Filter` :return: A filter from which the file can be read incrementally. See also: XODOutputOptions See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 6: Generate a stream that incrementally converts the input file to XOD format. :type in_filename: string :param in_filename: the file to convert to XOD :rtype: :py:class:`Filter` :return: A filter from which the file can be read incrementally. See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 7: Generate a stream that incrementally converts the input file to XOD format. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to XOD :type options: :py:class:`XODOutputOptions` :param options: the conversion options :rtype: :py:class:`Filter` :return: A filter from which the file can be read incrementally. See also: XODOutputOptions See also: ToPdf() | Overload 8: Generate a stream that incrementally converts the input file to XOD format. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to XOD :rtype: :py:class:`Filter` :return: A filter from which the file can be read incrementally. See also: ToPdf() """ return _PDFNetPython.Convert_ToXod(args)
[docs] @staticmethod def ToXodWithMonitor(args): return _PDFNetPython.Convert_ToXodWithMonitor(args)
[docs] @staticmethod def WordToPDF(args): r""" Overload 1: Convert the a Word document (in .docx format) to pdf and append to the specified PDF document. This conversion is performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_filename: string :param in_filename: the path to the source document. The source must be in .docx format. :type options: :py:class:`WordToPDFOptions` :param options: the conversion options :raises: PDFNetException See also: WordToPDFOptions See also: WordToPdfConversion() if you would like more control over the conversion process | Overload 2: Convert the a Word document (in .docx format) to pdf and append to the specified PDF document. This conversion is performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_stream: :py:class:`Filter` :param in_stream: the source document data. The source must be in .docx format. :type options: :py:class:`WordToPDFOptions` :param options: the conversion options :raises: PDFNetException See also: WordToPDFOptions See also: WordToPdfConversion() if you would like more control over the conversion process """ return _PDFNetPython.Convert_WordToPDF(args)
[docs] @staticmethod def WordToPDFConversion(args): r""" Overload 1: Create a DocumentConversion object suitable for converting a Word document (in .docx format) to pdf and appending to the specified PDF document. This conversion will be performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. This method allows for more control over the conversion process than the single call WordToPDF() interface. This method does not perform any conversion logic and can be expected to return quickly. To do the actual conversion, use the returned DocumentConversion object. See also: DocumentConversion Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_filename: string :param in_filename: the path to the source document. The source must be in .docx format. :type options: :py:class:`WordToPDFOptions` :param options: the conversion options :rtype: :py:class:`DocumentConversion` :return: A DocumentConversion object which encapsulates this particular conversion. See also: WordToPDFOptions | Overload 2: Create a DocumentConversion object suitable for converting a Word document (in .docx format) to pdf and appending to the specified PDF document. This conversion will be performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. This method allows for more control over the conversion process than the single call WordToPDF() interface. This method does not perform any conversion logic and can be expected to return quickly. To do the actual conversion, use the returned DocumentConversion object. See also: DocumentConversion Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_stream: :py:class:`Filter` :param in_stream: the source document data. The source must be in .docx format. :type options: :py:class:`WordToPDFOptions` :param options: the conversion options :rtype: :py:class:`DocumentConversion` :return: A DocumentConversion object which encapsulates this particular conversion. See also: WordToPDFOptions """ return _PDFNetPython.Convert_WordToPDFConversion(args)
[docs] @staticmethod def CreateReflow(in_page, json_zones): return _PDFNetPython.Convert_CreateReflow(in_page, json_zones)
[docs] @staticmethod def OfficeToPDF(args): r""" Overload 1: Convert the an office document (in .docx, .xlsx, pptx, or .doc format) to pdf and append to the specified PDF document. This conversion is performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_filename: string :param in_filename: the path to the source document. :type options: :py:class:`ConversionOptions` :param options: the conversion options :raises: PDFNetException See also: ConversionOptions See also: StreamingPDFConversion() if you would like more control over the conversion process | Overload 2: Convert the an office document (in .docx, .xlsx, pptx, or .doc format) to pdf and append to the specified PDF document. This conversion is performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_stream: :py:class:`Filter` :param in_stream: the source document data. :type options: :py:class:`ConversionOptions` :param options: the conversion options :raises: PDFNetException See also: ConversionOptions See also: StreamingPDFConversion() if you would like more control over the conversion process """ return _PDFNetPython.Convert_OfficeToPDF(args)
[docs] @staticmethod def StreamingPDFConversion(args): r""" Overload 1: Create a DocumentConversion object suitable for converting a file to pdf and appending to the specified PDF document. Handles incoming files in .docx, .xlsx, .pptx, .doc, .ppt, .xls, .png, .jpg, .bmp, .gif, .jp2, .tif, .txt, .xml and .md format This conversion will be performed entirely within PDFNet, and does not rely on any external functionality. This method allows for more control over the conversion process than the single call ToPDF() interface. It does not perform any conversion logic immediately, and can be expected to return quickly. To perform the actual conversion, use the returned DocumentConversion object. See also: DocumentConversion Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_filename: string :param in_filename: the path to the source document. :type options: :py:class:`ConversionOptions` :param options: the conversion options :rtype: :py:class:`DocumentConversion` :return: A DocumentConversion object which encapsulates this particular conversion. See also: ConversionOptions | Overload 2: Create a DocumentConversion object suitable for converting a file to pdf. Handles incoming files in .docx, .xlsx, .pptx, .doc, .ppt, .xls, .png, .jpg, .bmp, .gif, .jp2, .tif, .txt, .xml and .md format This conversion will be performed entirely within PDFNet, and does not rely on any external functionality. This method allows for more control over the conversion process than the single call ToPDF() interface. It does not perform any conversion logic immediately, and can be expected to return quickly. To perform the actual conversion, use the returned DocumentConversion object. See also: DocumentConversion Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_filename: string :param in_filename: the path to the source document. :type options: :py:class:`ConversionOptions` :param options: the conversion options :rtype: :py:class:`DocumentConversion` :return: A DocumentConversion object which encapsulates this particular conversion. See also: ConversionOptions | Overload 3: Create a DocumentConversion object suitable for converting an office document (in .docx, .xlsx, pptx, or .doc format) to pdf and appending to the specified PDF document. This conversion will be performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. This method does not perform any conversion logic and can be expected to return quickly. To do the actual conversion, use the returned DocumentConversion object. See also: DocumentConversion Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_stream: :py:class:`Filter` :param in_stream: the source document data. :type options: :py:class:`ConversionOptions` :param options: the conversion options :rtype: :py:class:`DocumentConversion` :return: A DocumentConversion object which encapsulates this particular conversion. See also: ConversionOptions | Overload 4: Create a DocumentConversion object suitable for converting an office document (in .docx, .xlsx, pptx, or .doc format) to pdf and appending to the specified PDF document. This conversion will be performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. This method does not perform any conversion logic and can be expected to return quickly. To do the actual conversion, use the returned DocumentConversion object. See also: DocumentConversion Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_stream: :py:class:`Filter` :param in_stream: the source document data. :type options: :py:class:`ConversionOptions` :param options: the conversion options :rtype: :py:class:`DocumentConversion` :return: A DocumentConversion object which encapsulates this particular conversion. See also: ConversionOptions """ return _PDFNetPython.Convert_StreamingPDFConversion(args)
[docs] @staticmethod def ToPdf(in_pdfdoc, in_filename): r""" Convert the file or document to PDF and append to the specified PDF document :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append the converted document to. The PDFDoc can then be converted to XPS, EMF or SVG using the other functions in this class. :type in_filename: string :param in_filename: the path to the document to be converted to pdf Notes: Internally formats include BMP, EMF, JPEG, PNG, TIF, XPS. Formats that require external applications for conversion use the Convert::Printer class and the PDFNet printer to be installed. This is only supported on Windows platforms. Document formats in this category include RTF(MS Word or Wordpad), TXT (Notepad or Wordpad), DOC and DOCX (MS Word), PPT and PPTX (MS PowerPoint), XLS and XLSX (MS Excel), OpenOffice documents, HTML and MHT (Internet Explorer), PUB (MS Publisher), MSG (MS Outlook). """ return _PDFNetPython.Convert_ToPdf(in_pdfdoc, in_filename)
[docs] @staticmethod def FromCAD(in_pdfdoc, in_filename, opts=None): r""" Convert the specified CAD file to PDF and append converted pages to the specified PDF document. This conversion requires that the optional PDFTron CAD add-on module is available. See the `CADConvertOptions` class for the available options. See also: the 'CADModule' class :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_filename: string :param in_filename: the path to the CAD document to convert :type opts: :py:class:`CADConvertOptions` :param opts: The options to use when converting. """ return _PDFNetPython.Convert_FromCAD(in_pdfdoc, in_filename, opts)
[docs] @staticmethod def FromDICOM(in_pdfdoc, in_filename, opts=None): r""" Convert the specified AdvancedImaging file to PDF and append converted pages to the specified PDF document. This conversion requires that the optional PDFTron AdvancedImaging add-on module is available. See also: the 'AdvancedImagingModule' class :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_filename: string :param in_filename: the path to the CAD document to convert :type opts: AdvancedImagingConvertOptions :param opts: The options to use when converting. """ return _PDFNetPython.Convert_FromDICOM(in_pdfdoc, in_filename, opts)
[docs] @staticmethod def FromSVG(in_pdfdoc, in_filename, opts=None): r""" Convert the specified SVG file to PDF and append converted pages to the specified PDF document. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_filename: string :param in_filename: the path to the CAD document to convert :type opts: :py:class:`SVGConvertOptions` :param opts: The options to use when converting. """ return _PDFNetPython.Convert_FromSVG(in_pdfdoc, in_filename, opts)
[docs] @staticmethod def FromTiff(in_pdfdoc, in_data): r""" Convert the specified TIFF filter to PDF and append converted pages to the specified PDF document. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_data: :py:class:`Filter` :param in_data: the source TIFF data. """ return _PDFNetPython.Convert_FromTiff(in_pdfdoc, in_data)
[docs] @staticmethod def CreateOfficeTemplate(args): r""" Overload 1: Create a TemplateDocument object from an office file suitable for generating any number of PDFs from supplied template data. Template filling will be performed entirely within PDFNet, and handles incoming files in .docx, .xlsx, .pptx, .doc, .ppt, and .xls format This method does not perform any template filling and can be expected to return quickly. To do the actual work, use the returned TemplateDocument object See also: TemplateDocument Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_filename: string :param in_filename: the path to the source document. :type options: :py:class:`ConversionOptions` :param options: the office to pdf conversion options :rtype: :py:class:`TemplateDocument` :return: A TemplateDocument object which encapsulates this particular office template. See also: ConversionOptions | Overload 2: Create a TemplateDocument object from an office file suitable for generating any number of PDFs from supplied template data. Template filling will be performed entirely within PDFNet, and handles incoming files in .docx, .xlsx, .pptx, .doc, .ppt, and .xls format This method does not perform any template filling and can be expected to return quickly. To do the actual work, use the returned TemplateDocument object See also: TemplateDocument Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_stream: :py:class:`Filter` :param in_stream: the source document data. :type options: :py:class:`ConversionOptions` :param options: the office to pdf conversion options :rtype: :py:class:`TemplateDocument` :return: A TemplateDocument object which encapsulates this particular office template. See also: ConversionOptions """ return _PDFNetPython.Convert_CreateOfficeTemplate(args)
[docs] @staticmethod def RequiresPrinter(in_filename): r""" Utility function to determine if ToPdf or ToXps will require the PDFNet printer to convert a specific external file to PDF. :type in_filename: string :param in_filename: the path to the document to be checked :rtype: boolean :return: true if ToPdf requires the printer to convert the file, false otherwise. Notes: Current implementation looks only at the file extension not file contents. If the file extension is missing, false will be returned """ return _PDFNetPython.Convert_RequiresPrinter(in_filename)
# Register Convert in _PDFNetPython: _PDFNetPython.Convert_swigregister(Convert)
[docs] def Convert_FromXps(args): r""" Overload 1: Convert the specified XPS document to PDF and append converted pages to the specified PDF document. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_filename: string :param in_filename: the path to the XPS document to convert | Overload 2: Convert the specified XPS document contained in memory to PDF and append converted pages to the specified PDF document. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type buf: string :param buf: the buffer containing the xps document :type buf_sz: int :param buf_sz: the size of the buffer """ return _PDFNetPython.Convert_FromXps(args)
[docs] def Convert_FromEmf(in_pdfdoc, in_filename): r""" Convert the specified EMF to PDF and append converted pages to to the specified PDF document. EMF will be fitted to the page. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_filename: string :param in_filename: the path to the EMF document to convert Notes: This method is available only on Windows platforms. """ return _PDFNetPython.Convert_FromEmf(in_pdfdoc, in_filename)
[docs] def Convert_FromText(args): r""" Convert the specified plain text file to PDF and append converted pages to the specified PDF document. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_filename: string :param in_filename: the path to the plain text document to convert :type in_options: :py:class:`Obj` :param in_options: the conversion options. The available options are: | Option Name | Type | Note | |-------------------------|---------|---------------------------------------------------------| | BytesPerBite | Integer | In bytes. Use for streaming conversion only. | | FontFace | String | Set the font face used for the conversion. | | FontSize | Integer | Set the font size used for the conversion. | | LineHeightMultiplier | Double | Set the line height multiplier used for the conversion. | | MarginBottom | Double | In inches. Set the bottom margin of the page. | | MarginLeft | Double | In inches. Set the left margin of the page. | | MarginRight | Double | In inches. Set the right margin of the page. | | MarginTop | Double | In inches. Set the top margin of the page. | | PageHeight | Double | In inches. Set the page height. | | PageWidth | Double | In inches. Set the page width. | | UseSourceCodeFormatting | Boolean | Set whether to use mono font for the conversion. | """ return _PDFNetPython.Convert_FromText(args)
[docs] def Convert_ToEmf(args): r""" Overload 1: Convert the PDFDoc to EMF and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to EMF :type in_filename: string :param in_filename: the path to the EMF files to create, one file per page Notes: This method is available only on Windows platforms. | Overload 2: Convert the Page to EMF and save to the specified path :type in_page: :py:class:`Page` :param in_page: the Page to convert to EMF :type in_filename: string :param in_filename: the path to the EMF file to create Notes: This method is available only on Windows platforms. """ return _PDFNetPython.Convert_ToEmf(args)
[docs] def Convert_ToSvg(args): r""" Overload 1: Convert the PDFDoc to SVG and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to SVG :type in_filename: string :param in_filename: the path to the SVG files to create, one file per page :type in_options: :py:class:`SVGOutputOptions` :param in_options: the conversion options | Overload 2: Convert the PDFDoc to SVG and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to SVG :type in_filename: string :param in_filename: the path to the SVG files to create, one file per page | Overload 3: Convert the Page to SVG and save to the specified path :type in_page: :py:class:`Page` :param in_page: the Page to convert to SVG :type in_filename: string :param in_filename: the path to the SVG file to create :type in_options: :py:class:`SVGOutputOptions` :param in_options: the conversion options | Overload 4: Convert the Page to SVG and save to the specified path :type in_page: :py:class:`Page` :param in_page: the Page to convert to SVG :type in_filename: string :param in_filename: the path to the SVG file to create """ return _PDFNetPython.Convert_ToSvg(args)
[docs] def Convert_ToXps(args): r""" Overload 1: Convert the PDFDoc to XPS and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to XPS :type in_filename: string :param in_filename: the path to the document to create :type options: :py:class:`XPSOutputOptions` :param options: the conversion options See also: XPSOutputOptions | Overload 2: Convert the PDFDoc to XPS and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to XPS :type in_filename: string :param in_filename: the path to the document to create | Overload 3: Convert the input file to XPS format and save to the specified path :type in_inputFilename: string :param in_inputFilename: the file to convert to XPS :type in_outputFilename: string :param in_outputFilename: the path to the XPS file to create :type options: :py:class:`XPSOutputOptions` :param options: the conversion options See also: XPSOutputOptions See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 4: Convert the input file to XPS format and save to the specified path :type in_inputFilename: string :param in_inputFilename: the file to convert to XPS :type in_outputFilename: string :param in_outputFilename: the path to the XPS file to create See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. """ return _PDFNetPython.Convert_ToXps(args)
[docs] def Convert_PageToHtml(page): r""" Convert a page to HTML and return a string of the html :type page: :py:class:`Page` :param page: the page to convert to HTML :rtype: string :return: a string containing the page's html """ return _PDFNetPython.Convert_PageToHtml(page)
[docs] def Convert_PageToHtmlZoned(page, json_zones): return _PDFNetPython.Convert_PageToHtmlZoned(page, json_zones)
[docs] def Convert_ToHtml(args): r""" Overload 1: Convert a file to HTML and save to the specified path. In e_reflow_paragraphs mode, this conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to HTML :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`HTMLOutputOptions` :param options: the conversion options See also: HTMLOutputOptions See also: ToPdf() See also: StructuredOutputModule Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 2: Convert a file to HTML and save to the specified path :type in_filename: string :param in_filename: the file to convert to HTML :type out_path: string :param out_path: the path to where generated content will be stored See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 3: Convert the PDF to HTML and save to the specified path. In e_reflow_paragraphs mode, this conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to HTML :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`HTMLOutputOptions` :param options: the conversion options See also: HTMLOutputOptions See also: ToPdf() See also: StructuredOutputModule | Overload 4: Convert the PDF to HTML and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to HTML :type out_path: string :param out_path: the path to where generated content will be stored See also: ToPdf() """ return _PDFNetPython.Convert_ToHtml(args)
[docs] def Convert_ToWord(args): r""" Overload 1: Convert a PDF file to Word and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to Word :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`WordOutputOptions` :param options: the conversion options See also: WordOutputOptions See also: StructuredOutputModule | Overload 2: Convert a PDF file to Word and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to Word :type out_path: string :param out_path: the path to where generated content will be stored See also: StructuredOutputModule | Overload 3: Convert PDF to Word and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to Word :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`WordOutputOptions` :param options: the conversion options See also: WordOutputOptions See also: StructuredOutputModule See also: ToPdf() | Overload 4: Convert PDF to Word and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to Word :type out_path: string :param out_path: the path to where generated content will be stored See also: StructuredOutputModule See also: ToPdf() """ return _PDFNetPython.Convert_ToWord(args)
[docs] def Convert_ToExcel(args): r""" Overload 1: Convert a PDF file to Excel and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to Excel :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`ExcelOutputOptions` :param options: the conversion options See also: ExcelOutputOptions See also: StructuredOutputModule | Overload 2: Convert a PDF file to Excel and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to Excel :type out_path: string :param out_path: the path to where generated content will be stored See also: StructuredOutputModule | Overload 3: Convert PDF to Excel and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to Excel :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`ExcelOutputOptions` :param options: the conversion options See also: ExcelOutputOptions See also: StructuredOutputModule See also: ToPdf() | Overload 4: Convert PDF to Excel and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to Excel :type out_path: string :param out_path: the path to where generated content will be stored See also: StructuredOutputModule See also: ToPdf() """ return _PDFNetPython.Convert_ToExcel(args)
[docs] def Convert_ToPowerPoint(args): r""" Overload 1: Convert a PDF file to PowerPoint and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to PowerPoint :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`PowerPointOutputOptions` :param options: the conversion options See also: PowerPointOutputOptions See also: StructuredOutputModule | Overload 2: Convert a PDF file to PowerPoint and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_filename: string :param in_filename: the file to convert to PowerPoint :type out_path: string :param out_path: the path to where generated content will be stored See also: StructuredOutputModule | Overload 3: Convert PDF to PowerPoint and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to PowerPoint :type out_path: string :param out_path: the path to where generated content will be stored :type options: :py:class:`PowerPointOutputOptions` :param options: the conversion options See also: PowerPointOutputOptions See also: StructuredOutputModule See also: ToPdf() | Overload 4: Convert PDF to PowerPoint and save the output to the specified path. This conversion requires that the optional PDFTron StructuredOutput add-on module is available. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to PowerPoint :type out_path: string :param out_path: the path to where generated content will be stored See also: StructuredOutputModule See also: ToPdf() """ return _PDFNetPython.Convert_ToPowerPoint(args)
[docs] def Convert_ToEpub(args): r""" Overload 1: Convert a file to EPUB format and save to the specified path :type in_filename: string :param in_filename: the file to convert to EPUB :type out_path: string :param out_path: the path to the EPUB file to create :type html_options: :py:class:`HTMLOutputOptions` :param html_options: the conversion options :type epub_options: :py:class:`EPUBOutputOptions` :param epub_options: the conversion options See also: HTMLOutputOptions See also: EPUBOutputOptions See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 2: Convert a file to EPUB format and save to the specified path :type in_filename: string :param in_filename: the file to convert to EPUB :type out_path: string :param out_path: the path to the EPUB file to create :type html_options: :py:class:`HTMLOutputOptions` :param html_options: the conversion options See also: HTMLOutputOptions See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 3: Convert a file to EPUB format and save to the specified path :type in_filename: string :param in_filename: the file to convert to EPUB :type out_path: string :param out_path: the path to the EPUB file to create See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 4: Convert the PDFDoc to EPUB format and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to EPUB :type out_path: string :param out_path: the path to the EPUB file to create :type html_options: :py:class:`HTMLOutputOptions` :param html_options: the conversion options :type epub_options: :py:class:`EPUBOutputOptions` :param epub_options: the conversion options See also: HTMLOutputOptions See also: EPUBOutputOptions See also: ToPdf() | Overload 5: Convert the PDFDoc to EPUB format and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to EPUB :type out_path: string :param out_path: the path to the EPUB file to create :type html_options: :py:class:`HTMLOutputOptions` :param html_options: the conversion options See also: HTMLOutputOptions See also: ToPdf() | Overload 6: Convert the PDFDoc to EPUB format and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to EPUB :type out_path: string :param out_path: the path to the EPUB file to create See also: ToPdf() """ return _PDFNetPython.Convert_ToEpub(args)
[docs] def Convert_ToTiff(args): r""" Overload 1: Convert a file to multipage TIFF and save to the specified path :type in_filename: string :param in_filename: the file to convert to multipage TIFF :type out_path: string :param out_path: the path to the TIFF file to create :type options: :py:class:`TiffOutputOptions` :param options: the conversion options See also: TiffOutputOptions | Overload 2: Convert a file to multipage TIFF and save to the specified path :type in_filename: string :param in_filename: the file to convert to multipage TIFF :type out_path: string :param out_path: the path to the TIFF file to create | Overload 3: Convert the PDF to multipage TIFF and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to multipage TIFF :type out_path: string :param out_path: the path to the TIFF file to create :type options: :py:class:`TiffOutputOptions` :param options: the conversion options See also: TiffOutputOptions | Overload 4: Convert the PDF to multipage TIFF and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to multipage TIFF :type out_path: string :param out_path: the path to the TIFF file to create | Overload 5: Convert a file to multipage TIFF and write to the provided filter :type in_filename: string :param in_filename: the file to convert to multipage TIFF :type out_filter: :py:class:`Filter` :param out_filter: the output filter where the TIFF data will be written :type options: :py:class:`TiffOutputOptions` :param options: the conversion options See also: TiffOutputOptions | Overload 6: Convert a file to multipage TIFF and write to the provided filter :type in_filename: string :param in_filename: the file to convert to multipage TIFF :type out_filter: :py:class:`Filter` :param out_filter: the output filter where the TIFF data will be written | Overload 7: Convert the PDF to multipage TIFF and write to the provided filter :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to multipage TIFF :type out_filter: :py:class:`Filter` :param out_filter: the output filter where the TIFF data will be written :type options: :py:class:`TiffOutputOptions` :param options: the conversion options See also: TiffOutputOptions | Overload 8: Convert the PDF to multipage TIFF and write to the provided filter :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDF doc to convert to multipage TIFF :type out_filter: :py:class:`Filter` :param out_filter: the output filter where the TIFF data will be written """ return _PDFNetPython.Convert_ToTiff(args)
[docs] def Convert_ToXod(args): r""" Overload 1: Convert the input file to XOD format and save to the specified path :type in_filename: string :param in_filename: the file to convert to XOD :type out_filename: string :param out_filename: the path to the XOD file to create :type options: :py:class:`XODOutputOptions` :param options: the conversion options See also: XODOutputOptions See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 2: Convert the input file to XOD format and save to the specified path :type in_filename: string :param in_filename: the file to convert to XOD :type out_filename: string :param out_filename: the path to the XOD file to create See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 3: Convert the input file to XOD format and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to XOD :type out_filename: string :param out_filename: the path to the XOD file to create :type options: :py:class:`XODOutputOptions` :param options: the conversion options See also: XODOutputOptions See also: ToPdf() | Overload 4: Convert the input file to XOD format and save to the specified path :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to XOD :type out_filename: string :param out_filename: the path to the XOD file to create See also: ToPdf() | Overload 5: Generate a stream that incrementally converts the input file to XOD format. :type in_filename: string :param in_filename: the file to convert to XOD :type options: :py:class:`XODOutputOptions` :param options: the conversion options :rtype: :py:class:`Filter` :return: A filter from which the file can be read incrementally. See also: XODOutputOptions See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 6: Generate a stream that incrementally converts the input file to XOD format. :type in_filename: string :param in_filename: the file to convert to XOD :rtype: :py:class:`Filter` :return: A filter from which the file can be read incrementally. See also: ToPdf() Notes: Requires the Convert::Printer class for all file formats that ToPdf also requires. | Overload 7: Generate a stream that incrementally converts the input file to XOD format. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to XOD :type options: :py:class:`XODOutputOptions` :param options: the conversion options :rtype: :py:class:`Filter` :return: A filter from which the file can be read incrementally. See also: XODOutputOptions See also: ToPdf() | Overload 8: Generate a stream that incrementally converts the input file to XOD format. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to convert to XOD :rtype: :py:class:`Filter` :return: A filter from which the file can be read incrementally. See also: ToPdf() """ return _PDFNetPython.Convert_ToXod(args)
[docs] def Convert_ToXodWithMonitor(args): return _PDFNetPython.Convert_ToXodWithMonitor(args)
[docs] def Convert_WordToPDF(args): r""" Overload 1: Convert the a Word document (in .docx format) to pdf and append to the specified PDF document. This conversion is performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_filename: string :param in_filename: the path to the source document. The source must be in .docx format. :type options: :py:class:`WordToPDFOptions` :param options: the conversion options :raises: PDFNetException See also: WordToPDFOptions See also: WordToPdfConversion() if you would like more control over the conversion process | Overload 2: Convert the a Word document (in .docx format) to pdf and append to the specified PDF document. This conversion is performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_stream: :py:class:`Filter` :param in_stream: the source document data. The source must be in .docx format. :type options: :py:class:`WordToPDFOptions` :param options: the conversion options :raises: PDFNetException See also: WordToPDFOptions See also: WordToPdfConversion() if you would like more control over the conversion process """ return _PDFNetPython.Convert_WordToPDF(args)
[docs] def Convert_WordToPDFConversion(args): r""" Overload 1: Create a DocumentConversion object suitable for converting a Word document (in .docx format) to pdf and appending to the specified PDF document. This conversion will be performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. This method allows for more control over the conversion process than the single call WordToPDF() interface. This method does not perform any conversion logic and can be expected to return quickly. To do the actual conversion, use the returned DocumentConversion object. See also: DocumentConversion Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_filename: string :param in_filename: the path to the source document. The source must be in .docx format. :type options: :py:class:`WordToPDFOptions` :param options: the conversion options :rtype: :py:class:`DocumentConversion` :return: A DocumentConversion object which encapsulates this particular conversion. See also: WordToPDFOptions | Overload 2: Create a DocumentConversion object suitable for converting a Word document (in .docx format) to pdf and appending to the specified PDF document. This conversion will be performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. This method allows for more control over the conversion process than the single call WordToPDF() interface. This method does not perform any conversion logic and can be expected to return quickly. To do the actual conversion, use the returned DocumentConversion object. See also: DocumentConversion Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_stream: :py:class:`Filter` :param in_stream: the source document data. The source must be in .docx format. :type options: :py:class:`WordToPDFOptions` :param options: the conversion options :rtype: :py:class:`DocumentConversion` :return: A DocumentConversion object which encapsulates this particular conversion. See also: WordToPDFOptions """ return _PDFNetPython.Convert_WordToPDFConversion(args)
[docs] def Convert_CreateReflow(in_page, json_zones): return _PDFNetPython.Convert_CreateReflow(in_page, json_zones)
[docs] def Convert_OfficeToPDF(args): r""" Overload 1: Convert the an office document (in .docx, .xlsx, pptx, or .doc format) to pdf and append to the specified PDF document. This conversion is performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_filename: string :param in_filename: the path to the source document. :type options: :py:class:`ConversionOptions` :param options: the conversion options :raises: PDFNetException See also: ConversionOptions See also: StreamingPDFConversion() if you would like more control over the conversion process | Overload 2: Convert the an office document (in .docx, .xlsx, pptx, or .doc format) to pdf and append to the specified PDF document. This conversion is performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_stream: :py:class:`Filter` :param in_stream: the source document data. :type options: :py:class:`ConversionOptions` :param options: the conversion options :raises: PDFNetException See also: ConversionOptions See also: StreamingPDFConversion() if you would like more control over the conversion process """ return _PDFNetPython.Convert_OfficeToPDF(args)
[docs] def Convert_StreamingPDFConversion(args): r""" Overload 1: Create a DocumentConversion object suitable for converting a file to pdf and appending to the specified PDF document. Handles incoming files in .docx, .xlsx, .pptx, .doc, .ppt, .xls, .png, .jpg, .bmp, .gif, .jp2, .tif, .txt, .xml and .md format This conversion will be performed entirely within PDFNet, and does not rely on any external functionality. This method allows for more control over the conversion process than the single call ToPDF() interface. It does not perform any conversion logic immediately, and can be expected to return quickly. To perform the actual conversion, use the returned DocumentConversion object. See also: DocumentConversion Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_filename: string :param in_filename: the path to the source document. :type options: :py:class:`ConversionOptions` :param options: the conversion options :rtype: :py:class:`DocumentConversion` :return: A DocumentConversion object which encapsulates this particular conversion. See also: ConversionOptions | Overload 2: Create a DocumentConversion object suitable for converting a file to pdf. Handles incoming files in .docx, .xlsx, .pptx, .doc, .ppt, .xls, .png, .jpg, .bmp, .gif, .jp2, .tif, .txt, .xml and .md format This conversion will be performed entirely within PDFNet, and does not rely on any external functionality. This method allows for more control over the conversion process than the single call ToPDF() interface. It does not perform any conversion logic immediately, and can be expected to return quickly. To perform the actual conversion, use the returned DocumentConversion object. See also: DocumentConversion Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_filename: string :param in_filename: the path to the source document. :type options: :py:class:`ConversionOptions` :param options: the conversion options :rtype: :py:class:`DocumentConversion` :return: A DocumentConversion object which encapsulates this particular conversion. See also: ConversionOptions | Overload 3: Create a DocumentConversion object suitable for converting an office document (in .docx, .xlsx, pptx, or .doc format) to pdf and appending to the specified PDF document. This conversion will be performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. This method does not perform any conversion logic and can be expected to return quickly. To do the actual conversion, use the returned DocumentConversion object. See also: DocumentConversion Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the conversion result will be appended to this pdf. :type in_stream: :py:class:`Filter` :param in_stream: the source document data. :type options: :py:class:`ConversionOptions` :param options: the conversion options :rtype: :py:class:`DocumentConversion` :return: A DocumentConversion object which encapsulates this particular conversion. See also: ConversionOptions | Overload 4: Create a DocumentConversion object suitable for converting an office document (in .docx, .xlsx, pptx, or .doc format) to pdf and appending to the specified PDF document. This conversion will be performed entirely within PDFNet, and does not rely on Word interop or any other external functionality. This method does not perform any conversion logic and can be expected to return quickly. To do the actual conversion, use the returned DocumentConversion object. See also: DocumentConversion Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_stream: :py:class:`Filter` :param in_stream: the source document data. :type options: :py:class:`ConversionOptions` :param options: the conversion options :rtype: :py:class:`DocumentConversion` :return: A DocumentConversion object which encapsulates this particular conversion. See also: ConversionOptions """ return _PDFNetPython.Convert_StreamingPDFConversion(args)
[docs] def Convert_ToPdf(in_pdfdoc, in_filename): r""" Convert the file or document to PDF and append to the specified PDF document :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append the converted document to. The PDFDoc can then be converted to XPS, EMF or SVG using the other functions in this class. :type in_filename: string :param in_filename: the path to the document to be converted to pdf Notes: Internally formats include BMP, EMF, JPEG, PNG, TIF, XPS. Formats that require external applications for conversion use the Convert::Printer class and the PDFNet printer to be installed. This is only supported on Windows platforms. Document formats in this category include RTF(MS Word or Wordpad), TXT (Notepad or Wordpad), DOC and DOCX (MS Word), PPT and PPTX (MS PowerPoint), XLS and XLSX (MS Excel), OpenOffice documents, HTML and MHT (Internet Explorer), PUB (MS Publisher), MSG (MS Outlook). """ return _PDFNetPython.Convert_ToPdf(in_pdfdoc, in_filename)
[docs] def Convert_FromCAD(in_pdfdoc, in_filename, opts=None): r""" Convert the specified CAD file to PDF and append converted pages to the specified PDF document. This conversion requires that the optional PDFTron CAD add-on module is available. See the `CADConvertOptions` class for the available options. See also: the 'CADModule' class :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_filename: string :param in_filename: the path to the CAD document to convert :type opts: :py:class:`CADConvertOptions` :param opts: The options to use when converting. """ return _PDFNetPython.Convert_FromCAD(in_pdfdoc, in_filename, opts)
[docs] def Convert_FromDICOM(in_pdfdoc, in_filename, opts=None): r""" Convert the specified AdvancedImaging file to PDF and append converted pages to the specified PDF document. This conversion requires that the optional PDFTron AdvancedImaging add-on module is available. See also: the 'AdvancedImagingModule' class :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_filename: string :param in_filename: the path to the CAD document to convert :type opts: AdvancedImagingConvertOptions :param opts: The options to use when converting. """ return _PDFNetPython.Convert_FromDICOM(in_pdfdoc, in_filename, opts)
[docs] def Convert_FromSVG(in_pdfdoc, in_filename, opts=None): r""" Convert the specified SVG file to PDF and append converted pages to the specified PDF document. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_filename: string :param in_filename: the path to the CAD document to convert :type opts: :py:class:`SVGConvertOptions` :param opts: The options to use when converting. """ return _PDFNetPython.Convert_FromSVG(in_pdfdoc, in_filename, opts)
[docs] def Convert_FromTiff(in_pdfdoc, in_data): r""" Convert the specified TIFF filter to PDF and append converted pages to the specified PDF document. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to append to :type in_data: :py:class:`Filter` :param in_data: the source TIFF data. """ return _PDFNetPython.Convert_FromTiff(in_pdfdoc, in_data)
[docs] def Convert_CreateOfficeTemplate(args): r""" Overload 1: Create a TemplateDocument object from an office file suitable for generating any number of PDFs from supplied template data. Template filling will be performed entirely within PDFNet, and handles incoming files in .docx, .xlsx, .pptx, .doc, .ppt, and .xls format This method does not perform any template filling and can be expected to return quickly. To do the actual work, use the returned TemplateDocument object See also: TemplateDocument Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_filename: string :param in_filename: the path to the source document. :type options: :py:class:`ConversionOptions` :param options: the office to pdf conversion options :rtype: :py:class:`TemplateDocument` :return: A TemplateDocument object which encapsulates this particular office template. See also: ConversionOptions | Overload 2: Create a TemplateDocument object from an office file suitable for generating any number of PDFs from supplied template data. Template filling will be performed entirely within PDFNet, and handles incoming files in .docx, .xlsx, .pptx, .doc, .ppt, and .xls format This method does not perform any template filling and can be expected to return quickly. To do the actual work, use the returned TemplateDocument object See also: TemplateDocument Notes: Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion :type in_stream: :py:class:`Filter` :param in_stream: the source document data. :type options: :py:class:`ConversionOptions` :param options: the office to pdf conversion options :rtype: :py:class:`TemplateDocument` :return: A TemplateDocument object which encapsulates this particular office template. See also: ConversionOptions """ return _PDFNetPython.Convert_CreateOfficeTemplate(args)
[docs] def Convert_RequiresPrinter(in_filename): r""" Utility function to determine if ToPdf or ToXps will require the PDFNet printer to convert a specific external file to PDF. :type in_filename: string :param in_filename: the path to the document to be checked :rtype: boolean :return: true if ToPdf requires the printer to convert the file, false otherwise. Notes: Current implementation looks only at the file extension not file contents. If the file extension is missing, false will be returned """ return _PDFNetPython.Convert_RequiresPrinter(in_filename)
[docs] class XPSOutputCommonOptions(object): r"""A class containing options common to ToXps and ToXod functions""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Creates an XPSConvertOptions object with default settings""" _PDFNetPython.XPSOutputCommonOptions_swiginit(self, _PDFNetPython.new_XPSOutputCommonOptions())
[docs] def SetPrintMode(self, print_mode): r""" Sets whether ToXps should be run in print mode. Default is false. :type print_mode: boolean :param print_mode: if true print mode is enabled """ return _PDFNetPython.XPSOutputCommonOptions_SetPrintMode(self, print_mode)
[docs] def SetDPI(self, dpi): r""" The output resolution, from 1 to 1000, in Dots Per Inch (DPI) at which to render elements which cannot be directly converted. Default is 140. :type dpi: int :param dpi: the resolution in Dots Per Inch """ return _PDFNetPython.XPSOutputCommonOptions_SetDPI(self, dpi)
[docs] def SetRenderPages(self, render): r""" Sets whether rendering of pages should be permitted when necessary to guarantee output. Default is true. :type render: boolean :param render: if false rendering is not permitted under any circumstance """ return _PDFNetPython.XPSOutputCommonOptions_SetRenderPages(self, render)
[docs] def SetThickenLines(self, thicken): r""" Sets whether thin lines should be thickened. Default is true for XPS and false for XOD. :type thicken: boolean :param thicken: if true then thin lines will be thickened """ return _PDFNetPython.XPSOutputCommonOptions_SetThickenLines(self, thicken)
e_op_off = _PDFNetPython.XPSOutputCommonOptions_e_op_off e_op_on = _PDFNetPython.XPSOutputCommonOptions_e_op_on e_op_pdfx_on = _PDFNetPython.XPSOutputCommonOptions_e_op_pdfx_on
[docs] def SetOverprint(self, mode): r""" Enable or disable support for overprint and overprint simulation. Overprint is a device dependent feature and the results will vary depending on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc). Default is e_op_pdfx_on. :type mode: int :param mode: e_op_on: always enabled; e_op_off: always disabled; e_op_pdfx_on: enabled for PDF/X files only. """ return _PDFNetPython.XPSOutputCommonOptions_SetOverprint(self, mode)
m_obj = property(_PDFNetPython.XPSOutputCommonOptions_m_obj_get, _PDFNetPython.XPSOutputCommonOptions_m_obj_set) __swig_destroy__ = _PDFNetPython.delete_XPSOutputCommonOptions
# Register XPSOutputCommonOptions in _PDFNetPython: _PDFNetPython.XPSOutputCommonOptions_swigregister(XPSOutputCommonOptions)
[docs] class XPSOutputOptions(XPSOutputCommonOptions): r"""A class containing options for ToXps functions""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def SetOpenXps(self, openxps): r""" Sets whether the output format should be open xps. Default is Microsoft xps output. :type openxps: boolean :param openxps: if true open xps output is used """ return _PDFNetPython.XPSOutputOptions_SetOpenXps(self, openxps)
def __init__(self): _PDFNetPython.XPSOutputOptions_swiginit(self, _PDFNetPython.new_XPSOutputOptions()) __swig_destroy__ = _PDFNetPython.delete_XPSOutputOptions
# Register XPSOutputOptions in _PDFNetPython: _PDFNetPython.XPSOutputOptions_swigregister(XPSOutputOptions)
[docs] class XODOutputOptions(XPSOutputCommonOptions): r"""A class containing options for ToXod functions""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_internal_xfdf = _PDFNetPython.XODOutputOptions_e_internal_xfdf e_external_xfdf = _PDFNetPython.XODOutputOptions_e_external_xfdf e_flatten = _PDFNetPython.XODOutputOptions_e_flatten
[docs] def SetExtractUsingZorder(self, use_zorder): r""" Sets whether text extraction uses Z-order as reading order. Default is false. :type use_zorder: boolean :param use_zorder: if true text extraction uses Z-order as reading order. """ return _PDFNetPython.XODOutputOptions_SetExtractUsingZorder(self, use_zorder)
[docs] def SetOutputThumbnails(self, include_thumbs): r""" Sets whether per page thumbnails should be included in the file. Default is true. :type include_thumbs: boolean :param include_thumbs: if true thumbnails will be included """ return _PDFNetPython.XODOutputOptions_SetOutputThumbnails(self, include_thumbs)
[docs] def SetThumbnailSize(self, args): r""" Overload 1: The width and height of a square in which thumbnails will be contained. Default is 400 for normal pages and 1500 for large pages. Notes: A large page is a page larger than twice the area of the standard page size (8.5 X 11). :type size: int :param size: the maximum dimension (width or height) that thumbnails will have. | Overload 2: The width and height of squares in which thumbnails will be contained. Default is 400 for normal pages and 1500 for large pages. Notes: A large page is a page larger than twice the area of the standard page size (8.5 X 11). :type regular_size: int :param regular_size: the maximum dimension that thumbnails for regular size pages will have. :type large_size: int :param large_size: the maximum dimension that thumbnails for large pages will have. """ return _PDFNetPython.XODOutputOptions_SetThumbnailSize(self, args)
[docs] def SetElementLimit(self, element_limit): r""" If rendering is permitted, sets the maximum number of page elements before that page will be rendered. Default is 2000000000 which will never cause pages to be completely rendered in this manner. :type element_limit: int :param element_limit: the maximum number of elements before a given page will be rendered """ return _PDFNetPython.XODOutputOptions_SetElementLimit(self, element_limit)
[docs] def SetOpacityMaskWorkaround(self, opacity_render): r""" If rendering is permitted, sets whether pages containing opacity masks should be rendered. This option is used as a workaround to a bug in Silverlight where opacity masks are transformed incorrectly. Default is false. :type opacity_render: boolean :param opacity_render: if true pages with opacity masks will be rendered """ return _PDFNetPython.XODOutputOptions_SetOpacityMaskWorkaround(self, opacity_render)
[docs] def SetMaximumImagePixels(self, max_pixels): r""" Specifies the maximum image slice size in pixels. Default is 2000000. Notes: This setting now will no longer reduce the total number of image pixels. Instead a lower value will just produce more slices and vice versa. Since image compression works better with more pixels a larger max pixels should generally create smaller files. :type max_pixels: int :param max_pixels: the maximum number of pixels an image can have """ return _PDFNetPython.XODOutputOptions_SetMaximumImagePixels(self, max_pixels)
[docs] def SetFlattenContent(self, flatten): r""" Flatten images and paths into a single background image overlaid with vector text. This option can be used to improve speed on devices with little processing power such as iPads. Default is e_high_quality. :type flatten: int :param flatten: select which flattening mode to use. """ return _PDFNetPython.XODOutputOptions_SetFlattenContent(self, flatten)
[docs] def SetFlattenThreshold(self, threshold): r""" Used to control how precise or relaxed text flattening is. When some text is preserved (not flattened to image) the visual appearance of the document may be altered. :type threshold: int :param threshold: the threshold setting to use. """ return _PDFNetPython.XODOutputOptions_SetFlattenThreshold(self, threshold)
[docs] def SetPreferJPG(self, prefer_jpg): r""" Where possible output JPG files rather than PNG. This will apply to both thumbnails and document images. Default is true. :type prefer_jpg: boolean :param prefer_jpg: if true JPG images will be used whenever possible. """ return _PDFNetPython.XODOutputOptions_SetPreferJPG(self, prefer_jpg)
[docs] def SetJPGQuality(self, quality): r""" Specifies the compression quality to use when generating JPEG images. :type quality: int :param quality: the JPEG compression quality, from 0(highest compression) to 100(best quality). """ return _PDFNetPython.XODOutputOptions_SetJPGQuality(self, quality)
[docs] def SetSilverlightTextWorkaround(self, workaround): r""" Outputs rotated text as paths. This option is used as a workaround to a bug in Silverlight where pages with rotated text could cause the plugin to crash. Default is false. :type workaround: boolean :param workaround: if true rotated text will be changed to paths """ return _PDFNetPython.XODOutputOptions_SetSilverlightTextWorkaround(self, workaround)
[docs] def SetAnnotationOutput(self, annot_output): r""" Choose how to output annotations. Default is e_internal_xfdf. :type annot_output: int :param annot_output: the flag to specify the output option """ return _PDFNetPython.XODOutputOptions_SetAnnotationOutput(self, annot_output)
[docs] def SetExternalParts(self, generate): r""" Output XOD as a collection of loose files rather than a zip archive. This option should be used when using the external part retriever in Webviewer. Default is false. :type generate: boolean :param generate: if true XOD is output as a collection of loose files """ return _PDFNetPython.XODOutputOptions_SetExternalParts(self, generate)
[docs] def SetEncryptPassword(self, _pass): r""" Encrypt XOD parts with AES 128 encryption using the supplied password. This option is not available when using SetExternalParts(true) :type pass: string :param pass: the encryption password """ return _PDFNetPython.XODOutputOptions_SetEncryptPassword(self, _pass)
[docs] def UseSilverlightFlashCompatible(self, compatible): r""" The latest XOD format is only partially supported in Silverlight and Flash due to various optimizations in the text format and the addition of blend mode support. This option forces the converter to use an older version of XOD that is Silverlight/Flash compatible but does not have these improvements. By default the latest XOD format is generated. :type compatible: boolean :param compatible: if true will use the older XOD format which is not compatible with Silverlight/Flash """ return _PDFNetPython.XODOutputOptions_UseSilverlightFlashCompatible(self, compatible)
def __init__(self): _PDFNetPython.XODOutputOptions_swiginit(self, _PDFNetPython.new_XODOutputOptions()) __swig_destroy__ = _PDFNetPython.delete_XODOutputOptions
# Register XODOutputOptions in _PDFNetPython: _PDFNetPython.XODOutputOptions_swigregister(XODOutputOptions)
[docs] class OutputOptionsOCR(object): r"""A class containing OCR options common to the ToHtml, ToWord, ToExcel, ToPowerPoint functions""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_lang_auto = _PDFNetPython.OutputOptionsOCR_e_lang_auto e_lang_catalan = _PDFNetPython.OutputOptionsOCR_e_lang_catalan e_lang_danish = _PDFNetPython.OutputOptionsOCR_e_lang_danish e_lang_german = _PDFNetPython.OutputOptionsOCR_e_lang_german e_lang_english = _PDFNetPython.OutputOptionsOCR_e_lang_english e_lang_spanish = _PDFNetPython.OutputOptionsOCR_e_lang_spanish e_lang_finnish = _PDFNetPython.OutputOptionsOCR_e_lang_finnish e_lang_french = _PDFNetPython.OutputOptionsOCR_e_lang_french e_lang_italian = _PDFNetPython.OutputOptionsOCR_e_lang_italian e_lang_dutch = _PDFNetPython.OutputOptionsOCR_e_lang_dutch e_lang_norwegian = _PDFNetPython.OutputOptionsOCR_e_lang_norwegian e_lang_portuguese = _PDFNetPython.OutputOptionsOCR_e_lang_portuguese e_lang_polish = _PDFNetPython.OutputOptionsOCR_e_lang_polish e_lang_romanian = _PDFNetPython.OutputOptionsOCR_e_lang_romanian e_lang_russian = _PDFNetPython.OutputOptionsOCR_e_lang_russian e_lang_slovenian = _PDFNetPython.OutputOptionsOCR_e_lang_slovenian e_lang_swedish = _PDFNetPython.OutputOptionsOCR_e_lang_swedish e_lang_turkish = _PDFNetPython.OutputOptionsOCR_e_lang_turkish e_engine_default = _PDFNetPython.OutputOptionsOCR_e_engine_default e_engine_tesseract = _PDFNetPython.OutputOptionsOCR_e_engine_tesseract
[docs] @staticmethod def LanguageChoiceToString(language): return _PDFNetPython.OutputOptionsOCR_LanguageChoiceToString(language)
[docs] @staticmethod def PreferredOCRChoiceToString(engine): return _PDFNetPython.OutputOptionsOCR_PreferredOCRChoiceToString(engine)
def __init__(self): _PDFNetPython.OutputOptionsOCR_swiginit(self, _PDFNetPython.new_OutputOptionsOCR()) __swig_destroy__ = _PDFNetPython.delete_OutputOptionsOCR
# Register OutputOptionsOCR in _PDFNetPython: _PDFNetPython.OutputOptionsOCR_swigregister(OutputOptionsOCR)
[docs] def OutputOptionsOCR_LanguageChoiceToString(language): return _PDFNetPython.OutputOptionsOCR_LanguageChoiceToString(language)
[docs] def OutputOptionsOCR_PreferredOCRChoiceToString(engine): return _PDFNetPython.OutputOptionsOCR_PreferredOCRChoiceToString(engine)
[docs] class HTMLOutputOptions(object): r"""A class containing options common to ToHtml and ToEpub functions""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Creates an HTMLOutputCommonOptions object with default settings""" _PDFNetPython.HTMLOutputOptions_swiginit(self, _PDFNetPython.new_HTMLOutputOptions())
[docs] def SetPreferJPG(self, prefer_jpg): r""" Use JPG files rather than PNG. This will apply to all generated images. Default is true. Notes: This option is only available for e_fixed_position and e_reflow_paragraphs modes. :type prefer_jpg: boolean :param prefer_jpg: if true JPG images will be used whenever possible. """ return _PDFNetPython.HTMLOutputOptions_SetPreferJPG(self, prefer_jpg)
[docs] def SetJPGQuality(self, quality): r""" Specifies the compression quality to use when generating JPEG images. Notes: This option is only available for e_fixed_position and e_reflow_paragraphs modes. In e_reflow_full mode, the optimal JPEG quality is chosen automatically for best balance between size and quality. :type quality: int :param quality: the JPEG compression quality, from 0 (highest compression) to 100 (best quality). """ return _PDFNetPython.HTMLOutputOptions_SetJPGQuality(self, quality)
[docs] def SetDPI(self, dpi): r""" The output resolution, from 1 to 1000, in Dots Per Inch (DPI) at which to render elements which cannot be directly converted. Default is 140. Notes: This option is only available for e_fixed_position mode. :type dpi: int :param dpi: the resolution in Dots Per Inch """ return _PDFNetPython.HTMLOutputOptions_SetDPI(self, dpi)
[docs] def SetMaximumImagePixels(self, max_pixels): r""" Specifies the maximum image slice size in pixels. Default is 2000000. Notes: This setting now will no longer reduce the total number of image pixels. Instead a lower value will just produce more slices and vice versa. Since image compression works better with more pixels a larger max pixels should generally create smaller files. This option is only available for e_fixed_position mode. :type max_pixels: int :param max_pixels: the maximum number of pixels an image can have """ return _PDFNetPython.HTMLOutputOptions_SetMaximumImagePixels(self, max_pixels)
e_fixed_position = _PDFNetPython.HTMLOutputOptions_e_fixed_position e_reflow_paragraphs = _PDFNetPython.HTMLOutputOptions_e_reflow_paragraphs e_reflow_full = _PDFNetPython.HTMLOutputOptions_e_reflow_full
[docs] def SetContentReflowSetting(self, reflow): r""" Switch between fixed (pre-paginated) and reflowable HTML generation. Default is e_fixed_position. In e_reflow_paragraphs mode (now deprecated), conversions require that the optional PDFTron HTML reflow paragraphs add-on module is available. In e_reflow_full mode, conversions require that the optional PDFTron StructuredOutput add-on module is available. :type reflow: int :param reflow: the generated HTML will be either fixed or reflowable. See also: ContentReflowSetting See also: StructuredOutputModule See also: PDF2HtmlReflowParagraphsModule """ return _PDFNetPython.HTMLOutputOptions_SetContentReflowSetting(self, reflow)
[docs] def SetScale(self, scale): r""" Set an overall scaling of the generated HTML pages. Default is 1.0. :type scale: double :param scale: A number greater than 0 which is used as a scale factor. For example, calling SetScale(0.5) will reduce the HTML body of the page to half its original size, whereas SetScale(2) will double the HTML body dimensions of the page and will rescale all page content appropriately. Notes: This option is only available for e_fixed_position mode. """ return _PDFNetPython.HTMLOutputOptions_SetScale(self, scale)
[docs] def SetSimplifyText(self, enable): r""" Controls whether converter optimizes DOM or preserves text placement accuracy. Default is false. :type enable: boolean :param enable: if true, converter will try to reduce DOM complexity at the expense of text placement accuracy. Notes: This option is only available for e_fixed_position mode. """ return _PDFNetPython.HTMLOutputOptions_SetSimplifyText(self, enable)
[docs] def SetReportFile(self, path): r""" Generate a XML file that contains additional information about the conversion process. By default no report is generated. :type path: string :param path: the file path to which the XML report is written to. Notes: This option is only available for e_fixed_position mode. """ return _PDFNetPython.HTMLOutputOptions_SetReportFile(self, path)
[docs] def SetTitle(self, title): r""" Specifies the title for the output HTML. Notes: This option is only available for e_reflow_paragraphs mode. HTML titles are not supported in other modes at the moment. :type title: string :param title: the title of the output HTML. """ return _PDFNetPython.HTMLOutputOptions_SetTitle(self, title)
[docs] def SetImageDPI(self, dpi): r""" Specifies the output image resolution, from 8 to 600, in Pixels Per Inch (PPI). The higher the PPI, the larger the image. Default is 192. Notes: This option is only available for e_reflow_paragraphs mode. In other modes, image resolution is determined automatically for an optimal result. :type dpi: int :param dpi: the resolution in Pixels Per Inch. """ return _PDFNetPython.HTMLOutputOptions_SetImageDPI(self, dpi)
[docs] def SetEmbedImages(self, embed): r""" Specifies whether images are embedded in the HTML without having to link to external files. Default is true. Notes: This option is only available for e_reflow_paragraphs and e_reflow_full modes. :type embed: boolean :param embed: if true, images are embedd in the HTML, otherwise, images are saved as external files. """ return _PDFNetPython.HTMLOutputOptions_SetEmbedImages(self, embed)
[docs] def SetFileConversionTimeoutSeconds(self, seconds): r""" Specifies the amount of time in seconds after which the conversion fails. Default is 300. Very long files need more time to convert. Notes: This option is only available for e_reflow_paragraphs mode. The timeout feature is not necessary in other modes. :type seconds: int :param seconds: the timeout in seconds. """ return _PDFNetPython.HTMLOutputOptions_SetFileConversionTimeoutSeconds(self, seconds)
[docs] def SetPages(self, page_from, page_to): r""" Specifies a range of pages to be converted. By default all pages are converted. The first page has the page number of 1. Notes: This option is only available for e_reflow_paragraphs and e_reflow_full modes. :type page_from: int :param page_from: the first page to be converted. :type page_to: int :param page_to: the last page to be converted (inclusive). Use a negative value to specify the last page in the PDF. """ return _PDFNetPython.HTMLOutputOptions_SetPages(self, page_from, page_to)
[docs] def SetPDFPassword(self, password): r""" Specifies the password if the PDF requires one. Notes: This option is only available for e_reflow_paragraphs and e_reflow_full modes. :type password: string :param password: the PDF password, if required; an empty string otherwise. """ return _PDFNetPython.HTMLOutputOptions_SetPDFPassword(self, password)
e_ocr_image_text = _PDFNetPython.HTMLOutputOptions_e_ocr_image_text e_ocr_image = _PDFNetPython.HTMLOutputOptions_e_ocr_image e_ocr_text = _PDFNetPython.HTMLOutputOptions_e_ocr_text e_ocr_off = _PDFNetPython.HTMLOutputOptions_e_ocr_off e_ocr_always = _PDFNetPython.HTMLOutputOptions_e_ocr_always
[docs] def SetSearchableImageSetting(self, setting): r""" Specifies how scanned image pages should be converted. Default is e_ocr_image_text. Notes: This option is only available for e_reflow_paragraphs and e_reflow_full modes. :type setting: int :param setting: the searchable image setting. Remarks: In e_reflow_paragraphs mode, this feature does not perform OCR, but instead it relies on pre-existing text from previous OCR. Both images and pre-existing hidden text are kept by default. In e_reflow_full mode, pre-existing OCRed content is ignored and a new OCR is performed from scratch by default. e_ocr_off can be used to disable OCR. See also: SearchableImageSetting """ return _PDFNetPython.HTMLOutputOptions_SetSearchableImageSetting(self, setting)
[docs] def SetSimpleLists(self, enable): r""" Determines whether to use tags for list items. Default is false. Notes: This option is only available for e_reflow_paragraphs mode. In e_reflow_full mode, list items always use tags. :type enable: boolean :param enable: if true, tags are used for list items. """ return _PDFNetPython.HTMLOutputOptions_SetSimpleLists(self, enable)
[docs] def SetConnectHyphens(self, connect): r""" Specifies whether hyphens in the PDF should be connected. Default is false. Notes: This option is only available for e_reflow_paragraphs and e_reflow_full modes. :type connect: boolean :param connect: if true, hyphens in the PDF will be connected. """ return _PDFNetPython.HTMLOutputOptions_SetConnectHyphens(self, connect)
[docs] def SetDisableVerticalSplit(self, disable): r""" Specifies whether to disable the detection of section columns. Default is false. Enable this if your tables are coming out as section columns. Notes: This option is only available for e_reflow_paragraphs mode. In e_reflow_full mode, columns are detected automatically. :type disable: boolean :param disable: if true, the detection of section columns are disabled. """ return _PDFNetPython.HTMLOutputOptions_SetDisableVerticalSplit(self, disable)
[docs] def SetNoPageWidth(self, enable): r""" Determines whether to flow contents across the entire browser window. Default is false. Notes: This option is only available for e_reflow_paragraphs mode. In e_reflow_full mode, content always flows across the entire browser window. :type enable: boolean :param enable: if true, content will flow across entire page. """ return _PDFNetPython.HTMLOutputOptions_SetNoPageWidth(self, enable)
[docs] def SetLanguage(self, language): r""" Specifies the OCR language. Default is automatic language detection. Notes: This option is only available for e_reflow_full mode. :type language: int :param language: the OCR language. """ return _PDFNetPython.HTMLOutputOptions_SetLanguage(self, language)
__swig_destroy__ = _PDFNetPython.delete_HTMLOutputOptions
# Register HTMLOutputOptions in _PDFNetPython: _PDFNetPython.HTMLOutputOptions_swigregister(HTMLOutputOptions)
[docs] class WordOutputOptions(object): r"""A class containing options common to ToWord functions""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Creates a WordOutputOptions object with default settings.""" _PDFNetPython.WordOutputOptions_swiginit(self, _PDFNetPython.new_WordOutputOptions()) e_wof_docx = _PDFNetPython.WordOutputOptions_e_wof_docx e_wof_doc = _PDFNetPython.WordOutputOptions_e_wof_doc e_wof_rtf = _PDFNetPython.WordOutputOptions_e_wof_rtf e_wof_txt = _PDFNetPython.WordOutputOptions_e_wof_txt
[docs] def SetWordOutputFormat(self, format): r""" Specifies the output document format (DOCX, RTF, TXT). It is the most useful when the output file extension is not .docx, .rtf or .txt. :type format: int :param format: the output document format (DOCX, RTF, TXT). Remarks: The DOC file format is now deprecated, DOCX is used automatically instead. See also: WordOutputFormat """ return _PDFNetPython.WordOutputOptions_SetWordOutputFormat(self, format)
[docs] def SetPages(self, page_from, page_to): r""" Specifies a range of pages to be converted. By default all pages are converted. The first page has the page number of 1. :type page_from: int :param page_from: the first page to be converted. :type page_to: int :param page_to: the last page to be converted (inclusive). Use a negative value to specify the last page in the PDF. """ return _PDFNetPython.WordOutputOptions_SetPages(self, page_from, page_to)
[docs] def SetPDFPassword(self, password): r""" Specifies the password if the PDF requires one. :type password: string :param password: the PDF password, if required; an empty string otherwise. """ return _PDFNetPython.WordOutputOptions_SetPDFPassword(self, password)
e_ocr_image_text = _PDFNetPython.WordOutputOptions_e_ocr_image_text e_ocr_image = _PDFNetPython.WordOutputOptions_e_ocr_image e_ocr_text = _PDFNetPython.WordOutputOptions_e_ocr_text e_ocr_off = _PDFNetPython.WordOutputOptions_e_ocr_off e_ocr_always = _PDFNetPython.WordOutputOptions_e_ocr_always
[docs] def SetSearchableImageSetting(self, setting): r""" Specifies how scanned image pages should be converted. Default is e_ocr_text. :type setting: int :param setting: the searchable image setting. Remarks: Pre-existing OCRed content is ignored and a new OCR is performed from scratch. See also: SearchableImageSetting """ return _PDFNetPython.WordOutputOptions_SetSearchableImageSetting(self, setting)
[docs] def SetConnectHyphens(self, connect): r""" Specifies whether hyphens in the PDF should be connected. Default is false. :type connect: boolean :param connect: if true, hyphens in the PDF will be connected. """ return _PDFNetPython.WordOutputOptions_SetConnectHyphens(self, connect)
[docs] def SetLanguage(self, language): r""" Specifies the OCR language. Default is automatic language detection. :type language: int :param language: the OCR language. """ return _PDFNetPython.WordOutputOptions_SetLanguage(self, language)
[docs] def SetPreferredOCREngine(self, engine): r""" Specifies preferred OCR engine. :type engine: int :param engine: The PreferredOCREngine to OCR. """ return _PDFNetPython.WordOutputOptions_SetPreferredOCREngine(self, engine)
[docs] def SetCustomOCRLanguage(self, ocrlang): r""" Specifies the custom OCR languages to use. Notes: Use 3-letter ISO 639-2 language codes, separated by spaces. Example: "eng deu spa fra". The default is English. :type ocrlang: string :param ocrlang: the OCR language(s). """ return _PDFNetPython.WordOutputOptions_SetCustomOCRLanguage(self, ocrlang)
[docs] def SetPrioritizeVisualAppearance(self, replica): r""" Specifies whether to prefer an exact visual replica of the PDF at the expense of preventing reflow of document paragraphs. Default is false. :type replica: boolean :param replica: False is preferred for most documents that contain paragraphs. Consider using true for documents that don't flow, such as CAD drawings, Illustrator-generated files. """ return _PDFNetPython.WordOutputOptions_SetPrioritizeVisualAppearance(self, replica)
__swig_destroy__ = _PDFNetPython.delete_WordOutputOptions
# Register WordOutputOptions in _PDFNetPython: _PDFNetPython.WordOutputOptions_swigregister(WordOutputOptions)
[docs] class ExcelOutputOptions(object): r"""A class containing options common to ToExcel functions""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Creates a ExcelOutputOptions object with default settings.""" _PDFNetPython.ExcelOutputOptions_swiginit(self, _PDFNetPython.new_ExcelOutputOptions())
[docs] def SetPages(self, page_from, page_to): r""" Specifies a range of pages to be converted. By default all pages are converted. The first page has the page number of 1. :type page_from: int :param page_from: the first page to be converted. :type page_to: int :param page_to: the last page to be converted (inclusive). Use a negative value to specify the last page in the PDF. """ return _PDFNetPython.ExcelOutputOptions_SetPages(self, page_from, page_to)
[docs] def SetPDFPassword(self, password): r""" Specifies the password if the PDF requires one. :type password: string :param password: the PDF password, if required; an empty string otherwise. """ return _PDFNetPython.ExcelOutputOptions_SetPDFPassword(self, password)
[docs] def SetLanguage(self, language): r""" Specifies the OCR language. Default is automatic language detection. :type language: int :param language: the OCR language. """ return _PDFNetPython.ExcelOutputOptions_SetLanguage(self, language)
[docs] def SetPreferredOCREngine(self, engine): r""" Specifies preferred OCR engine. :type engine: int :param engine: The PreferredOCREngine to OCR. """ return _PDFNetPython.ExcelOutputOptions_SetPreferredOCREngine(self, engine)
[docs] def SetCustomOCRLanguage(self, ocrlang): r""" Specifies the custom OCR languages to use. Notes: Use 3-letter ISO 639-2 language codes, separated by spaces. Example: "eng deu spa fra". The default is English. :type ocrlang: string :param ocrlang: the OCR language(s). """ return _PDFNetPython.ExcelOutputOptions_SetCustomOCRLanguage(self, ocrlang)
e_ocr_text = _PDFNetPython.ExcelOutputOptions_e_ocr_text e_ocr_off = _PDFNetPython.ExcelOutputOptions_e_ocr_off e_ocr_always = _PDFNetPython.ExcelOutputOptions_e_ocr_always
[docs] def SetSearchableImageSetting(self, setting): r""" Specifies how scanned image pages should be converted. Default is e_ocr_text. :type setting: int :param setting: the searchable image setting. Remarks: Pre-existing OCRed content is ignored and a new OCR is performed from scratch. See also: SearchableImageSetting """ return _PDFNetPython.ExcelOutputOptions_SetSearchableImageSetting(self, setting)
[docs] def SetNonTableContent(self, non_tables): r""" Specifies whether to convert non-tabular content. Default is false. :type non_tables: boolean :param non_tables: If false, only tabular content is converted to Excel. If true, all textual content is converted to Excel. """ return _PDFNetPython.ExcelOutputOptions_SetNonTableContent(self, non_tables)
[docs] def SetSingleSheet(self, single_sheet): r""" Specifies whether to combine all tables into a single sheet. Default is false. :type single_sheet: boolean :param single_sheet: If false, each logical table goes to a separate Excel sheet. If true, all logical tables are combined into a single Excel sheet. """ return _PDFNetPython.ExcelOutputOptions_SetSingleSheet(self, single_sheet)
__swig_destroy__ = _PDFNetPython.delete_ExcelOutputOptions
# Register ExcelOutputOptions in _PDFNetPython: _PDFNetPython.ExcelOutputOptions_swigregister(ExcelOutputOptions)
[docs] class PowerPointOutputOptions(object): r"""A class containing options common to ToPowerPoint functions""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Creates a PowerPointOutputOptions object with default settings.""" _PDFNetPython.PowerPointOutputOptions_swiginit(self, _PDFNetPython.new_PowerPointOutputOptions())
[docs] def SetPages(self, page_from, page_to): r""" Specifies a range of pages to be converted. By default all pages are converted. The first page has the page number of 1. :type page_from: int :param page_from: the first page to be converted. :type page_to: int :param page_to: the last page to be converted (inclusive). Use a negative value to specify the last page in the PDF. """ return _PDFNetPython.PowerPointOutputOptions_SetPages(self, page_from, page_to)
[docs] def SetPDFPassword(self, password): r""" Specifies the password if the PDF requires one. :type password: string :param password: the PDF password, if required; an empty string otherwise. """ return _PDFNetPython.PowerPointOutputOptions_SetPDFPassword(self, password)
[docs] def SetLanguage(self, language): r""" Specifies the OCR language. Default is automatic language detection. :type language: int :param language: the OCR language. """ return _PDFNetPython.PowerPointOutputOptions_SetLanguage(self, language)
[docs] def SetPreferredOCREngine(self, engine): r""" Specifies preferred OCR engine. :type engine: int :param engine: The PreferredOCREngine to OCR. """ return _PDFNetPython.PowerPointOutputOptions_SetPreferredOCREngine(self, engine)
[docs] def SetCustomOCRLanguage(self, ocrlang): r""" Specifies the custom OCR languages to use. Notes: Use 3-letter ISO 639-2 language codes, separated by spaces. Example: "eng deu spa fra". The default is English. :type ocrlang: string :param ocrlang: the OCR language(s). """ return _PDFNetPython.PowerPointOutputOptions_SetCustomOCRLanguage(self, ocrlang)
e_ocr_text = _PDFNetPython.PowerPointOutputOptions_e_ocr_text e_ocr_off = _PDFNetPython.PowerPointOutputOptions_e_ocr_off e_ocr_always = _PDFNetPython.PowerPointOutputOptions_e_ocr_always
[docs] def SetSearchableImageSetting(self, setting): r""" Specifies how scanned image pages should be converted. Default is e_ocr_text. :type setting: int :param setting: the searchable image setting. Remarks: Pre-existing OCRed content is ignored and a new OCR is performed from scratch. See also: SearchableImageSetting """ return _PDFNetPython.PowerPointOutputOptions_SetSearchableImageSetting(self, setting)
__swig_destroy__ = _PDFNetPython.delete_PowerPointOutputOptions
# Register PowerPointOutputOptions in _PDFNetPython: _PDFNetPython.PowerPointOutputOptions_swigregister(PowerPointOutputOptions)
[docs] class EPUBOutputOptions(object): r"""A class containing options common to ToEpub functions""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Creates an EPUBOutputOptions object with default settings""" _PDFNetPython.EPUBOutputOptions_swiginit(self, _PDFNetPython.new_EPUBOutputOptions())
[docs] def SetExpanded(self, expanded): r""" Create the EPUB in expanded format. Default is false. :type expanded: boolean :param expanded: if false a single EPUB file will be generated, otherwise, the generated EPUB will be in unzipped (expanded) format """ return _PDFNetPython.EPUBOutputOptions_SetExpanded(self, expanded)
[docs] def SetReuseCover(self, reuse): r""" Set whether the first content page in the EPUB uses the cover image or not. If this is set to true, then the first content page will simply wrap the cover image in HTML. Otherwise, the page will be converted the same as all other pages in the EPUB. Default is false. :type reuse: boolean :param reuse: if true the first page will simply be EPUB cover image, otherwise, the first page will be converted the same as the other pages """ return _PDFNetPython.EPUBOutputOptions_SetReuseCover(self, reuse)
__swig_destroy__ = _PDFNetPython.delete_EPUBOutputOptions
# Register EPUBOutputOptions in _PDFNetPython: _PDFNetPython.EPUBOutputOptions_swigregister(EPUBOutputOptions)
[docs] class SVGOutputOptions(object): r"""A class containing options for ToSvg functions""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Creates an SVGOutputOptions object with default settings""" _PDFNetPython.SVGOutputOptions_swiginit(self, _PDFNetPython.new_SVGOutputOptions())
[docs] def SetEmbedImages(self, embed_images): r""" Sets whether to embed all images :type embed_images: boolean :param embed_images: if true, images will be embedded. Default is false. """ return _PDFNetPython.SVGOutputOptions_SetEmbedImages(self, embed_images)
[docs] def SetNoFonts(self, no_fonts): r""" Sets whether to disable conversion of font data to SVG :type no_fonts: boolean :param no_fonts: if true, font data conversion is disabled. Default is false. """ return _PDFNetPython.SVGOutputOptions_SetNoFonts(self, no_fonts)
[docs] def SetSvgFonts(self, svg_fonts): r""" Sets whether to convert all fonts to SVG or not. :type svg_fonts: boolean :param svg_fonts: if true, fonts are converted to SVG. Otherwise they are converted to OpenType. Default is false. """ return _PDFNetPython.SVGOutputOptions_SetSvgFonts(self, svg_fonts)
[docs] def SetEmbedFonts(self, embed_fonts): r""" Sets whether to embed fonts into each SVG page file, or to have them shared. :type embed_fonts: boolean :param embed_fonts: if true, fonts are injected into each SVG page. Otherwise they are created as separate files that are shared between SVG pages. Default is false. """ return _PDFNetPython.SVGOutputOptions_SetEmbedFonts(self, embed_fonts)
[docs] def SetNoUnicode(self, no_unicode): r""" Sets whether to disable mapping of text to public Unicode region. Instead text will be converted using a custom encoding :type no_unicode: boolean :param no_unicode: if true, mapping of text to public Unicode region is disabled """ return _PDFNetPython.SVGOutputOptions_SetNoUnicode(self, no_unicode)
[docs] def SetIndividualCharPlacement(self, individual_char_placement): r""" Some viewers do not support the default text positioning correctly. This option works around this issue to place text correctly, but produces verbose output. This option will override SetRemoveCharPlacement :type individual_char_placement: boolean :param individual_char_placement: if true, text will be positioned correctly """ return _PDFNetPython.SVGOutputOptions_SetIndividualCharPlacement(self, individual_char_placement)
[docs] def SetRemoveCharPlacement(self, remove_char_placement): r""" Sets whether to disable the output of character positions. This will produce slightly smaller output files than the default setting, but many viewers do not support the output correctly :type remove_char_placement: boolean :param remove_char_placement: if true, the output of character positions is disabled """ return _PDFNetPython.SVGOutputOptions_SetRemoveCharPlacement(self, remove_char_placement)
[docs] def SetFlattenContent(self, flatten): r""" Flatten images and paths into a single background image overlaid with vector text. This option can be used to improve speed on devices with little processing power such as iPads. Default is e_fast. :type flatten: int :param flatten: select which flattening mode to use. """ return _PDFNetPython.SVGOutputOptions_SetFlattenContent(self, flatten)
[docs] def SetFlattenThreshold(self, threshold): r""" Used to control how precise or relaxed text flattening is. When some text is preserved (not flattened to image) the visual appearance of the document may be altered. :type threshold: int :param threshold: the threshold setting to use. """ return _PDFNetPython.SVGOutputOptions_SetFlattenThreshold(self, threshold)
[docs] def SetFlattenDPI(self, dpi): r""" The output resolution, from 1 to 1000, in Dots Per Inch (DPI) at which to render elements which cannot be directly converted. Default is 140. :type dpi: int :param dpi: the resolution in Dots Per Inch """ return _PDFNetPython.SVGOutputOptions_SetFlattenDPI(self, dpi)
[docs] def SetFlattenMaximumImagePixels(self, max_pixels): r""" Specifies the maximum image slice size in pixels. Default is 2000000. Notes: This setting now will no longer reduce the total number of image pixels. Instead a lower value will just produce more slices and vice versa. Since image compression works better with more pixels a larger max pixels should generally create smaller files. :type max_pixels: int :param max_pixels: the maximum number of pixels an image can have """ return _PDFNetPython.SVGOutputOptions_SetFlattenMaximumImagePixels(self, max_pixels)
[docs] def SetCompress(self, svgz): r""" Compress output SVG files using SVGZ. :type svgz: boolean :param svgz: if true, SVG files are written in compressed format. Default is false. """ return _PDFNetPython.SVGOutputOptions_SetCompress(self, svgz)
[docs] def SetOutputThumbnails(self, include_thumbs): r""" Sets whether per page thumbnails should be included in the file. Default is true. :type include_thumbs: boolean :param include_thumbs: if true thumbnails will be included """ return _PDFNetPython.SVGOutputOptions_SetOutputThumbnails(self, include_thumbs)
[docs] def SetThumbnailSize(self, size): r""" The maximum dimension for thumbnails. :type size: int :param size: the maximum dimension (width or height) that thumbnails will have. Default is 400. """ return _PDFNetPython.SVGOutputOptions_SetThumbnailSize(self, size)
[docs] def SetCreateXmlWrapper(self, xml): r""" Create a XML document that contains metadata of the SVG document created. :type xml: boolean :param xml: if true, XML wrapper is created. Default is true. """ return _PDFNetPython.SVGOutputOptions_SetCreateXmlWrapper(self, xml)
[docs] def SetDtd(self, dtd): r""" Set whether the DTD declaration is included in the SVG files. :type dtd: boolean :param dtd: if false, no DTD is added to SVG files. Default is true. """ return _PDFNetPython.SVGOutputOptions_SetDtd(self, dtd)
[docs] def SetAnnots(self, annots): r""" Control generation of form fields and annotations in SVG. :type annots: boolean :param annots: if false, no form fields or annotations are converted. Default is true """ return _PDFNetPython.SVGOutputOptions_SetAnnots(self, annots)
[docs] def SetOverprint(self, mode): r""" Enable or disable support for overprint and overprint simulation. Overprint is a device dependent feature and the results will vary depending on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc). Default is e_op_pdfx_on. :param op: e_op_on: always enabled; e_op_off: always disabled; e_op_pdfx_on: enabled for PDF/X files only. """ return _PDFNetPython.SVGOutputOptions_SetOverprint(self, mode)
__swig_destroy__ = _PDFNetPython.delete_SVGOutputOptions
# Register SVGOutputOptions in _PDFNetPython: _PDFNetPython.SVGOutputOptions_swigregister(SVGOutputOptions)
[docs] class TiffOutputOptions(object): r"""A class containing options for ToTiff functions""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Creates an TiffOutputOptions object with default settings""" _PDFNetPython.TiffOutputOptions_swiginit(self, _PDFNetPython.new_TiffOutputOptions())
[docs] def SetBox(self, type): r""" Specifies the page box/region to rasterize. Possible values are media, crop, trim, bleed, and art. By default, page crop region will be rasterized. """ return _PDFNetPython.TiffOutputOptions_SetBox(self, type)
[docs] def SetRotate(self, rotation): r""" Rotates all pages by a given number of degrees counterclockwise. The allowed values are 0, 90, 180, and 270. The default value is 0. """ return _PDFNetPython.TiffOutputOptions_SetRotate(self, rotation)
[docs] def SetClip(self, x1, y1, x2, y2): r""" User definable clip box. By default, the clip region is identical to current page 'box'. """ return _PDFNetPython.TiffOutputOptions_SetClip(self, x1, y1, x2, y2)
[docs] def SetPages(self, page_desc): r""" Specifies the list of pages to convert. "1" for only the first page. "1-5" for pages 1 to 5. "1, 5, 7" for pages 1, 5, and 7. "odd" for all odd pages. "even" for all even pages. By default, all pages are converted. """ return _PDFNetPython.TiffOutputOptions_SetPages(self, page_desc)
[docs] def SetOverprint(self, mode): r""" Enable or disable support for overprint and overprint simulation. Overprint is a device dependent feature and the results will vary depending on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc). Default is e_op_pdfx_on. :param op: e_op_on: always enabled; e_op_off: always disabled; e_op_pdfx_on: enabled for PDF/X files only. """ return _PDFNetPython.TiffOutputOptions_SetOverprint(self, mode)
[docs] def SetCMYK(self, enable): r""" Render and export the image in CMYK mode. By default, the image is rendered and exported in RGB color space. """ return _PDFNetPython.TiffOutputOptions_SetCMYK(self, enable)
[docs] def SetDither(self, enable): r""" Enables dithering when the image is exported in palletized or monochrome mode. This option is disabled by default. """ return _PDFNetPython.TiffOutputOptions_SetDither(self, enable)
[docs] def SetGray(self, enable): r""" Render and export the image in grayscale mode. Sets pixel format to 8 bits per pixel grayscale. By default, the image is rendered and exported in RGB color space. """ return _PDFNetPython.TiffOutputOptions_SetGray(self, enable)
[docs] def SetMono(self, enable): r""" Export the rendered image as 1 bit per pixel (monochrome) image. The image will be compressed using G4 CCITT compression algorithm. By default, the image is not dithered. To enable dithering use 'SetDither' option. This option is disabled by default. """ return _PDFNetPython.TiffOutputOptions_SetMono(self, enable)
[docs] def SetAnnots(self, enable): r""" Enables or disables drawing of annotations. This option is enabled by default. """ return _PDFNetPython.TiffOutputOptions_SetAnnots(self, enable)
[docs] def SetSmooth(self, enable): r""" Enables or disables image smoothing (default: enabled). """ return _PDFNetPython.TiffOutputOptions_SetSmooth(self, enable)
[docs] def SetPrintmode(self, enable): r""" Renders annotations in the print mode. This option can be used to render 'Print Only' annotations and to hide 'Screen Only' annotations. This option is disabled by default. """ return _PDFNetPython.TiffOutputOptions_SetPrintmode(self, enable)
[docs] def SetTransparentPage(self, enable): r""" Sets the page color to transparent. By default, Convert assumes that the page is drawn directly on an opaque white surface. Some applications may need to draw the page on a different backdrop. In this case any pixels that are not covered during rendering will be transparent. This option is disabled by default. """ return _PDFNetPython.TiffOutputOptions_SetTransparentPage(self, enable)
[docs] def SetPalettized(self, enable): r""" Enabled the output of palettized TIFFs. This option is disabled by default. """ return _PDFNetPython.TiffOutputOptions_SetPalettized(self, enable)
[docs] def SetDPI(self, dpi): r""" The output resolution, from 1 to 1000, in Dots Per Inch (DPI). The higher the DPI, the larger the image. Resolutions larger than 1000 DPI can be achieved by rendering image in tiles or stripes. The default resolution is 92 DPI. """ return _PDFNetPython.TiffOutputOptions_SetDPI(self, dpi)
[docs] def SetGamma(self, gamma): r""" Sets the gamma factor used for anti-aliased rendering. Typical values are in the range from 0.1 to 3. Gamma correction can be used to improve the quality of anti-aliased image output and can (to some extent) decrease the appearance common anti-aliasing artifacts (such as pixel width lines between polygons). The default gamma is 0. """ return _PDFNetPython.TiffOutputOptions_SetGamma(self, gamma)
[docs] def SetHRes(self, hres): r"""Sets the width of the output image, in pixels.""" return _PDFNetPython.TiffOutputOptions_SetHRes(self, hres)
[docs] def SetVRes(self, vres): r"""Sets the height of the output image, in pixels.""" return _PDFNetPython.TiffOutputOptions_SetVRes(self, vres)
__swig_destroy__ = _PDFNetPython.delete_TiffOutputOptions
# Register TiffOutputOptions in _PDFNetPython: _PDFNetPython.TiffOutputOptions_swigregister(TiffOutputOptions)
[docs] class Printer(object): r""" Convert::Printer is a utility class to install the a printer for print-based conversion of documents for Convert::ToPdf """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Install(args): r""" Install the PDFNet printer. Installation can take a few seconds, so it is recommended that you install the printer once as part of your deployment process. Duplicated installations will be quick since the presence of the printer is checked before installation is attempted. There is no need to uninstall the printer after conversions, it can be left installed for later access. :type in_printerName: string :param in_printerName: the name of the printer to install and use for conversions. If in_printerName is not provided then the name "PDFTron PDFNet" is used. Notes: Installing and uninstalling printer drivers requires the process to be running as administrator. """ return _PDFNetPython.Printer_Install(args)
[docs] @staticmethod def Uninstall(): r""" Uninstall all printers using the PDFNet printer driver. Notes: Installing and uninstalling printer drivers requires the process to be running as administrator. Only the "PDFTron PDFNet" printer can be uninstalled with this function. """ return _PDFNetPython.Printer_Uninstall()
[docs] @staticmethod def GetPrinterName(): r""" Get the name of the PDFNet printer installed in this process session. :rtype: string :return: the Unicode name of the PDFNet printer Notes: if no printer was installed in this process then the predefined string "PDFTron PDFNet" will be returned. """ return _PDFNetPython.Printer_GetPrinterName()
[docs] @staticmethod def SetPrinterName(args): r""" Set the name of the PDFNet printer installed in this process session. :rtype: void :return: the Unicode name of the PDFNet printer Notes: if no printer was installed in this process then the predefined string "PDFTron PDFNet" will be used. """ return _PDFNetPython.Printer_SetPrinterName(args)
[docs] @staticmethod def IsInstalled(args): r""" Determine if the PDFNet printer is installed :type in_printerName: string :param in_printerName: the name of the printer to install and use for conversions. If in_printerName is not provided then the name "PDFTron PDFNet" is used. :rtype: boolean :return: true if the named printer is installed, false otherwise Notes: may or may not check if the printer with the given name is actually a PDFNet printer. """ return _PDFNetPython.Printer_IsInstalled(args)
e_auto = _PDFNetPython.Printer_e_auto r"""By default PDFNet will pick the best means of converting the target document.""" e_interop_only = _PDFNetPython.Printer_e_interop_only r"""For Office file conversions, force COM Interop to be used, regardless if this virtual printer is installed or not.""" e_printer_only = _PDFNetPython.Printer_e_printer_only r"""For Office file conversions, do not check for Office COM Interop availability, and use the printer path instead.""" e_prefer_builtin_converter = _PDFNetPython.Printer_e_prefer_builtin_converter r"""For Office file conversions, use the built in converter if it is available for the converted file type."""
[docs] @staticmethod def SetMode(mode): r""" Configure how PDFNet prints documents. :type mode: int :param mode: set the print mode. Default is e_auto. """ return _PDFNetPython.Printer_SetMode(mode)
[docs] @staticmethod def GetMode(): r""" Get the current mode for print jobs. :rtype: int :return: the current print mode """ return _PDFNetPython.Printer_GetMode()
def __init__(self): _PDFNetPython.Printer_swiginit(self, _PDFNetPython.new_Printer()) __swig_destroy__ = _PDFNetPython.delete_Printer
# Register Printer in _PDFNetPython: _PDFNetPython.Printer_swigregister(Printer)
[docs] def Printer_Install(args): r""" Install the PDFNet printer. Installation can take a few seconds, so it is recommended that you install the printer once as part of your deployment process. Duplicated installations will be quick since the presence of the printer is checked before installation is attempted. There is no need to uninstall the printer after conversions, it can be left installed for later access. :type in_printerName: string :param in_printerName: the name of the printer to install and use for conversions. If in_printerName is not provided then the name "PDFTron PDFNet" is used. Notes: Installing and uninstalling printer drivers requires the process to be running as administrator. """ return _PDFNetPython.Printer_Install(args)
[docs] def Printer_Uninstall(): r""" Uninstall all printers using the PDFNet printer driver. Notes: Installing and uninstalling printer drivers requires the process to be running as administrator. Only the "PDFTron PDFNet" printer can be uninstalled with this function. """ return _PDFNetPython.Printer_Uninstall()
[docs] def Printer_GetPrinterName(): r""" Get the name of the PDFNet printer installed in this process session. :rtype: string :return: the Unicode name of the PDFNet printer Notes: if no printer was installed in this process then the predefined string "PDFTron PDFNet" will be returned. """ return _PDFNetPython.Printer_GetPrinterName()
[docs] def Printer_SetPrinterName(args): r""" Set the name of the PDFNet printer installed in this process session. :rtype: void :return: the Unicode name of the PDFNet printer Notes: if no printer was installed in this process then the predefined string "PDFTron PDFNet" will be used. """ return _PDFNetPython.Printer_SetPrinterName(args)
[docs] def Printer_IsInstalled(args): r""" Determine if the PDFNet printer is installed :type in_printerName: string :param in_printerName: the name of the printer to install and use for conversions. If in_printerName is not provided then the name "PDFTron PDFNet" is used. :rtype: boolean :return: true if the named printer is installed, false otherwise Notes: may or may not check if the printer with the given name is actually a PDFNet printer. """ return _PDFNetPython.Printer_IsInstalled(args)
[docs] def Printer_SetMode(mode): r""" Configure how PDFNet prints documents. :type mode: int :param mode: set the print mode. Default is e_auto. """ return _PDFNetPython.Printer_SetMode(mode)
[docs] def Printer_GetMode(): r""" Get the current mode for print jobs. :rtype: int :return: the current print mode """ return _PDFNetPython.Printer_GetMode()
[docs] class DataExtractionModule(object): r""" The class DataExtractionModule. static interface to Apryse SDKs data extraction functionality """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_Tabular = _PDFNetPython.DataExtractionModule_e_Tabular r"""Tabular Data engine. This engine identifies column and row structure and analyzes numeric columns. It is especially suited to documents that are table-based such as spreadsheets.""" e_Form = _PDFNetPython.DataExtractionModule_e_Form r"""Form field extraction engine. This engine uses artificial intelligence and computer vision to detect form fields in documents that do not have any interactive field annotations embedded.""" e_DocStructure = _PDFNetPython.DataExtractionModule_e_DocStructure r"""Document structure engine. This engine discovers the full logical structure, including headers, footers, paragraphs, list items, table columns, cells, borders, images and graphics.""" e_FormKeyValue = _PDFNetPython.DataExtractionModule_e_FormKeyValue r"""Form field with key value extraction engine. This engine uses artificial intelligence and computer vision to detect form fields, including field name and values, in documents that do not have any interactive field annotations embedded. Note: This engine is experimental and subject to change."""
[docs] @staticmethod def IsModuleAvailable(engine): r""" Find out whether the specified data extraction module is available (and licensed). :type engine: int :param engine: -- The extraction engine. :rtype: boolean :return: returns true if data extraction operations can be performed. """ return _PDFNetPython.DataExtractionModule_IsModuleAvailable(engine)
[docs] @staticmethod def ExtractData(args): r""" Overload 1: Perform data extraction on a PDF file using the specified engine and return the resulting JSON string. Note: The FormKeyValue engine is experimental and subject to change. :type input_pdf_file: string :param input_pdf_file: -- The source document filename. :type engine: int :param engine: -- The extraction engine. :type options: :py:class:`DataExtractionOptions` :param options: -- Data extraction options (optional). :rtype: string :return: JSON string representing the extracted results. | Overload 2: Perform data extraction on a PDF file using the specified engine. Note: The FormKeyValue engine is experimental and subject to change. :type input_pdf_file: string :param input_pdf_file: -- The source document filename. :type output_json_file: string :param output_json_file: -- The resulting JSON filename. :type engine: int :param engine: -- The extraction engine. :type options: :py:class:`DataExtractionOptions` :param options: -- Data extraction options (optional). | Overload 3: Perform data extraction on a PDF file using the specified engine. Note: The FormKeyValue engine is experimental and subject to change. :type input_pdf_file: string :param input_pdf_file: -- The source document filename. :type output_json_file: string :param output_json_file: -- The resulting JSON filename. :type engine: int :param engine: -- The extraction engine. :param options: -- Data extraction options (optional). """ return _PDFNetPython.DataExtractionModule_ExtractData(args)
[docs] @staticmethod def DetectAndAddFormFieldsToPDF(doc, options=None): r""" Perform automatic form field detection, then insert the fields into the PDF. Note: The FormKeyValue engine is experimental and subject to change. :type doc: :py:class:`PDFDoc` :param doc: -- The PDF document where fields are detected from and inserted into. :type options: :py:class:`DataExtractionOptions` :param options: -- Data extraction options (optional). """ return _PDFNetPython.DataExtractionModule_DetectAndAddFormFieldsToPDF(doc, options)
[docs] @staticmethod def ExtractToXLSX(args): r""" Overload 1: Perform data extraction on a PDF in XLSX output format. :type input_pdf_file: string :param input_pdf_file: -- The source document filename. :type output_xlsx_file: string :param output_xlsx_file: -- The resulting XLSX filename. :type options: :py:class:`DataExtractionOptions` :param options: -- Data extraction options (optional). | Overload 2: Perform data extraction on a PDF in XLSX output format. :type input_pdf_file: string :param input_pdf_file: -- The source document filename. :type output_xlsx_stream: :py:class:`Filter` :param output_xlsx_stream: -- The resulting XLSX filter. :type options: :py:class:`DataExtractionOptions` :param options: -- Data extraction options (optional). | Overload 3: Perform data extraction on a PDF in XLSX output format. :type input_pdf_file: string :param input_pdf_file: -- The source document filename. :type output_xlsx_stream: :py:class:`Filter` :param output_xlsx_stream: -- The resulting XLSX filter. :param options: -- Data extraction options (optional). """ return _PDFNetPython.DataExtractionModule_ExtractToXLSX(args)
def __init__(self): _PDFNetPython.DataExtractionModule_swiginit(self, _PDFNetPython.new_DataExtractionModule()) __swig_destroy__ = _PDFNetPython.delete_DataExtractionModule
# Register DataExtractionModule in _PDFNetPython: _PDFNetPython.DataExtractionModule_swigregister(DataExtractionModule)
[docs] def DataExtractionModule_IsModuleAvailable(engine): r""" Find out whether the specified data extraction module is available (and licensed). :type engine: int :param engine: -- The extraction engine. :rtype: boolean :return: returns true if data extraction operations can be performed. """ return _PDFNetPython.DataExtractionModule_IsModuleAvailable(engine)
[docs] def DataExtractionModule_ExtractData(args): r""" Overload 1: Perform data extraction on a PDF file using the specified engine and return the resulting JSON string. Note: The FormKeyValue engine is experimental and subject to change. :type input_pdf_file: string :param input_pdf_file: -- The source document filename. :type engine: int :param engine: -- The extraction engine. :type options: :py:class:`DataExtractionOptions` :param options: -- Data extraction options (optional). :rtype: string :return: JSON string representing the extracted results. | Overload 2: Perform data extraction on a PDF file using the specified engine. Note: The FormKeyValue engine is experimental and subject to change. :type input_pdf_file: string :param input_pdf_file: -- The source document filename. :type output_json_file: string :param output_json_file: -- The resulting JSON filename. :type engine: int :param engine: -- The extraction engine. :type options: :py:class:`DataExtractionOptions` :param options: -- Data extraction options (optional). | Overload 3: Perform data extraction on a PDF file using the specified engine. Note: The FormKeyValue engine is experimental and subject to change. :type input_pdf_file: string :param input_pdf_file: -- The source document filename. :type output_json_file: string :param output_json_file: -- The resulting JSON filename. :type engine: int :param engine: -- The extraction engine. :param options: -- Data extraction options (optional). """ return _PDFNetPython.DataExtractionModule_ExtractData(args)
[docs] def DataExtractionModule_DetectAndAddFormFieldsToPDF(doc, options=None): r""" Perform automatic form field detection, then insert the fields into the PDF. Note: The FormKeyValue engine is experimental and subject to change. :type doc: :py:class:`PDFDoc` :param doc: -- The PDF document where fields are detected from and inserted into. :type options: :py:class:`DataExtractionOptions` :param options: -- Data extraction options (optional). """ return _PDFNetPython.DataExtractionModule_DetectAndAddFormFieldsToPDF(doc, options)
[docs] def DataExtractionModule_ExtractToXLSX(args): r""" Overload 1: Perform data extraction on a PDF in XLSX output format. :type input_pdf_file: string :param input_pdf_file: -- The source document filename. :type output_xlsx_file: string :param output_xlsx_file: -- The resulting XLSX filename. :type options: :py:class:`DataExtractionOptions` :param options: -- Data extraction options (optional). | Overload 2: Perform data extraction on a PDF in XLSX output format. :type input_pdf_file: string :param input_pdf_file: -- The source document filename. :type output_xlsx_stream: :py:class:`Filter` :param output_xlsx_stream: -- The resulting XLSX filter. :type options: :py:class:`DataExtractionOptions` :param options: -- Data extraction options (optional). | Overload 3: Perform data extraction on a PDF in XLSX output format. :type input_pdf_file: string :param input_pdf_file: -- The source document filename. :type output_xlsx_stream: :py:class:`Filter` :param output_xlsx_stream: -- The resulting XLSX filter. :param options: -- Data extraction options (optional). """ return _PDFNetPython.DataExtractionModule_ExtractToXLSX(args)
[docs] class PathData(object): r""" Contains the information required to draw the path. Contains an array of PathSegmentType Operators and corresponding path data Points. A point may be on or off (off points are control points). The meaning of a point depends on associated id (or segment type) in the path segment type array. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_moveto = _PDFNetPython.PathData_e_moveto e_lineto = _PDFNetPython.PathData_e_lineto e_cubicto = _PDFNetPython.PathData_e_cubicto e_conicto = _PDFNetPython.PathData_e_conicto e_rect = _PDFNetPython.PathData_e_rect e_closepath = _PDFNetPython.PathData_e_closepath
[docs] def SetOperators(self, operators): r""" Overwrite the existing operators. :type operators: std::vector< unsigned char,std::allocator< unsigned char > > :param operators: - The new operators to use. """ return _PDFNetPython.PathData_SetOperators(self, operators)
[docs] def SetPoints(self, points): r""" Overwrite the existing data points. :type points: std::vector< double,std::allocator< double > > :param points: - The new data points to use. """ return _PDFNetPython.PathData_SetPoints(self, points)
[docs] def GetOperators(self): r""" Get the current operators. :rtype: std::vector< unsigned char,std::allocator< unsigned char > > :return: The existing PathSegmentType operators. """ return _PDFNetPython.PathData_GetOperators(self)
[docs] def GetPoints(self): r""" Get the current data points. :rtype: std::vector< double,std::allocator< double > > :return: The existing data points. """ return _PDFNetPython.PathData_GetPoints(self)
[docs] def IsDefined(self): r""" If PathData was acquired from Font::GetGlyphPath then is method will indicate if this is an 'undefined character code'. :rtype: boolean :return: True if this is valid, otherwise false. Notes: See Font::GetGlyphPath for more information regarding what an 'undefined character code' means. """ return _PDFNetPython.PathData_IsDefined(self)
[docs] def GetGlyphIndex(self): r""" :rtype: int :return: The glyph index of the requested path. 0 stands for '.notdef' glyph. """ return _PDFNetPython.PathData_GetGlyphIndex(self)
is_def = property(_PDFNetPython.PathData_is_def_get, _PDFNetPython.PathData_is_def_set) glyph_index = property(_PDFNetPython.PathData_glyph_index_get, _PDFNetPython.PathData_glyph_index_set) oprs = property(_PDFNetPython.PathData_oprs_get, _PDFNetPython.PathData_oprs_set) pts = property(_PDFNetPython.PathData_pts_get, _PDFNetPython.PathData_pts_set) def __init__(self, args): _PDFNetPython.PathData_swiginit(self, _PDFNetPython.new_PathData(args)) __swig_destroy__ = _PDFNetPython.delete_PathData
# Register PathData in _PDFNetPython: _PDFNetPython.PathData_swigregister(PathData)
[docs] class ShapedText(object): r""" The class ShapedText. A sequence of positioned glyphs -- the visual representation of a given text string """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_FullShaping = _PDFNetPython.ShapedText_e_FullShaping e_PartialShaping = _PDFNetPython.ShapedText_e_PartialShaping e_NoShaping = _PDFNetPython.ShapedText_e_NoShaping e_NoFailure = _PDFNetPython.ShapedText_e_NoFailure e_UnsupportedFontType = _PDFNetPython.ShapedText_e_UnsupportedFontType e_NotIndexEncoded = _PDFNetPython.ShapedText_e_NotIndexEncoded e_FontDataNotFound = _PDFNetPython.ShapedText_e_FontDataNotFound def __init__(self, args): _PDFNetPython.ShapedText_swiginit(self, _PDFNetPython.new_ShapedText(args)) __swig_destroy__ = _PDFNetPython.delete_ShapedText
[docs] def Destroy(self): return _PDFNetPython.ShapedText_Destroy(self)
[docs] def GetScale(self): r""" Scaling factor of this shaped text relative to the em size. A scaling factor of 1 means that all units are relative to the em size. PDF scaling is typically 1000 units per em. :rtype: double :return: returns the scaling factor for the glyph positions. """ return _PDFNetPython.ShapedText_GetScale(self)
[docs] def GetShapingStatus(self): r""" Get the state of the shaping operation. Even if the shaping did not fully succeed, this object can be added to an elementbuilder, and will fallback to placing unshped text. See GetFailureReason() in the case this method returns something other than FullShaping. :rtype: int :return: . """ return _PDFNetPython.ShapedText_GetShapingStatus(self)
[docs] def GetFailureReason(self): r""" In the case where GetShapingStatus() returns something other than FullShaping, this method will return a more detailed reason behind the failure. :rtype: int :return: . """ return _PDFNetPython.ShapedText_GetFailureReason(self)
[docs] def GetText(self): r""" The original source text string. :rtype: string :return: returns the source text string. """ return _PDFNetPython.ShapedText_GetText(self)
[docs] def GetNumGlyphs(self): r""" Number of glyphs present in the shaped text. Might be different from the . :rtype: int :return: returns the number of utf32 codepoints in this shaped text. """ return _PDFNetPython.ShapedText_GetNumGlyphs(self)
[docs] def GetGlyph(self, index): r""" Get the glyph ID at the indicated place in the shaped sequence. This number is specific to the font file used to generate the shaping results, and does not always have a clean mapping to a particular Unicode codepoint in the original string. :type index: int :param index: -- the index of the glyph to be retrieved. Must be less than GetNumGlyphs(). :rtype: int :return: returns the glyph ID for the indicated place in the shaped result. """ return _PDFNetPython.ShapedText_GetGlyph(self, index)
[docs] def GetGlyphXPos(self, index): r""" The X position of the glyph at the requested index. This number has been scaled by GetScale(). :type index: int :param index: -- the index of the glyph position to be retrieved. Must be less than GetNumGlyphs(). :rtype: double :return: returns the X position for the glyph at the specified index. """ return _PDFNetPython.ShapedText_GetGlyphXPos(self, index)
[docs] def GetGlyphYPos(self, index): r""" The Y position of the glyph at the requested index. This number has been scaled by GetScale(). :type index: int :param index: -- the index of the glyph position to be retrieved. Must be less than GetNumGlyphs(). :rtype: double :return: returns the Y position for the glyph at the specified index. """ return _PDFNetPython.ShapedText_GetGlyphYPos(self, index)
m_impl = property(_PDFNetPython.ShapedText_m_impl_get, _PDFNetPython.ShapedText_m_impl_set)
# Register ShapedText in _PDFNetPython: _PDFNetPython.ShapedText_swigregister(ShapedText)
[docs] class Font(object): r""" A font that is used to draw text on a page. It corresponds to a Font Resource in a PDF file. More than one page may reference the same Font object. A Font has a number of attributes, including an array of widths, the character encoding, and the font's resource name. PDF document can contain several different types of fonts and Font class represents a single, flat interface around all PDF font types. There are two main classes of fonts in PDF: simple and composite fonts. Simple fonts are Type1, TrueType, and Type3 fonts. All simple fonts have the following properties: - Glyphs in the font are selected by single-byte character codes obtained from a string that is shown by the text-showing operators. Logically, these codes index into a table of 256 glyphs; the mapping from codes to glyphs is called the font's encoding. Each font program has a built-in encoding. Under some circumstances, the encoding can be altered by means described in Section 5.5.5 "Character Encoding" in PDF Reference Manual. - Each glyph has a single set of metrics. Therefore simple fonts support only horizontal writing mode. A composite font is one whose glyphs are obtained from a font like object called a CIDFont (e.g. CIDType0Font and CIDType0Font). A composite font is represented by a font dictionary whose Subtype value is Type0. The Type 0 font is known as the root font, while its associated CIDFont is called its descendant. CID-keyed fonts provide a convenient and efficient method for defining multiple-byte character encodings and fonts with a large number of glyphs. These capabilities provide great flexibility for representing text in writing systems for languages with large character sets, such as Chinese, Japanese, and Korean (CJK). """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_times_roman = _PDFNetPython.Font_e_times_roman e_times_bold = _PDFNetPython.Font_e_times_bold e_times_italic = _PDFNetPython.Font_e_times_italic e_times_bold_italic = _PDFNetPython.Font_e_times_bold_italic e_helvetica = _PDFNetPython.Font_e_helvetica e_helvetica_bold = _PDFNetPython.Font_e_helvetica_bold e_helvetica_oblique = _PDFNetPython.Font_e_helvetica_oblique e_helvetica_bold_oblique = _PDFNetPython.Font_e_helvetica_bold_oblique e_courier = _PDFNetPython.Font_e_courier e_courier_bold = _PDFNetPython.Font_e_courier_bold e_courier_oblique = _PDFNetPython.Font_e_courier_oblique e_courier_bold_oblique = _PDFNetPython.Font_e_courier_bold_oblique e_symbol = _PDFNetPython.Font_e_symbol e_zapf_dingbats = _PDFNetPython.Font_e_zapf_dingbats e_null = _PDFNetPython.Font_e_null
[docs] @staticmethod def CreateTrueTypeFont(doc, font_path, embed=True, subset=True): r""" Embed an external TrueType font in the document as a Simple font. Notes: glyphs in the Simple font are selected by single-byte character codes. If you want to work with multi-byte character codes (e.g. UTF16) you need to create a CID font. :type doc: :py:class:`SDFDoc` :param doc: Document in which the external font should be embedded. :type font_path: string :param font_path: Path to the external font file. :type embed: boolean :param embed: A boolean indicating whether the font should be embedded or not. For accurate font reproduction set the embed flag to 'true'. :type subset: boolean :param subset: A boolean indicating whether the embedded font should be subsetted. """ return _PDFNetPython.Font_CreateTrueTypeFont(doc, font_path, embed, subset)
e_IdentityH = _PDFNetPython.Font_e_IdentityH e_Indices = _PDFNetPython.Font_e_Indices
[docs] @staticmethod def CreateCIDTrueTypeFont(args): r""" Embed an external TrueType font in the document as a CID font. By default the function selects "Identity-H" encoding that maps 2-byte character codes ranging from 0 to 65,535 to the same Unicode value. Other predefined encodings are listed in Table 5.15 'Predefined CMap names' in PDF Reference Manual. :type doc: :py:class:`SDFDoc` :param doc: - document in which the external font should be embedded. :type font_path: string :param font_path: - path to the external font file. :type embed: boolean :param embed: - a boolean indicating whether the font should be embedded or not. For accurate font reproduction set the embed flag to 'true'. :type subset: boolean :param subset: - a boolean indicating whether the embedded font should be subsetted :type encoding: int :param encoding: - the encoding type either e_IdentityH (default) or e_Indices (to write glyph indices rather than unicode) :type ttc_font_index: int :param ttc_font_index: - if a TrueTypeCollection (TTC) font is loaded this parameter controls which font is actually picked """ return _PDFNetPython.Font_CreateCIDTrueTypeFont(args)
[docs] @staticmethod def Create(args): r""" Overload 1: Create a PDF::Font object for the given standard (also known as base 14 font) | Overload 2: Create a CID TrueType PDF font with the characteristics specified in the LOGFONTA structure. :type doc: :py:class:`SDFDoc` :param doc: - document in which the external font should be embedded. :param logfonta: A pointer to a Windows LOGFONTA structure that defines the characteristics of the logical font. :param embed: - a boolean indicating whether the font should be embedded or not. For accurate font reproduction set the embed flag to 'true'. :param subset: - a boolean indicating whether the embedded font should be subsetted :param encoding: - the encoding type either e_IdentityH (default) or e_Indices (to write glyph indices rather than unicode) Notes: This method is available only on Windows platforms. Create a CID TrueType PDF font with the characteristics specified in the LOGFONTA structure. :type doc: :py:class:`SDFDoc` :param doc: - document in which the external font should be embedded. :param logfontw: A pointer to a Windows LOGFONTW structure that defines the characteristics of the logical font. :param embed: - a boolean indicating whether the font should be embedded or not. For accurate font reproduction set the embed flag to 'true'. :param subset: - a boolean indicating whether the embedded font should be subsetted :param encoding: - the encoding type either e_IdentityH (default) or e_Indices (to write glyph indices rather than unicode) This method is available only on Windows platforms. Create a new Unicode font based on the description of an existing PDF font. :type doc: :py:class:`SDFDoc` :param doc: document in which the external font should be embedded. :type from: :py:class:`Font` :param from: A Font object that provides the name for choosing a font. If the font with that name can be located and it covers a sufficient character set characters from that font will be used. Otherwise the font object created will be from a another font that covers the character set. :type char_set: string :param char_set: An initial character set. This provides an approach to specify any characters that are required to be included in the final font as part of a string. Note that additional characters will be added to the character set as needed, so it is not required to specify them here. (empty string is a perfectly valid and common value for this argument) | Overload 3: Create a new Unicode font based on the description of an existing PDF font. :type doc: :py:class:`SDFDoc` :param doc: document in which the external font should be embedded. :type name: string :param name: A font name that provides a hint when choosing a font. If the font with that name can be located and it covers a sufficient character set characters from that font will be used. Otherwise the font object created will be from a another font that covers the character set. :type char_set: string :param char_set: An initial character set. This provides an approach to specify any characters that are required to be included in the final font as part of a string. Note that additional characters will be added to the character set as needed, so it is not required to specify them here. (empty string is a perfectly valid and common value for this argument) """ return _PDFNetPython.Font_Create(args)
[docs] @staticmethod def CreateType1Font(doc, font_path, embed=True): r""" Embed an external Type1 font in the document. :type doc: :py:class:`SDFDoc` :param doc: - document in which the external font should be embedded. :type font_path: string :param font_path: - path to the external font file. :type embed: boolean :param embed: - a boolean indicating whether the font should be embedded or not. For accurate font reproduction set the embed flag to 'true'. """ return _PDFNetPython.Font_CreateType1Font(doc, font_path, embed)
e_Type1 = _PDFNetPython.Font_e_Type1 e_TrueType = _PDFNetPython.Font_e_TrueType e_MMType1 = _PDFNetPython.Font_e_MMType1 e_Type3 = _PDFNetPython.Font_e_Type3 e_Type0 = _PDFNetPython.Font_e_Type0 e_CIDType0 = _PDFNetPython.Font_e_CIDType0 e_CIDType2 = _PDFNetPython.Font_e_CIDType2
[docs] def GetType(self): r""" :rtype: int :return: Font Type """ return _PDFNetPython.Font_GetType(self)
[docs] def IsSimple(self): r""" :rtype: boolean :return: true for non-CID based fonts such as Type1, TrueType, and Type3 All simple fonts have the following properties: - Glyphs in the font are selected by single-byte character codes obtained from a string that is shown by the text-showing operators. Logically, these codes index into a table of 256 glyphs; the mapping from codes to glyphs is called the font's encoding. Each font program has a built-in encoding. Under some circumstances, the encoding can be altered by means described in Section 5.5.5 "Character Encoding" in PDF Reference Manual. - Each glyph has a single set of metrics. Therefore simple fonts support only horizontal writing mode. """ return _PDFNetPython.Font_IsSimple(self)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: a SDF/Cos object of this Font. """ return _PDFNetPython.Font_GetSDFObj(self)
[docs] def GetDescriptor(self): r""" :rtype: :py:class:`Obj` :return: a SDF/Cos object representing FontDescriptor or NULL is FontDescriptor is not present. """ return _PDFNetPython.Font_GetDescriptor(self)
[docs] def GetName(self): r""" :rtype: string :return: the name of a font. The behavior depends on the font type; for a Type 3 font it gets the value of the Name key in a PDF Font resource. For other types it gets the value of the BaseFont key in a PDF font resource. """ return _PDFNetPython.Font_GetName(self)
[docs] def GetFamilyName(self): r""" :rtype: string :return: the face's family name. This is an ASCII string, usually in English, which describes the typeface's family (like 'Times New Roman', 'Bodoni', 'Garamond', etc). This is a least common denominator used to list fonts. """ return _PDFNetPython.Font_GetFamilyName(self)
[docs] def IsFixedWidth(self): r""" :rtype: boolean :return: true if all glyphs have the same width """ return _PDFNetPython.Font_IsFixedWidth(self)
[docs] def IsSerif(self): r""" :rtype: boolean :return: true if glyphs have serifs """ return _PDFNetPython.Font_IsSerif(self)
[docs] def IsSymbolic(self): r""" :rtype: boolean :return: true if font contains characters outside the Adobe standard Latin character set. """ return _PDFNetPython.Font_IsSymbolic(self)
[docs] def IsItalic(self): r""" :rtype: boolean :return: true if glyphs have dominant vertical strokes that are slanted. """ return _PDFNetPython.Font_IsItalic(self)
[docs] def IsAllCap(self): r""" :rtype: boolean :return: true if font contains no lowercase letters """ return _PDFNetPython.Font_IsAllCap(self)
[docs] def IsForceBold(self): r""" :rtype: boolean :return: true if bold glyphs should be painted with extra pixels at very small text sizes. """ return _PDFNetPython.Font_IsForceBold(self)
[docs] def IsHorizontalMode(self): r""" :rtype: boolean :return: true if the font uses horizontal writing mode, false for vertical writing mode. """ return _PDFNetPython.Font_IsHorizontalMode(self)
[docs] def GetWidth(self, char_code): r""" :rtype: double :return: advance width, measured in glyph space units for the glyph matching given character code. Notes: 1000 glyph units = 1 text space unit The width returned has NOT been scaled by the font size, text matrix, nor the CTM. The function gets the advance width of the font glyph. The advance width is the amount by which the current point advances when the glyph is drawn. The advance width may not correspond to the visible width of the glyph and for this reason, the advance width cannot be used to determine the glyphs' bounding boxes. """ return _PDFNetPython.Font_GetWidth(self, char_code)
[docs] def GetMaxWidth(self): r""" :rtype: double :return: the maximal advance width, in font units, for all glyphs in this face. """ return _PDFNetPython.Font_GetMaxWidth(self)
[docs] def GetMissingWidth(self): r""" :rtype: double :return: the default width to use for character codes whose widths are not specified in a font dictionary's Widths array. """ return _PDFNetPython.Font_GetMissingWidth(self)
[docs] def GetCharCodeIterator(self): r""" GetCharCodeIterator represents an iterator interface used to traverse a list of char codes for which there is a glyph outline in the embedded font. """ return _PDFNetPython.Font_GetCharCodeIterator(self)
[docs] def GetGlyphPath(self, char_code, conics2cubics, transform=None): r""" The function retrieves the glyph outline for a given character code. :type char_code: int :param char_code: character to query :type conics2cubics: boolean :param conics2cubics: if set to true converts all quadratic Bezier curves to cubic Beziers, otherwise no conversion is performed. :type transform: :py:class:`Matrix2D` :param transform: An optional matrix used to transform glyph data coordinates. If null/unspecified, glyph data points will not be transformed. :rtype: :py:class:`PathData` :return: A PathData object containing the path information. Notes: the function can return only the following operators (Element::e_moveto, Element::e_lineto, Element::e_cubicto and optionally Element::e_conicto if conics2cubics parameter is set to true. This function is not applicable to Type3 font and will throw an exception. Use GetType3GlyphStream instead. Check PathData::IsDefined to see if the char_code was mapped to 'undefined character code'. """ return _PDFNetPython.Font_GetGlyphPath(self, char_code, conics2cubics, transform)
[docs] def GetShapedText(self, text_to_shape): r""" Creates a set of positioned glyphs corresponding to the visual representation of the provided text string. The shaped text will take into account any advanced positioning and substitution features provided by an underylying embedded font file. For example, these features could include kerning, ligatures, and diacritic positioning. Typically the resulting shaped text would be fed into ElementBuilder.CreateShapedTextRun() :type text_to_shape: string :param text_to_shape: the string to be shaped. :rtype: :py:class:`ShapedText` :return: A ShapedText object representing the result of the shaping operation. Notes: Shaping requires a Type0 font with an embedded font file which covers all the unicode codepoints in the source text. For best results, this font should use the e_Indices encoding scheme, as shaping features that combine multiple codepoints into one glyph (ligatures, for example) will not work well in non-index encoded fonts. """ return _PDFNetPython.Font_GetShapedText(self, text_to_shape)
[docs] def MapToUnicode(self, char_code): r""" Maps the encoding specific 'charcode' to Unicode. Conversion of 'charcode' to Unicode can result in up to four Unicode characters. :type char_code: int :param char_code: encoding specific 'charcode' that needs to be converted to Unicode. :param out_uni_arr: A pointer to an array of Unicode characters where the conversion result will be stored. :param in_uni_sz: The number of characters that can be written to out_uni_arr. You can assume that the function will never map to more than 10 characters. :param out_char_num: The function will modify this value to return the number of Unicode characters written in 'out_uni_arr' array. :rtype: string :return: true if char_code was mapped to Unicode public area or false if the char_code was mapped to Unicode private area. A char_code is mapped to Unicode private area when the information required for proper mapping is missing in PDF document (e.g. a predefined encoding or ToUnicode CMap). Notes: This function is not applicable to CIDFonts (e_CIDType0 and e_CIDType2) and will throw an exception if called. """ return _PDFNetPython.Font_MapToUnicode(self, char_code)
[docs] def IsEmbedded(self): r""" Tests whether or not the specified font is stored as a font file in a stream embedded in the PDF file. :rtype: boolean :return: true if the font is embedded in the file, false otherwise. """ return _PDFNetPython.Font_IsEmbedded(self)
[docs] def GetEmbeddedFontName(self): r""" :rtype: string :return: the PostScript font name for the embedded font. If the embedded font name is not available the function returns the empty string . """ return _PDFNetPython.Font_GetEmbeddedFontName(self)
[docs] def GetEmbeddedFont(self): r""" :rtype: :py:class:`Obj` :return: the stream object of the embedded font or NULL if there if the font is not embedded. Notes: This function is not applicable to Type3 font and will throw exception. """ return _PDFNetPython.Font_GetEmbeddedFont(self)
[docs] def GetEmbeddedFontBufSize(self): r""" :rtype: int :return: the size of decoded buffer containing embedded font data or 0 if this information is not known in advance. Notes: The size of decoded buffer may not be known in advance for all fonts and may not be correct. This function is not applicable to Type3 font and will throw exception. """ return _PDFNetPython.Font_GetEmbeddedFontBufSize(self)
[docs] def GetUnitsPerEm(self): r""" :rtype: int :return: the number of font units per EM square for this face. This is typically 2048 for TrueType fonts, 1000 for Type1 fonts Notes: Only relevant for scalable formats (such as TrueType and Type1). This function is not applicable to Type3 font and will throw an exception. Use GetType3FontMatrix instead. """ return _PDFNetPython.Font_GetUnitsPerEm(self)
[docs] def GetBBox(self): r""" :rtype: :py:class:`Rect` :return: A rectangle expressed in the glyph coordinate system, specifying the font bounding box. This is the smallest rectangle enclosing the shape that would result if all of the glyphs of the font were placed with their origins coincident and then filled. """ return _PDFNetPython.Font_GetBBox(self)
[docs] def GetAscent(self): r""" The face's ascender is the vertical distance from the baseline to the topmost point of any glyph in the face. This field's value is a positive number, expressed in the glyph coordinate system. For all font types except Type 3, the units of glyph space are one-thousandth of a unit of text space. Some font designs use a value different from 'bbox.yMax'. Notes: Only relevant for scalable formats. """ return _PDFNetPython.Font_GetAscent(self)
[docs] def GetDescent(self): r""" The face's descender is the vertical distance from the baseline to the bottommost point of any glyph in the face. This field's value is a negative number expressed in the glyph coordinate system. For all font types except Type 3, the units of glyph space are one-thousandth of a unit of text space. Some font designs use a value different from 'bbox.yMin'. Notes: Only relevant for scalable formats. """ return _PDFNetPython.Font_GetDescent(self)
[docs] def GetStandardType1FontType(self): r""" :rtype: int :return: Font::e_null if the font is not a standard Type1 font or some other StandardType1Font value for a standard Type1 font. """ return _PDFNetPython.Font_GetStandardType1FontType(self)
[docs] def IsCFF(self): r""" :rtype: boolean :return: true if the embedded font is represented as CFF (Compact Font Format). Notes: Only Type1 and Type1C fonts can be represented in CFF format """ return _PDFNetPython.Font_IsCFF(self)
[docs] def GetType3FontMatrix(self): r""" :rtype: :py:class:`Matrix2D` :return: Type3 font matrix, mapping glyph space to text space A common practice is to define glyphs in terms of a 1000-unit glyph coordinate system, in which case the font matrix is [0.001 0 0 0.001 0 0]. Notes: Relevant only for a Type3 font. """ return _PDFNetPython.Font_GetType3FontMatrix(self)
[docs] def GetType3GlyphStream(self, char_code): r""" :rtype: :py:class:`Obj` :return: a SDF/Cos glyph stream for the given char_code. If specified char_code is not found in the CharProcs dictionary the function returns NULL. Notes: Relevant only for a Type3 font. """ return _PDFNetPython.Font_GetType3GlyphStream(self, char_code)
[docs] def GetVerticalAdvance(self, char_code): r""" :rtype: std::vector< double,std::allocator< double > > :return: vertical advance. vertical advance is a displacement vector for vertical writing mode (i.e. writing mode 1); its horizontal component is always 0. :type char_code: int :param char_code: character to query for vertical advance :param out_pos_vect_x: - initialized by the method. horizontal component of the position vector defining the position of the vertical writing mode origin relative to horizontal writing mode origin. :param out_pos_vect_y: - initialized by the method. vertical component of the position vector defining the position of the vertical writing mode origin relative to horizontal writing mode origin. Notes: Use this method only for composite fonts with vertical writing mode (i.e. if Font.IsHorizontalMode() returns false). The method will return 0 as vertical advance for simple fonts or for composite fonts with only horizontal writing mode. Relevant only for a Type0 font. """ return _PDFNetPython.Font_GetVerticalAdvance(self, char_code)
[docs] def GetDescendant(self): r""" :rtype: :py:class:`Font` :return: descendant CIDFont. Notes: Relevant only for a Type0 font. """ return _PDFNetPython.Font_GetDescendant(self)
[docs] def MapToCID(self, char_code): r""" :rtype: int :return: a CID matching specified charcode. Notes: Relevant only for a Type0 font. """ return _PDFNetPython.Font_MapToCID(self, char_code)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.Font_Destroy(self)
def __init__(self, args): _PDFNetPython.Font_swiginit(self, _PDFNetPython.new_Font(args)) __swig_destroy__ = _PDFNetPython.delete_Font mp_font = property(_PDFNetPython.Font_mp_font_get, _PDFNetPython.Font_mp_font_set)
# Register Font in _PDFNetPython: _PDFNetPython.Font_swigregister(Font)
[docs] def Font_CreateTrueTypeFont(doc, font_path, embed=True, subset=True): r""" Embed an external TrueType font in the document as a Simple font. Notes: glyphs in the Simple font are selected by single-byte character codes. If you want to work with multi-byte character codes (e.g. UTF16) you need to create a CID font. :type doc: :py:class:`SDFDoc` :param doc: Document in which the external font should be embedded. :type font_path: string :param font_path: Path to the external font file. :type embed: boolean :param embed: A boolean indicating whether the font should be embedded or not. For accurate font reproduction set the embed flag to 'true'. :type subset: boolean :param subset: A boolean indicating whether the embedded font should be subsetted. """ return _PDFNetPython.Font_CreateTrueTypeFont(doc, font_path, embed, subset)
[docs] def Font_CreateCIDTrueTypeFont(args): r""" Embed an external TrueType font in the document as a CID font. By default the function selects "Identity-H" encoding that maps 2-byte character codes ranging from 0 to 65,535 to the same Unicode value. Other predefined encodings are listed in Table 5.15 'Predefined CMap names' in PDF Reference Manual. :type doc: :py:class:`SDFDoc` :param doc: - document in which the external font should be embedded. :type font_path: string :param font_path: - path to the external font file. :type embed: boolean :param embed: - a boolean indicating whether the font should be embedded or not. For accurate font reproduction set the embed flag to 'true'. :type subset: boolean :param subset: - a boolean indicating whether the embedded font should be subsetted :type encoding: int :param encoding: - the encoding type either e_IdentityH (default) or e_Indices (to write glyph indices rather than unicode) :type ttc_font_index: int :param ttc_font_index: - if a TrueTypeCollection (TTC) font is loaded this parameter controls which font is actually picked """ return _PDFNetPython.Font_CreateCIDTrueTypeFont(args)
[docs] def Font_Create(args): r""" Overload 1: Create a PDF::Font object for the given standard (also known as base 14 font) | Overload 2: Create a CID TrueType PDF font with the characteristics specified in the LOGFONTA structure. :type doc: :py:class:`SDFDoc` :param doc: - document in which the external font should be embedded. :param logfonta: A pointer to a Windows LOGFONTA structure that defines the characteristics of the logical font. :param embed: - a boolean indicating whether the font should be embedded or not. For accurate font reproduction set the embed flag to 'true'. :param subset: - a boolean indicating whether the embedded font should be subsetted :param encoding: - the encoding type either e_IdentityH (default) or e_Indices (to write glyph indices rather than unicode) Notes: This method is available only on Windows platforms. Create a CID TrueType PDF font with the characteristics specified in the LOGFONTA structure. :type doc: :py:class:`SDFDoc` :param doc: - document in which the external font should be embedded. :param logfontw: A pointer to a Windows LOGFONTW structure that defines the characteristics of the logical font. :param embed: - a boolean indicating whether the font should be embedded or not. For accurate font reproduction set the embed flag to 'true'. :param subset: - a boolean indicating whether the embedded font should be subsetted :param encoding: - the encoding type either e_IdentityH (default) or e_Indices (to write glyph indices rather than unicode) This method is available only on Windows platforms. Create a new Unicode font based on the description of an existing PDF font. :type doc: :py:class:`SDFDoc` :param doc: document in which the external font should be embedded. :type from: :py:class:`Font` :param from: A Font object that provides the name for choosing a font. If the font with that name can be located and it covers a sufficient character set characters from that font will be used. Otherwise the font object created will be from a another font that covers the character set. :type char_set: string :param char_set: An initial character set. This provides an approach to specify any characters that are required to be included in the final font as part of a string. Note that additional characters will be added to the character set as needed, so it is not required to specify them here. (empty string is a perfectly valid and common value for this argument) | Overload 3: Create a new Unicode font based on the description of an existing PDF font. :type doc: :py:class:`SDFDoc` :param doc: document in which the external font should be embedded. :type name: string :param name: A font name that provides a hint when choosing a font. If the font with that name can be located and it covers a sufficient character set characters from that font will be used. Otherwise the font object created will be from a another font that covers the character set. :type char_set: string :param char_set: An initial character set. This provides an approach to specify any characters that are required to be included in the final font as part of a string. Note that additional characters will be added to the character set as needed, so it is not required to specify them here. (empty string is a perfectly valid and common value for this argument) """ return _PDFNetPython.Font_Create(args)
[docs] def Font_CreateType1Font(doc, font_path, embed=True): r""" Embed an external Type1 font in the document. :type doc: :py:class:`SDFDoc` :param doc: - document in which the external font should be embedded. :type font_path: string :param font_path: - path to the external font file. :type embed: boolean :param embed: - a boolean indicating whether the font should be embedded or not. For accurate font reproduction set the embed flag to 'true'. """ return _PDFNetPython.Font_CreateType1Font(doc, font_path, embed)
[docs] class Shading(object): r""" Shading is a class that represents a flat interface around all PDF shading types: - In Function-based (type 1) shadings, the color at every point in the domain is defined by a specified mathematical function. The function need not be smooth or continuous. This is the most general of the available shading types, and is useful for shadings that cannot be adequately described with any of the other types. - Axial shadings (type 2) define a color blend along a line between two points, optionally extended beyond the boundary points by continuing the boundary colors. - Radial shadings (type 3) define a color blend that varies between two circles. Shadings of this type are commonly used to depict three-dimensional spheres and cones. - Free-form Gouraud-shaded triangle mesh shadings (type 4) and lattice Gouraud shadings (type 5) are commonly used to represent complex colored and shaded three-dimensional shapes. The area to be shaded is defined by a path composed entirely of triangles. The color at each vertex of the triangles is specified, and a technique known as Gouraud interpolation is used to color the interiors. The interpolation functions defining the shading may be linear or nonlinear. - Coons patch mesh shadings (type 6) areructed from one or more color patches, each bounded by four cubic Bezier curves. A Coons patch generally has two independent aspects: - Colors are specified for each corner of the unit square, and bilinear interpolation is used to fill in colors over the entire unit square - Coordinates are mapped from the unit square into a four-sided patch whose sides are not necessarily linear. The mapping is continuous: the corners of the unit square map to corners of the patch and the sides of the unit square map to sides of the patch. - Tensor-product patch mesh shadings (type 7) are identical to type 6 (Coons mesh), except that they are based on a bicubic tensor-product patch defined by 16 control points, instead of the 12 control points that define a Coons patch. The shading Patterns dictionaries representing the two patch types differ only in the value of the Type entry and in the number of control points specified for each patch in the data stream. Although the Coons patch is more concise and easier to use, the tensor- product patch affords greater control over color mapping. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_Shading e_function_shading = _PDFNetPython.Shading_e_function_shading e_axial_shading = _PDFNetPython.Shading_e_axial_shading e_radial_shading = _PDFNetPython.Shading_e_radial_shading e_free_gouraud_shading = _PDFNetPython.Shading_e_free_gouraud_shading e_lattice_gouraud_shading = _PDFNetPython.Shading_e_lattice_gouraud_shading e_coons_shading = _PDFNetPython.Shading_e_coons_shading e_tensor_shading = _PDFNetPython.Shading_e_tensor_shading e_null = _PDFNetPython.Shading_e_null
[docs] def GetType(self): r""" :rtype: int :return: The shading type """ return _PDFNetPython.Shading_GetType(self)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: the underlying SDF/Cos object """ return _PDFNetPython.Shading_GetSDFObj(self)
[docs] def GetBaseColorSpace(self): r""" :rtype: :py:class:`ColorSpace` :return: The color space in which color values are expressed. This may be any device, CIE-based, or special color space except a Pattern space. """ return _PDFNetPython.Shading_GetBaseColorSpace(self)
[docs] def HasBBox(self): r""" :rtype: boolean :return: true if shading has a bounding box, false otherwise. """ return _PDFNetPython.Shading_HasBBox(self)
[docs] def GetBBox(self): r""" :rtype: :py:class:`Rect` :return: a rectangle giving the left, bottom, right, and top coordinates, respectively, of the shading's bounding box. The coordinates are interpreted in the shading's target coordinate space. If present, this bounding box is applied as a temporary clipping boundary when the shading is painted, in addition to the current clipping path and any other clipping boundaries in effect at that time. Notes: Use HasBBox() method to determine whether the shading has a background color. """ return _PDFNetPython.Shading_GetBBox(self)
[docs] def HasBackground(self): r""" :rtype: boolean :return: true if the shading has a background color or false otherwise. """ return _PDFNetPython.Shading_HasBackground(self)
[docs] def GetBackground(self): r""" An color point represented in base color space specifying a single background color value. If present, this color is used before any painting operation involving the shading, to fill those portions of the area to be painted that lie outside the bounds of the shading object itself. In the opaque imaging model, the effect is as if the painting operation were performed twice: first with the background color and then again with the shading. Notes: The background color is applied only when the shading is used as part of a shading pattern, not when it is painted directly with the sh operator. Use HasBackground() method to determine whether the shading has a background color. """ return _PDFNetPython.Shading_GetBackground(self)
[docs] def GetAntialias(self): r""" :rtype: boolean :return: A flag indicating whether to filter the shading function to prevent aliasing artifacts. See Table 4.25 """ return _PDFNetPython.Shading_GetAntialias(self)
[docs] def GetParamStart(self): r""" :rtype: double :return: a number specifying the limiting value of a parametric variable t. The variable is considered to vary linearly between GetParamStart() and GetParamEnd() as the color gradient varies between the starting and ending points of the axis for Axial shading or circles for Radial shading. The variable t becomes the input argument to the color function(s). Notes: the returned value corresponds to the first value in Domain array. for shadings other than Axial or Radial this method throws an exception. """ return _PDFNetPython.Shading_GetParamStart(self)
[docs] def GetParamEnd(self): r""" :rtype: double :return: a number specifying the limiting value of a parametric variable t. The variable is considered to vary linearly between GetParamStart() and GetParamEnd() as the color gradient varies between the starting and ending points of the axis for Axial shading or circles for Radial shading. The variable t becomes the input argument to the color function(s). Notes: the returned value corresponds to the second value in Domain array. for shadings other than Axial or Radial this method throws an exception. """ return _PDFNetPython.Shading_GetParamEnd(self)
[docs] def IsExtendStart(self): r""" :rtype: boolean :return: a flag specifying whether to extend the shading beyond the starting point of the axis for Axial shading or starting circle for Radial shading. Notes: for shadings other than Axial or Radial this method throws an exception. """ return _PDFNetPython.Shading_IsExtendStart(self)
[docs] def IsExtendEnd(self): r""" :rtype: boolean :return: a flag specifying whether to extend the shading beyond the ending point of the axis for Axial shading or ending circle for Radial shading. Notes: for shadings other than Axial or Radial this method throws an exception. """ return _PDFNetPython.Shading_IsExtendEnd(self)
[docs] def GetCoordsAxial(self): r""" :rtype: std::vector< double,std::allocator< double > > :return: for Axial shading returns four numbers (out_x0, out_y0, out_x1, out_y1) specifying the starting and ending coordinates of the axis, expressed in the shading's target coordinate space. Notes: for shadings other than Axial this method throws an exception. """ return _PDFNetPython.Shading_GetCoordsAxial(self)
[docs] def GetCoordsRadial(self): r""" :rtype: std::vector< double,std::allocator< double > > :return: for Radial shading returns six numbers (x0 y0 r0 x1 y1 r1) specifying the centers and radii of the starting and ending circles, expressed in the shading's target coordinate space. The radii r0 and r1 must both be greater than or equal to 0. If one radius is 0, the corresponding circle is treated as a point; if both are 0, nothing is painted. Notes: for shadings other than Radial this method throws an exception. """ return _PDFNetPython.Shading_GetCoordsRadial(self)
[docs] def GetDomain(self): r""" :rtype: std::vector< double,std::allocator< double > > :return: An array of four numbers [xmin xmax ymin ymax] specifying the rectangular domain of coordinates over which the color function(s) are defined. If the function does not contain /Domain entry the function returns: [0 1 0 1]. Notes: for shadings other than Function this method throws an exception. """ return _PDFNetPython.Shading_GetDomain(self)
[docs] def GetMatrix(self): r""" :rtype: :py:class:`Matrix2D` :return: a matrix specifying a mapping from the coordinate space specified by the Domain entry into the shading's target coordinate space. Notes: for shadings other than Function this method throws an exception. """ return _PDFNetPython.Shading_GetMatrix(self)
[docs] def GetColor(self, args): r""" Overload 1: :rtype: :py:class:`ColorPt` :return: a color point for the given value of parametric variable t. Notes: for shadings other than Axial or Radial this method throws an exception. | Overload 2: :rtype: :py:class:`ColorPt` :return: a color point for the given value of parametric variable (t1, t2). Notes: for shadings other than Function this method throws an exception. """ return _PDFNetPython.Shading_GetColor(self, args)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.Shading_Destroy(self)
def __init__(self, args): _PDFNetPython.Shading_swiginit(self, _PDFNetPython.new_Shading(args)) mp_shade = property(_PDFNetPython.Shading_mp_shade_get, _PDFNetPython.Shading_mp_shade_set)
# Register Shading in _PDFNetPython: _PDFNetPython.Shading_swigregister(Shading)
[docs] class PatternColor(object): r""" Patterns are quite general, and have many uses; for example, they can be used to create various graphical textures, such as weaves, brick walls, sunbursts, and similar geometrical and chromatic effects. Patterns are specified in a special family of color spaces named Pattern, whose 'color values' are PatternColor objects instead of the numeric component values used with other spaces. Therefore PatternColor is to pattern color space what is ColorPt to all other color spaces. A tiling pattern consists of a small graphical figure called a pattern cell. Painting with the pattern replicates the cell at fixed horizontal and vertical intervals to fill an area. The effect is as if the figure were painted on the surface of a clear glass tile, identical copies of which were then laid down in an array covering the area and trimmed to its boundaries. This is called tiling the area. The pattern cell can include graphical elements such as filled areas, text, and sampled images. Its shape need not be rectangular, and the spacing of tiles can differ from the dimensions of the cell itself. The order in which individual tiles (instances of the cell) are painted is unspecified and unpredictable; it is inadvisable for the figures on adjacent tiles to overlap. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_PatternColor e_uncolored_tiling_pattern = _PDFNetPython.PatternColor_e_uncolored_tiling_pattern e_colored_tiling_pattern = _PDFNetPython.PatternColor_e_colored_tiling_pattern e_shading = _PDFNetPython.PatternColor_e_shading e_null = _PDFNetPython.PatternColor_e_null
[docs] def GetType(self): r""" :rtype: int :return: The pattern type """ return _PDFNetPython.PatternColor_GetType(self)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: the underlying SDF/Cos object """ return _PDFNetPython.PatternColor_GetSDFObj(self)
[docs] def GetMatrix(self): r""" :rtype: :py:class:`Matrix2D` :return: pattern matrix, a transformation matrix that maps the pattern's internal coordinate system to the default coordinate system of the pattern's parent content stream (the content stream in which the pattern is defined as a resource). The concatenation of the pattern matrix with that of the parent content stream establishes the pattern coordinate space, within which all graphics objects in the pattern are interpreted. """ return _PDFNetPython.PatternColor_GetMatrix(self)
[docs] def GetShading(self): r""" :rtype: :py:class:`Shading` :return: The shading object defining the shading pattern's gradient fill. Notes: for patterns other than Shading this method throws an exception. """ return _PDFNetPython.PatternColor_GetShading(self)
e_constant_spacing = _PDFNetPython.PatternColor_e_constant_spacing e_no_distortion = _PDFNetPython.PatternColor_e_no_distortion e_constant_spacing_fast_fill = _PDFNetPython.PatternColor_e_constant_spacing_fast_fill
[docs] def GetTilingType(self): r""" :rtype: int :return: the tiling type identifier that controls adjustments to the spacing of tiles relative to the device pixel grid: Notes: for patterns other than Tiling this method throws an exception. """ return _PDFNetPython.PatternColor_GetTilingType(self)
[docs] def GetBBox(self): r""" :rtype: :py:class:`Rect` :return: A rectangle in the pattern coordinate system giving the coordinates of the left, bottom, right, and top edges, respectively, of the pattern cell's bounding box. These boundaries are used to clip the pattern cell. Notes: for patterns other than Tiling this method throws an exception. """ return _PDFNetPython.PatternColor_GetBBox(self)
[docs] def GetXStep(self): r""" :rtype: double :return: the desired horizontal spacing between pattern cells, measured in the pattern coordinate system. Notes: that XStep and YStep may differ from the dimensions of the pattern cell implied by the BBox entry. This allows tiling with irregularly shaped figures. XStep and YStep may be either positive or negative, but not zero. for patterns other than Tiling this method throws an exception. """ return _PDFNetPython.PatternColor_GetXStep(self)
[docs] def GetYStep(self): r""" :rtype: double :return: the desired vertical spacing between pattern cells, measured in the pattern coordinate system. Notes: for patterns other than Tiling this method throws an exception. """ return _PDFNetPython.PatternColor_GetYStep(self)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.PatternColor_Destroy(self)
def __init__(self, args): _PDFNetPython.PatternColor_swiginit(self, _PDFNetPython.new_PatternColor(args)) mp_pc = property(_PDFNetPython.PatternColor_mp_pc_get, _PDFNetPython.PatternColor_mp_pc_set)
# Register PatternColor in _PDFNetPython: _PDFNetPython.PatternColor_swigregister(PatternColor)
[docs] class GState(object): r""" GState is a class that keeps track of a number of style attributes used to visually define graphical Elements. Each PDF::Element has an associated GState that can be used to query or set various graphics properties. Notes: current clipping path is not tracked in the graphics state for efficiency reasons. In most cases tracking of the current clipping path is best left to the client. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_transform = _PDFNetPython.GState_e_transform e_rendering_intent = _PDFNetPython.GState_e_rendering_intent e_stroke_cs = _PDFNetPython.GState_e_stroke_cs e_stroke_color = _PDFNetPython.GState_e_stroke_color e_fill_cs = _PDFNetPython.GState_e_fill_cs e_fill_color = _PDFNetPython.GState_e_fill_color e_line_width = _PDFNetPython.GState_e_line_width e_line_cap = _PDFNetPython.GState_e_line_cap e_line_join = _PDFNetPython.GState_e_line_join e_flatness = _PDFNetPython.GState_e_flatness e_miter_limit = _PDFNetPython.GState_e_miter_limit e_dash_pattern = _PDFNetPython.GState_e_dash_pattern e_char_spacing = _PDFNetPython.GState_e_char_spacing e_word_spacing = _PDFNetPython.GState_e_word_spacing e_horizontal_scale = _PDFNetPython.GState_e_horizontal_scale e_leading = _PDFNetPython.GState_e_leading e_font = _PDFNetPython.GState_e_font e_font_size = _PDFNetPython.GState_e_font_size e_text_render_mode = _PDFNetPython.GState_e_text_render_mode e_text_rise = _PDFNetPython.GState_e_text_rise e_text_knockout = _PDFNetPython.GState_e_text_knockout e_text_pos_offset = _PDFNetPython.GState_e_text_pos_offset e_blend_mode = _PDFNetPython.GState_e_blend_mode e_opacity_fill = _PDFNetPython.GState_e_opacity_fill e_opacity_stroke = _PDFNetPython.GState_e_opacity_stroke e_alpha_is_shape = _PDFNetPython.GState_e_alpha_is_shape e_soft_mask = _PDFNetPython.GState_e_soft_mask e_smoothnes = _PDFNetPython.GState_e_smoothnes e_auto_stoke_adjust = _PDFNetPython.GState_e_auto_stoke_adjust e_stroke_overprint = _PDFNetPython.GState_e_stroke_overprint e_fill_overprint = _PDFNetPython.GState_e_fill_overprint e_overprint_mode = _PDFNetPython.GState_e_overprint_mode e_transfer_funct = _PDFNetPython.GState_e_transfer_funct e_BG_funct = _PDFNetPython.GState_e_BG_funct e_UCR_funct = _PDFNetPython.GState_e_UCR_funct e_halftone = _PDFNetPython.GState_e_halftone e_null = _PDFNetPython.GState_e_null
[docs] def GetTransform(self): r""" :rtype: :py:class:`Matrix2D` :return: the transformation matrix for this element. Notes: If you are looking for a matrix that maps coordinates to the initial user space see Element::GetCTM(). """ return _PDFNetPython.GState_GetTransform(self)
[docs] def GetStrokeColorSpace(self): r""" :rtype: :py:class:`ColorSpace` :return: color space used for stroking """ return _PDFNetPython.GState_GetStrokeColorSpace(self)
[docs] def GetFillColorSpace(self): r""" :rtype: :py:class:`ColorSpace` :return: color space used for filling """ return _PDFNetPython.GState_GetFillColorSpace(self)
[docs] def GetStrokeColor(self): r""" :rtype: :py:class:`ColorPt` :return: a color value/point represented in the current stroke color space """ return _PDFNetPython.GState_GetStrokeColor(self)
[docs] def GetStrokePattern(self): r""" :rtype: :py:class:`PatternColor` :return: the SDF pattern object of currently selected PatternColorSpace used for stroking. """ return _PDFNetPython.GState_GetStrokePattern(self)
[docs] def GetFillColor(self): r""" :rtype: :py:class:`ColorPt` :return: a color value/point represented in the current fill color space """ return _PDFNetPython.GState_GetFillColor(self)
[docs] def GetFillPattern(self): r""" :rtype: :py:class:`PatternColor` :return: the pattern color of currently selected pattern color space used for filling. """ return _PDFNetPython.GState_GetFillPattern(self)
[docs] def GetFlatness(self): r""" :rtype: double :return: current value of flatness tolerance Flatness is a number in the range 0 to 100; a value of 0 specifies the output device's default flatness tolerance. The flatness tolerance controls the maximum permitted distance in device pixels between the mathematically correct path and an approximationructed from straight line segments. """ return _PDFNetPython.GState_GetFlatness(self)
e_butt_cap = _PDFNetPython.GState_e_butt_cap e_round_cap = _PDFNetPython.GState_e_round_cap e_square_cap = _PDFNetPython.GState_e_square_cap
[docs] def GetLineCap(self): r""" :rtype: int :return: currently selected LineCap style The line cap style specifies the shape to be used at the ends of open sub-paths (and dashes, if any) when they are stroked. """ return _PDFNetPython.GState_GetLineCap(self)
e_miter_join = _PDFNetPython.GState_e_miter_join e_round_join = _PDFNetPython.GState_e_round_join e_bevel_join = _PDFNetPython.GState_e_bevel_join
[docs] def GetLineJoin(self): r""" :rtype: int :return: currently selected LineJoin style The line join style specifies the shape to be used at the corners of paths that are stroked. """ return _PDFNetPython.GState_GetLineJoin(self)
[docs] def GetLineWidth(self): r""" :rtype: double :return: the thickness of the line used to stroke a path. Notes: A line width of 0 denotes the thinnest line that can be rendered at device resolution: 1 device pixel wide. """ return _PDFNetPython.GState_GetLineWidth(self)
[docs] def GetMiterLimit(self): r""" :rtype: double :return: current value of miter limit. The miter limit imposes a maximum on the ratio of the miter length to the line width. When the limit is exceeded, the join is converted from a miter to a bevel. """ return _PDFNetPython.GState_GetMiterLimit(self)
[docs] def GetDashes(self): r""" :rtype: std::vector< double,std::allocator< double > > :return: The method fills the vector with an array of numbers representing the dash pattern The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by a dash array and a dash phase. The dash array's elements are numbers that specify the lengths of alternating dashes and gaps; the dash phase specifies the distance into the dash pattern at which to start the dash. The elements of both the dash array and the dash phase are expressed in user space units. """ return _PDFNetPython.GState_GetDashes(self)
[docs] def GetPhase(self): r""" :rtype: double :return: the phase of the currently selected dash pattern. dash phase is expressed in user space units. """ return _PDFNetPython.GState_GetPhase(self)
[docs] def GetCharSpacing(self): r""" :rtype: double :return: currently selected character spacing. The character spacing parameter is a number specified in unscaled text space units. When the glyph for each character in the string is rendered, the character spacing is added to the horizontal or vertical component of the glyph's displacement, depending on the writing mode. See Section 5.2.1 in PDF Reference Manual for details. """ return _PDFNetPython.GState_GetCharSpacing(self)
[docs] def GetWordSpacing(self): r""" :rtype: double :return: currently selected word spacing Word spacing works the same way as character spacing, but applies only to the space character (char code 32). See Section 5.2.2 in PDF Reference Manual for details. """ return _PDFNetPython.GState_GetWordSpacing(self)
[docs] def GetHorizontalScale(self): r""" :rtype: double :return: currently selected horizontal scale The horizontal scaling parameter adjusts the width of glyphs by stretching or compressing them in the horizontal direction. Its value is specified as a percentage of the normal width of the glyphs, with 100 being the normal width. The scaling always applies to the horizontal coordinate in text space, independently of the writing mode. See Section 5.2.3 in PDF Reference Manual for details. """ return _PDFNetPython.GState_GetHorizontalScale(self)
[docs] def GetLeading(self): r""" :rtype: double :return: currently selected leading parameter The leading parameter is measured in unscaled text space units. It specifies the vertical distance between the baselines of adjacent lines of text. See Section 5.2.4 in PDF Reference Manual for details. """ return _PDFNetPython.GState_GetLeading(self)
[docs] def GetFont(self): r""" :rtype: :py:class:`Font` :return: currently selected font """ return _PDFNetPython.GState_GetFont(self)
[docs] def GetFontSize(self): r""" :rtype: double :return: the font size """ return _PDFNetPython.GState_GetFontSize(self)
e_fill_text = _PDFNetPython.GState_e_fill_text e_stroke_text = _PDFNetPython.GState_e_stroke_text e_fill_stroke_text = _PDFNetPython.GState_e_fill_stroke_text e_invisible_text = _PDFNetPython.GState_e_invisible_text e_fill_clip_text = _PDFNetPython.GState_e_fill_clip_text e_stroke_clip_text = _PDFNetPython.GState_e_stroke_clip_text e_fill_stroke_clip_text = _PDFNetPython.GState_e_fill_stroke_clip_text e_clip_text = _PDFNetPython.GState_e_clip_text
[docs] def GetTextRenderMode(self): r""" :rtype: int :return: current text rendering mode. The text rendering mode determines whether showing text causes glyph outlines to be stroked, filled, used as a clipping boundary, or some combination of the three. See Section 5.2.5 in PDF Reference Manual for details.. """ return _PDFNetPython.GState_GetTextRenderMode(self)
[docs] def GetTextRise(self): r""" :rtype: double :return: current value of text rise Text rise specifies the distance, in unscaled text space units, to move the baseline up or down from its default location. Positive values of text rise move the baseline up """ return _PDFNetPython.GState_GetTextRise(self)
[docs] def IsTextKnockout(self): r""" :rtype: boolean :return: a boolean flag that determines the text element is considered elementary objects for purposes of color compositing in the transparent imaging model. """ return _PDFNetPython.GState_IsTextKnockout(self)
e_absolute_colorimetric = _PDFNetPython.GState_e_absolute_colorimetric e_relative_colorimetric = _PDFNetPython.GState_e_relative_colorimetric e_saturation = _PDFNetPython.GState_e_saturation e_perceptual = _PDFNetPython.GState_e_perceptual
[docs] def GetRenderingIntent(self): r""" :rtype: int :return: The color intent to be used for rendering the Element """ return _PDFNetPython.GState_GetRenderingIntent(self)
[docs] @staticmethod def GetRenderingIntentType(name): r""" A utility function that maps a string representing a rendering intent to RenderingIntent type. :type name: string :param name: string that represents the rendering intent to get. :rtype: int :return: The color rendering intent type matching the specified string """ return _PDFNetPython.GState_GetRenderingIntentType(name)
e_bl_compatible = _PDFNetPython.GState_e_bl_compatible e_bl_normal = _PDFNetPython.GState_e_bl_normal e_bl_multiply = _PDFNetPython.GState_e_bl_multiply e_bl_screen = _PDFNetPython.GState_e_bl_screen e_bl_difference = _PDFNetPython.GState_e_bl_difference e_bl_darken = _PDFNetPython.GState_e_bl_darken e_bl_lighten = _PDFNetPython.GState_e_bl_lighten e_bl_color_dodge = _PDFNetPython.GState_e_bl_color_dodge e_bl_color_burn = _PDFNetPython.GState_e_bl_color_burn e_bl_exclusion = _PDFNetPython.GState_e_bl_exclusion e_bl_hard_light = _PDFNetPython.GState_e_bl_hard_light e_bl_overlay = _PDFNetPython.GState_e_bl_overlay e_bl_soft_light = _PDFNetPython.GState_e_bl_soft_light e_bl_luminosity = _PDFNetPython.GState_e_bl_luminosity e_bl_hue = _PDFNetPython.GState_e_bl_hue e_bl_saturation = _PDFNetPython.GState_e_bl_saturation e_bl_color = _PDFNetPython.GState_e_bl_color
[docs] def GetBlendMode(self): r""" :rtype: int :return: the current blend mode to be used in the transparent imaging model. Corresponds to the /BM key within the ExtGState's dictionary. """ return _PDFNetPython.GState_GetBlendMode(self)
[docs] def GetFillOpacity(self): r""" :rtype: double :return: the opacity value for painting operations other than stroking. Returns the value of the /ca key in the ExtGState dictionary. If the value is not found, the default value of 1 is returned. """ return _PDFNetPython.GState_GetFillOpacity(self)
[docs] def GetStrokeOpacity(self): r""" :rtype: double :return: opacity value for stroke painting operations for paths and glyph outlines. Returns the value of the /CA key in the ExtGState dictionary. If the value is not found, the default value of 1 is returned. """ return _PDFNetPython.GState_GetStrokeOpacity(self)
[docs] def GetAISFlag(self): r""" :rtype: boolean :return: the alpha source flag ('alpha is shape'), specifying whether the current soft mask and alphaant are to be interpreted as shape values (true) or opacity values (false). """ return _PDFNetPython.GState_GetAISFlag(self)
[docs] def GetSoftMask(self): r""" :rtype: :py:class:`Obj` :return: Associated soft mask. NULL if the soft mask is not selected or SDF dictionary representing the soft mask otherwise. """ return _PDFNetPython.GState_GetSoftMask(self)
[docs] def GetSoftMaskTransform(self): r""" :rtype: :py:class:`Matrix2D` :return: The soft mask transform. This is the transformation matrix at the moment the soft mask is established in the graphics state with the gs operator. This information is only relevant when applying the soft mask that may be specified in the graphics state to the current element. """ return _PDFNetPython.GState_GetSoftMaskTransform(self)
[docs] def GetStrokeOverprint(self): r""" :rtype: boolean :return: whether overprint is enabled for stroke painting operations. Corresponds to the /OP key within the ExtGState's dictionary. """ return _PDFNetPython.GState_GetStrokeOverprint(self)
[docs] def GetFillOverprint(self): r""" :rtype: boolean :return: whether overprint is enabled for fill painting operations. Corresponds to the /op key within the ExtGState's dictionary. """ return _PDFNetPython.GState_GetFillOverprint(self)
[docs] def GetOverprintMode(self): r""" :rtype: int :return: the overprint mode used by this graphics state. Corresponds to the /OPM key within the ExtGState's dictionary. """ return _PDFNetPython.GState_GetOverprintMode(self)
[docs] def GetAutoStrokeAdjust(self): r""" :rtype: boolean :return: a flag specifying whether stroke adjustment is enabled in the graphics state. Corresponds to the /SA key within the ExtGState's dictionary. """ return _PDFNetPython.GState_GetAutoStrokeAdjust(self)
[docs] def GetSmoothnessTolerance(self): r""" :rtype: double :return: the smoothness tolerance used to control the quality of smooth shading. Corresponds to the /SM key within the ExtGState's dictionary. The allowable error (or tolerance) is expressed as a fraction of the range of the color component, from 0.0 to 1.0. """ return _PDFNetPython.GState_GetSmoothnessTolerance(self)
[docs] def GetTransferFunct(self): r""" :rtype: :py:class:`Obj` :return: currently selected transfer function (NULL by default) used during color conversion process. A transfer function adjusts the values of color components to compensate for nonlinear response in an output device and in the human eye. Corresponds to the /TR key within the ExtGState's dictionary. """ return _PDFNetPython.GState_GetTransferFunct(self)
[docs] def GetBlackGenFunct(self): r""" :rtype: :py:class:`Obj` :return: currently selected black-generation function (NULL by default) used during conversion between DeviceRGB and DeviceCMYK. Corresponds to the /BG key within the ExtGState's dictionary. """ return _PDFNetPython.GState_GetBlackGenFunct(self)
[docs] def GetUCRFunct(self): r""" :rtype: :py:class:`Obj` :return: currently selected undercolor-removal function (NULL by default) used during conversion between DeviceRGB and DeviceCMYK. Corresponds to the /UCR key within the ExtGState's dictionary. """ return _PDFNetPython.GState_GetUCRFunct(self)
[docs] def GetHalftone(self): r""" :rtype: :py:class:`Obj` :return: currently selected halftone dictionary or stream (NULL by default). Corresponds to the /HT key within the ExtGState's dictionary. Halftoning is a process by which continuous-tone colors are approximated on an output device that can achieve only a limited number of discrete colors. """ return _PDFNetPython.GState_GetHalftone(self)
[docs] def SetTransform(self, args): r""" Overload 1: Set the transformation matrix associated with this element. :type mtx: :py:class:`Matrix2D` :param mtx: The new transformation for this text element. Notes: in PDF associating a transformation matrix with an element ('cm' operator) will also affect all subsequent elements. | Overload 2: Set the transformation matrix associated with this element. A transformation matrix in PDF is specified by six numbers, usually in the form of an array containing six elements. In its most general form, this array is denoted [a b c d h v]; it can represent any linear transformation from one coordinate system to another. For more information about PDF matrices please refer to section 4.2.2 'Common Transformations' in PDF Reference Manual, and to documentation for Common::Matrix2D class. :type a: double :param a: - horizontal 'scaling' component of the new text matrix. :type b: double :param b: - 'rotation' component of the new text matrix. :type c: double :param c: - 'rotation' component of the new text matrix. :type d: double :param d: - vertical 'scaling' component of the new text matrix. :type h: double :param h: - horizontal translation component of the new text matrix. :type v: double :param v: - vertical translation component of the new text matrix. """ return _PDFNetPython.GState_SetTransform(self, args)
[docs] def Concat(self, args): r""" Overload 1: Concatenate the given matrix to the transformation matrix of this element. :type mtx: :py:class:`Matrix2D` :param mtx: Matrix2D object to concatenate the current matrix with. | Overload 2: Concatenate the given matrix expressed in its values to the transformation matrix of this element. :type a: double :param a: - horizontal 'scaling' component of the new text matrix. :type b: double :param b: - 'rotation' component of the new text matrix. :type c: double :param c: - 'rotation' component of the new text matrix. :type d: double :param d: - vertical 'scaling' component of the new text matrix. :type h: double :param h: - horizontal translation component of the new text matrix. :type v: double :param v: - vertical translation component of the new text matrix. """ return _PDFNetPython.GState_Concat(self, args)
[docs] def SetStrokeColorSpace(self, cs): r""" Sets the color space used for stroking operations :type cs: :py:class:`ColorSpace` :param cs: ColorSpace object to use for stroking operations """ return _PDFNetPython.GState_SetStrokeColorSpace(self, cs)
[docs] def SetFillColorSpace(self, cs): r""" Sets the color space used for filling operations :type cs: :py:class:`ColorSpace` :param cs: ColorSpace object to use for filling operations """ return _PDFNetPython.GState_SetFillColorSpace(self, cs)
[docs] def SetStrokeColor(self, args): r""" Overload 1: Sets the color value/point used for stroking operations. :type c: :py:class:`ColorPt` :param c: is the color used for stroking operations Notes: The color value must be represented in the currently selected color space used for stroking. | Overload 2: Set the stroke color to the given tiling pattern. :type pattern: :py:class:`PatternColor` :param pattern: SDF pattern object. Notes: The currently selected stroke color space must be Pattern color space. | Overload 3: Set the stroke color to the given uncolored tiling pattern. :type pattern: :py:class:`PatternColor` :param pattern: pattern (PatternType = 1 and PaintType = 2) object. :type c: :py:class:`ColorPt` :param c: is a color in the pattern's underlying color space. Notes: The currently selected stroke color space must be Pattern color space. """ return _PDFNetPython.GState_SetStrokeColor(self, args)
[docs] def SetFillColor(self, args): r""" Overload 1: Sets the color value/point used for filling operations. :type c: :py:class:`ColorPt` :param c: the color used for filling operations The color value must be represented in the currently selected color space used for filling. | Overload 2: Set the fill color to the given tiling pattern. :type pattern: :py:class:`PatternColor` :param pattern: New pattern color. Notes: The currently selected fill color space must be Pattern color space. | Overload 3: Set the fill color to the given uncolored tiling pattern. :type pattern: :py:class:`PatternColor` :param pattern: PatternColor (PatternType = 1 and PaintType = 2) object. :type c: :py:class:`ColorPt` :param c: is a color in the pattern's underlying color space. Notes: The currently selected fill color space must be Pattern color space. """ return _PDFNetPython.GState_SetFillColor(self, args)
[docs] def SetFlatness(self, flatness): r""" Sets the value of flatness tolerance. :type flatness: double :param flatness: is a number in the range 0 to 100; a value of 0 specifies the output device's default flatness tolerance. The flatness tolerance controls the maximum permitted distance in device pixels between the mathematically correct path and an approximationructed from straight line segments. """ return _PDFNetPython.GState_SetFlatness(self, flatness)
[docs] def SetLineCap(self, cap): r""" Sets LineCap style property. The line cap style specifies the shape to be used at the ends of open subpaths (and dashes, if any) when they are stroked. """ return _PDFNetPython.GState_SetLineCap(self, cap)
[docs] def SetLineJoin(self, join): r""" Sets LineJoin style property. The line join style specifies the shape to be used at the corners of paths that are stroked. """ return _PDFNetPython.GState_SetLineJoin(self, join)
[docs] def SetLineWidth(self, width): r""" Sets the thickness of the line used to stroke a path. :type width: double :param width: a non-negative number expressed in user space units. A line width of 0 denotes the thinnest line that can be rendered at device resolution: 1 device pixel wide. """ return _PDFNetPython.GState_SetLineWidth(self, width)
[docs] def SetMiterLimit(self, miter_limit): r""" Sets miter limit. :type miter_limit: double :param miter_limit: A number that imposes a maximum on the ratio of the miter length to the line width. When the limit is exceeded, the join is converted from a miter to a bevel. """ return _PDFNetPython.GState_SetMiterLimit(self, miter_limit)
[docs] def SetDashPattern(self, dash_array, phase): r""" Sets the dash pattern used to stroke paths. The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by a dash array and a dash phase. The elements of both the dash array and the dash phase are expressed in user space units. :type dash_array: std::vector< double,std::allocator< double > > :param dash_array: the numbers that specify the lengths of alternating dashes and gaps. :type phase: double :param phase: specifies the distance into the dash pattern at which to start the dash. """ return _PDFNetPython.GState_SetDashPattern(self, dash_array, phase)
[docs] def SetCharSpacing(self, char_spacing): r""" Sets character spacing. :type char_spacing: double :param char_spacing: a number specified in unscaled text space units. When the glyph for each character in the string is rendered, the character spacing is added to the horizontal or vertical component of the glyph's displacement, depending on the writing mode. See Section 5.2.1 in PDF Reference Manual for details. """ return _PDFNetPython.GState_SetCharSpacing(self, char_spacing)
[docs] def SetWordSpacing(self, word_spacing): r""" Sets word spacing. :type word_spacing: double :param word_spacing: - a number specified in unscaled text space units. Word spacing works the same way as character spacing, but applies only to the space character (char code 32). See Section 5.2.2 in PDF Reference Manual for details. """ return _PDFNetPython.GState_SetWordSpacing(self, word_spacing)
[docs] def SetHorizontalScale(self, hscale): r""" Sets horizontal scale. The horizontal scaling parameter adjusts the width of glyphs by stretching or compressing them in the horizontal direction. Its value is specified as a percentage of the normal width of the glyphs, with 100 being the normal width. The scaling always applies to the horizontal coordinate in text space, independently of the writing mode. See Section 5.2.3 in PDF Reference Manual for details. :type hscale: double :param hscale: value to set horizontal scale to. """ return _PDFNetPython.GState_SetHorizontalScale(self, hscale)
[docs] def SetLeading(self, leading): r""" Sets the leading parameter. The leading parameter is measured in unscaled text space units. It specifies the vertical distance between the baselines of adjacent lines of text. See Section 5.2.4 in PDF Reference Manual for details. :type leading: double :param leading: number representing vertical distance between lines of text """ return _PDFNetPython.GState_SetLeading(self, leading)
[docs] def SetFont(self, font, font_sz): r""" Sets the font and font size used to draw text. :type font: :py:class:`Font` :param font: Font to draw the text with :type font_sz: double :param font_sz: size of the font to draw the text with """ return _PDFNetPython.GState_SetFont(self, font, font_sz)
[docs] def SetTextRenderMode(self, rmode): r""" Sets text rendering mode. The text rendering mode determines whether showing text causes glyph outlines to be stroked, filled, used as a clipping boundary, or some combination of the three. See Section 5.2.5 in PDF Reference Manual for details.. """ return _PDFNetPython.GState_SetTextRenderMode(self, rmode)
[docs] def SetTextRise(self, rise): r""" Sets text rise. Text rise specifies the distance, in unscaled text space units, to move the baseline up or down from its default location. Positive values of text rise move the baseline up :type rise: double :param rise: distance to move baseline up. Negative values move baseline down. """ return _PDFNetPython.GState_SetTextRise(self, rise)
[docs] def SetTextKnockout(self, knockout): r""" Mark the object as elementary for purposes of color compositing in the transparent imaging model. :type knockout: boolean :param knockout: Whether an object is elementary or not. """ return _PDFNetPython.GState_SetTextKnockout(self, knockout)
[docs] def SetRenderingIntent(self, intent): r"""Sets the color intent to be used for rendering the Element.""" return _PDFNetPython.GState_SetRenderingIntent(self, intent)
[docs] def SetBlendMode(self, BM): r""" Sets the current blend mode to be used in the transparent imaging model. Corresponds to the /BM key within the ExtGState's dictionary. :type BM: int :param BM: - New blending mode type. .. code-block:: c++ // C# gs.SetBlendMode(GState.BlendMode.e_lighten); // C++ gs-SetBlendMode(GState::e_lighten); """ return _PDFNetPython.GState_SetBlendMode(self, BM)
[docs] def SetFillOpacity(self, ca): r""" Sets the opacity value for painting operations other than stroking. Corresponds to the value of the /ca key in the ExtGState dictionary. :type ca: double :param ca: value to set fill opacity to """ return _PDFNetPython.GState_SetFillOpacity(self, ca)
[docs] def SetStrokeOpacity(self, ca): r""" Sets opacity value for stroke painting operations for paths and glyph outlines. Corresponds to the value of the /CA key in the ExtGState dictionary. :type ca: double :param ca: value to set stroke opacity to """ return _PDFNetPython.GState_SetStrokeOpacity(self, ca)
[docs] def SetAISFlag(self, AIS): r""" Specifies if the alpha is to be interpreted as a shape or opacity mask. The alpha source flag ('alpha is shape'), specifies whether the current soft mask and alphaant are to be interpreted as shape values (true) or opacity values (false). :type AIS: boolean :param AIS: true for interpretation as shape values or false for opacity values """ return _PDFNetPython.GState_SetAISFlag(self, AIS)
[docs] def SetSoftMask(self, SM): r""" Sets the soft mask of the extended graphics state. Corresponds to the /SMask key within the ExtGState's dictionary. :type SM: :py:class:`Obj` :param SM: - SDF/Cos black-generation function or name """ return _PDFNetPython.GState_SetSoftMask(self, SM)
[docs] def SetStrokeOverprint(self, OP): r""" Specifies if overprint is enabled for stroke operations. Corresponds to the /OP key within the ExtGState's dictionary. :type OP: boolean :param OP: true to enable overprint for stroke, false to disable. """ return _PDFNetPython.GState_SetStrokeOverprint(self, OP)
[docs] def SetFillOverprint(self, op): r""" Specifies if overprint is enabled for fill operations. Corresponds to the /op key within the ExtGState's dictionary. :type op: boolean :param op: true to enable overprint for fill, false to disable. """ return _PDFNetPython.GState_SetFillOverprint(self, op)
[docs] def SetOverprintMode(self, OPM): r""" Sets the overprint mode. Corresponds to the /OPM key within the ExtGState's dictionary. :type OPM: int :param OPM: overprint mode. """ return _PDFNetPython.GState_SetOverprintMode(self, OPM)
[docs] def SetAutoStrokeAdjust(self, SA): r""" Specify whether to apply automatic stroke adjustment. Corresponds to the /SA key within the ExtGState's dictionary. :type SA: boolean :param SA: if true automatic stroke adjustment will be applied. """ return _PDFNetPython.GState_SetAutoStrokeAdjust(self, SA)
[docs] def SetSmoothnessTolerance(self, SM): r""" Sets the smoothness tolerance used to control the quality of smooth shading. Corresponds to the /SM key within the ExtGState's dictionary. """ return _PDFNetPython.GState_SetSmoothnessTolerance(self, SM)
[docs] def SetBlackGenFunct(self, BG): r""" Sets black-generation function used during conversion between DeviceRGB and DeviceCMYK. Corresponds to the /BG key within the ExtGState's dictionary. :type BG: :py:class:`Obj` :param BG: - SDF/Cos black-generation function or name """ return _PDFNetPython.GState_SetBlackGenFunct(self, BG)
[docs] def SetUCRFunct(self, UCR): r""" Sets undercolor-removal function used during conversion between DeviceRGB and DeviceCMYK. Corresponds to the /UCR key within the ExtGState's dictionary. :type UCR: :py:class:`Obj` :param UCR: - SDF/Cos undercolor-removal function or name """ return _PDFNetPython.GState_SetUCRFunct(self, UCR)
[docs] def SetTransferFunct(self, TR): r""" Sets transfer function used during color conversion process. A transfer function adjusts the values of color components to compensate for nonlinear response in an output device and in the human eye. Corresponds to the /TR key within the ExtGState's dictionary. :type TR: :py:class:`Obj` :param TR: - SDF/Cos transfer function, array, or name """ return _PDFNetPython.GState_SetTransferFunct(self, TR)
[docs] def SetHalftone(self, HT): r""" Sets currently selected halftone dictionary or stream (NULL by default). Corresponds to the /HT key within the ExtGState's dictionary. Halftoning is a process by which continuous-tone colors are approximated on an output device that can achieve only a limited number of discrete colors. :type HT: :py:class:`Obj` :param HT: - SDF/Cos halftone dictionary, stream, or name """ return _PDFNetPython.GState_SetHalftone(self, HT)
def __init__(self, args): _PDFNetPython.GState_swiginit(self, _PDFNetPython.new_GState(args)) mp_state = property(_PDFNetPython.GState_mp_state_get, _PDFNetPython.GState_mp_state_set) __swig_destroy__ = _PDFNetPython.delete_GState
# Register GState in _PDFNetPython: _PDFNetPython.GState_swigregister(GState)
[docs] def GState_GetRenderingIntentType(name): r""" A utility function that maps a string representing a rendering intent to RenderingIntent type. :type name: string :param name: string that represents the rendering intent to get. :rtype: int :return: The color rendering intent type matching the specified string """ return _PDFNetPython.GState_GetRenderingIntentType(name)
[docs] class Image(object): r""" Image class provides common methods for working with PDF images. Notes: PDF::Element contains a similar interface used to access image data. To create the Image object from image PDF::Element, pass the Element's SDF/Cos dictionary to Imageructor (i.e. Image image(element->GetXObject()) ) """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def CreateImageMask(args): r""" Overload 1: Create and embed an Image from any GDI+ Bitmap taking into account specified compression hints. Notes: see Image::Create for details. This method is available only on Windows platforms. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). :param bmp: - GDI+ bitmap. :rtype: :py:class:`Image` :return: PDF::Image object representing the embedded image. Create and embed an ImageMask. Embed the raw image data taking into account specified compression hints. The ImageMask can be used as a stencil mask for painting in the current color or as an explicit mask specifying which areas of the image to paint and which to mask out. One of the most important uses of stencil masking is for painting character glyphs represented as bitmaps. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). :type buf: string :param buf: - The stream or buffer containing image data stored in 1 bit per sample format. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details). :type width: int :param width: - The width of the image, in samples. :type height: int :param height: - The height of the image, in samples. :type encoder_hints: :py:class:`Obj` :param encoder_hints: - An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image::Create() for details. :rtype: :py:class:`Image` :return: PDF::Image object representing the embedded ImageMask. | Overload 2: Create and embed an ImageMask. Notes: see Image::CreateImageMask for details. | Overload 3: Create and embed an ImageMask. Notes: see Image::CreateImageMask for details. """ return _PDFNetPython.Image_CreateImageMask(args)
[docs] @staticmethod def CreateSoftMask(args): r""" Overload 1: Create and embed a Soft Mask. Embed the raw image data taking into account specified compression hints. A soft-mask image (see "Soft-Mask Images" in PDF Reference Manual) is used as a source of mask shape or mask opacity values in the transparent imaging model. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). :type buf: string :param buf: - The stream or buffer containing image data represented in DeviceGray color space (i.e. one component per sample). The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details). :type width: int :param width: - The width of the image, in samples. :type height: int :param height: - The height of the image, in samples. :type bpc: int :param bpc: - The number of bits used to represent each color component. :type encoder_hints: :py:class:`Obj` :param encoder_hints: - An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image::Create() for details. Notes: this feature is available only in PDF 1.4 and higher. | Overload 2: Create and embed a Soft Mask. Embed the raw image data taking into account specified compression hints. Notes: see Image::CreateSoftMask for details. | Overload 3: Create and embed a Soft Mask. Embed the raw image data taking into account specified compression hints. Notes: see Image::CreateSoftMask for details. """ return _PDFNetPython.Image_CreateSoftMask(args)
e_none = _PDFNetPython.Image_e_none e_jpeg = _PDFNetPython.Image_e_jpeg e_jp2 = _PDFNetPython.Image_e_jp2 e_flate = _PDFNetPython.Image_e_flate e_g3 = _PDFNetPython.Image_e_g3 e_g4 = _PDFNetPython.Image_e_g4 e_ascii_hex = _PDFNetPython.Image_e_ascii_hex
[docs] @staticmethod def Create(args): r""" Overload 1: Create and embed an Image from an external file taking into account specified compression hints. By default the function will either pass-through data preserving the original compression or will compress data using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. To obtain SDF::Doc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc(). :type filename: string :param filename: - The name of the image file. Currently supported formats are JPEG, PNG, GIF, TIFF, BMP, EMF, and WMF. Other raster formats can be embedded by decompressing image data and using other versions of Image::Create(...) method. :type encoder_hints: :py:class:`Obj` :param encoder_hints: - An optional SDF::Obj containing a hint (or an SDF::Array of hints) that could be used to select a specific compression method and compression parameters. For a concrete example of how to create encoder hints, please take a look at JBIG2Test and AddImage sample projects. The image encoder accepts the following hints: - /JBIG2; SDF::Name("JBIG2"), An SDF::Name Object with value equal to "JBIG2". If the image is monochrome (i.e. bpc == 1), the encoder will compress the image using JBIG2Decode filter. Note that JBIG2 compression is not recommended for use on scanned text/financial documents or equivalent since its lossless nature can lead to similar looking numbers or characters being replaced. - [/JBIG2 /Threshold 0.6 /SharePages 50] - Compress a monochrome image using lossy JBIG2Decode compression with the given image threshold and by sharing segments from a specified number of pages. The threshold is a doubleing point number in the range from 0.4 to 0.9. Increasing the threshold value will increase image quality, but may increase the file size. The default value for threshold is 0.85. "SharePages" parameter can be used to specify the maximum number of pages sharing a common 'JBIG2Globals' segment stream. Increasing the value of this parameter improves compression ratio at the expense of memory usage. - [/CCITT] - Compress a monochrome (i.e. bpc == 1) image using CCITT Group 4 compression. This algorithm typically produces larger output than JBIG2, but is lossless. This makes it much more suitable for scanned text documents. CCITT is the best option for more general monochrome compression use cases, since JBIG2 has potential to change image content. - [/JPEG] - Use JPEG compression with default compression. - [/JPEG /Quality 60] - Use JPEG compression with given quality setting. The "Quality" value is expressed on the 0..100 scale. - [/JPEG2000] - Use JPEG2000 compression to compress a RGB or a grayscale image.<para> - [/JP2] - Use JPEG2000 compression with JP2 encoding. JP2 does not support CMYK images.<para> - [/Flate] - Use Flate compression with maximum compression at the expense of speed. - [/Flate /Level 9] - Use Flate compression using specified compression level. Compression "Level" must be a number between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). - /RAW or [/RAW] - The encoder will not use any compression method and the image will be stored in the raw format. :rtype: :py:class:`Image` :return: PDF::Image object representing the embedded image. Notes: For C++ developers: Current document does not take the ownership of the encoder_hints object. Therefore it is a good programming practice to create encoder_hints object on the stack. | Overload 2: Create and embed an Image. Embed the raw image data taking into account specified compression hints. By default the function will compress all images using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). :type buf: unsigned char :param buf: - The stream or buffer containing image data. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details). :type width: int :param width: - The width of the image, in samples. :type height: int :param height: - The height of the image, in samples. :type bpc: int :param bpc: - The number of bits used to represent each color component. :type color_space: :py:class:`ColorSpace` :param color_space: - The color space in which image samples are represented. :type encoder_hints: :py:class:`Obj` :param encoder_hints: - An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image::Create() for details. :rtype: :py:class:`Image` :return: PDF::Image object representing the embedded image. | Overload 3: Create and embed an Image. Embed the raw image data taking into account specified compression hints. By default the function will compress all images using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). :type buf: unsigned char :param buf: - The stream or buffer containing image data. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details). :type width: int :param width: - The width of the image, in samples. :type height: int :param height: - The height of the image, in samples. :type bpc: int :param bpc: - The number of bits used to represent each color component. :type color_space: :py:class:`ColorSpace` :param color_space: - The color space in which image samples are represented. :param encoder_hints: - An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image::Create() for details. :rtype: :py:class:`Image` :return: PDF::Image object representing the embedded image. | Overload 4: Create and embed an Image. Embed the raw image data taking into account specified compression hints. Notes: see Image::Create for details. | Overload 5: Create and embed an Image. Embed the raw image data taking into account specified compression hints. Notes: see Image::Create for details. | Overload 6: Create and embed an Image. Embed the raw image data taking into account specified compression hints. Notes: see Image::Create for details. | Overload 7: Create and embed an Image. Embed the raw image data taking into account specified compression hints. Notes: see Image::Create for details. | Overload 8: Create and embed an Image. Embed the raw image data taking into account specified compression hints. Notes: see Image::Create for details. PDFNet takes ownership of the filter | Overload 9: Create and embed an Image. Embed the raw image data taking into account specified compression hints. Notes: see Image::Create for details. PDFNet takes ownership of the filter | Overload 10: Directly embed the image that is already compressed using the Image::InputFilter format. The function can be used to pass-through pre-compressed image data. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). :type buf: string :param buf: - The stream or buffer containing compressed image data. The compression format must match the input_format parameter. :type width: int :param width: - The width of the image, in samples. :type height: int :param height: - The height of the image, in samples. :type bpc: int :param bpc: - The number of bits used to represent each color component. :type color_space: :py:class:`ColorSpace` :param color_space: - The color space in which image samples are specified. :type input_format: int :param input_format: - Image::InputFilter describing the format of pre-compressed image data. :rtype: :py:class:`Image` :return: PDF::Image object representing the embedded image. | Overload 11: Embed the raw image data taking into account specified compression hints. Notes: see the above method for details. """ return _PDFNetPython.Image_Create(args)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: the underlying SDF/Cos object """ return _PDFNetPython.Image_GetSDFObj(self)
[docs] def IsValid(self): r""" :rtype: boolean :return: whether this is a valid raster image. If the function returns false the underlying SDF/Cos object is not a valid raster image and this Image object should be treated as null. """ return _PDFNetPython.Image_IsValid(self)
[docs] def GetImageData(self): r""" :rtype: :py:class:`Filter` :return: A stream (filter) containing decoded image data """ return _PDFNetPython.Image_GetImageData(self)
[docs] def GetImageDataSize(self): r""" :rtype: int :return: the size of image data in bytes """ return _PDFNetPython.Image_GetImageDataSize(self)
[docs] def GetImageColorSpace(self): r""" Convert PDF image to GDI+ Bitmap. :rtype: :py:class:`ColorSpace` :return: GDI+ bitmap from this image. PDFNet creates a GDI+ bitmap that closely matches the original image in terms of the image depth and the number of color channels. PDF color spaces that do not have a counterpart in GDI+ are converted to RGB. Notes: This method is available only on Windows platforms. :rtype: :py:class:`ColorSpace` :return: The SDF object representing the color space in which image samples are specified or NULL if: - the image is an image mask - or is compressed using JPXDecode with missing ColorSpace entry in image dictionary. The returned color space may be any type of color space except Pattern. """ return _PDFNetPython.Image_GetImageColorSpace(self)
[docs] def GetImageWidth(self): r""" :rtype: int :return: the width of the image, in samples. """ return _PDFNetPython.Image_GetImageWidth(self)
[docs] def GetImageHeight(self): r""" :rtype: int :return: the height of the image, in samples. """ return _PDFNetPython.Image_GetImageHeight(self)
[docs] def GetDecodeArray(self): r""" :rtype: :py:class:`Obj` :return: Decode array or NULL if the parameter is not specified. A decode object is an array of numbers describing how to map image samples into the range of values appropriate for the images color space . If ImageMask is true, the array must be either [0 1] or [1 0]; otherwise, its length must be twice the number of color components required by ColorSpace. Default value depends on the color space, See Table 4.36 in PDF Ref. Manual. """ return _PDFNetPython.Image_GetDecodeArray(self)
[docs] def GetBitsPerComponent(self): r""" :rtype: int :return: the number of bits used to represent each color component. Only a single value may be specified; the number of bits is the same for all color components. Valid values are 1, 2, 4, 8, and 16. """ return _PDFNetPython.Image_GetBitsPerComponent(self)
[docs] def GetComponentNum(self): r""" :rtype: int :return: the number of color components per sample. """ return _PDFNetPython.Image_GetComponentNum(self)
[docs] def IsImageMask(self): r""" :rtype: boolean :return: a boolean indicating whether the inline image is to be treated as an image mask. """ return _PDFNetPython.Image_IsImageMask(self)
[docs] def IsImageInterpolate(self): r""" :rtype: boolean :return: a boolean indicating whether image interpolation is to be performed. """ return _PDFNetPython.Image_IsImageInterpolate(self)
[docs] def GetMask(self): r""" :rtype: :py:class:`Obj` :return: an image XObject defining an image mask to be applied to this image (See 'Explicit Masking', 4.8.5), or an array specifying a range of colors to be applied to it as a color key mask (See 'Color Key Masking'). If IsImageMask() return true, this method will return NULL. """ return _PDFNetPython.Image_GetMask(self)
[docs] def SetMask(self, args): r""" Overload 1: Set an Explicit Image Mask. :type image_mask: :py:class:`Image` :param image_mask: An Image object which serves as an explicit mask for the base (this) image. The base image and the image mask need not have the same resolution (Width and Height values), but since all images are defined on the unit square in user space, their boundaries on the page will coincide; that is, they will overlay each other. The image mask indicates which places on the page are to be painted and which are to be masked out (left unchanged). Unmasked areas are painted with the corresponding portions of the base image; masked areas are not. Notes: image_mask must be a valid image mask (i.e. image_mask.IsImageMask() must return true. | Overload 2: Set a Color Key Mask. :type mask: :py:class:`Obj` :param mask: is an Cos/SDF array specifying a range of colors to be masked out. Samples in the image that fall within this range are not painted, allowing the existing background to show through. The effect is similar to that of the video technique known as chroma-key. For details of the array format please refer to section 4.8.5 'Color Key Masking' in PDF Reference Manual. Notes: the current document takes the ownership of the given SDF object. """ return _PDFNetPython.Image_SetMask(self, args)
[docs] def GetSoftMask(self): r""" :rtype: :py:class:`Obj` :return: an image XObject defining a Soft Mask to be applied to this image (See section 7.5.4 'Soft-Mask Images' in PDF Reference Manual), or NULL if the image does not have the soft mask. """ return _PDFNetPython.Image_GetSoftMask(self)
[docs] def SetSoftMask(self, soft_mask): r""" Set a Soft Mask. :type soft_mask: :py:class:`Image` :param soft_mask: is a subsidiary Image object defining a soft-mask image (See section 7.5.4 'Soft-Mask Images' in PDF Reference Manual) to be used as a source of mask shape or mask opacity values in the transparent imaging model. The alpha source parameter in the graphics state determines whether the mask values are interpreted as shape or opacity. """ return _PDFNetPython.Image_SetSoftMask(self, soft_mask)
[docs] def GetImageRenderingIntent(self): r""" :rtype: int :return: The color rendering intent to be used in rendering the image. """ return _PDFNetPython.Image_GetImageRenderingIntent(self)
[docs] def Export(self, args): r""" Overload 1: Saves this image to a file. The output image format (TIFF, JPEG, or PNG) will be automatically selected based on the properties of the embedded image. For example, if the embedded image is using CCITT Fax compression, the output format will be TIFF. Similarly, if the embedded image is using JPEG compression the output format will be JPEG. If your application needs to explicitly control output image format you may want to use ExportAsTiff() or ExportAsPng(). :type filename: string :param filename: string that specifies the path name for the saved image. The filename should not include the extension which will be appended to the filename string based on the output format. :rtype: int :return: the number indicating the selected image format: (0 - PNG, 1 - TIF, 2 - JPEG). | Overload 2: Saves this image to the output stream. (0 - PNG, 1 - TIF, 2 - JPEG). :type writer: :py:class:`FilterWriter` :param writer: A pointer to FilterWriter used to write to the output stream. If the parameter is null, nothing will be written to the output stream, but the function returns the format identifier. :rtype: int :return: the number indicating the selected image format: Notes: see the overloaded Image::Export method for more information. """ return _PDFNetPython.Image_Export(self, args)
[docs] def ExportAsTiff(self, args): r""" Overload 1: Saves this image to a TIFF file. :type filename: string :param filename: string that specifies the path name for the saved image. The filename should include the file extension | Overload 2: Saves this image to a TIFF output stream. :type writer: :py:class:`FilterWriter` :param writer: FilterWriter used to write to the output stream. """ return _PDFNetPython.Image_ExportAsTiff(self, args)
[docs] def ExportAsPng(self, args): r""" Overload 1: Saves this image to a PNG file. :type filename: string :param filename: string that specifies the path name for the saved image. The filename should include the file extension | Overload 2: Saves this image to a PNG output stream. :type writer: :py:class:`FilterWriter` :param writer: FilterWriter used to write to the output stream. """ return _PDFNetPython.Image_ExportAsPng(self, args)
def __init__(self, args): _PDFNetPython.Image_swiginit(self, _PDFNetPython.new_Image(args)) mp_image = property(_PDFNetPython.Image_mp_image_get, _PDFNetPython.Image_mp_image_set) __swig_destroy__ = _PDFNetPython.delete_Image
# Register Image in _PDFNetPython: _PDFNetPython.Image_swigregister(Image)
[docs] def Image_CreateImageMask(args): r""" Overload 1: Create and embed an Image from any GDI+ Bitmap taking into account specified compression hints. Notes: see Image::Create for details. This method is available only on Windows platforms. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). :param bmp: - GDI+ bitmap. :rtype: :py:class:`Image` :return: PDF::Image object representing the embedded image. Create and embed an ImageMask. Embed the raw image data taking into account specified compression hints. The ImageMask can be used as a stencil mask for painting in the current color or as an explicit mask specifying which areas of the image to paint and which to mask out. One of the most important uses of stencil masking is for painting character glyphs represented as bitmaps. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). :type buf: string :param buf: - The stream or buffer containing image data stored in 1 bit per sample format. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details). :type width: int :param width: - The width of the image, in samples. :type height: int :param height: - The height of the image, in samples. :type encoder_hints: :py:class:`Obj` :param encoder_hints: - An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image::Create() for details. :rtype: :py:class:`Image` :return: PDF::Image object representing the embedded ImageMask. | Overload 2: Create and embed an ImageMask. Notes: see Image::CreateImageMask for details. | Overload 3: Create and embed an ImageMask. Notes: see Image::CreateImageMask for details. """ return _PDFNetPython.Image_CreateImageMask(args)
[docs] def Image_CreateSoftMask(args): r""" Overload 1: Create and embed a Soft Mask. Embed the raw image data taking into account specified compression hints. A soft-mask image (see "Soft-Mask Images" in PDF Reference Manual) is used as a source of mask shape or mask opacity values in the transparent imaging model. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). :type buf: string :param buf: - The stream or buffer containing image data represented in DeviceGray color space (i.e. one component per sample). The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details). :type width: int :param width: - The width of the image, in samples. :type height: int :param height: - The height of the image, in samples. :type bpc: int :param bpc: - The number of bits used to represent each color component. :type encoder_hints: :py:class:`Obj` :param encoder_hints: - An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image::Create() for details. Notes: this feature is available only in PDF 1.4 and higher. | Overload 2: Create and embed a Soft Mask. Embed the raw image data taking into account specified compression hints. Notes: see Image::CreateSoftMask for details. | Overload 3: Create and embed a Soft Mask. Embed the raw image data taking into account specified compression hints. Notes: see Image::CreateSoftMask for details. """ return _PDFNetPython.Image_CreateSoftMask(args)
[docs] def Image_Create(args): r""" Overload 1: Create and embed an Image from an external file taking into account specified compression hints. By default the function will either pass-through data preserving the original compression or will compress data using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. To obtain SDF::Doc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc(). :type filename: string :param filename: - The name of the image file. Currently supported formats are JPEG, PNG, GIF, TIFF, BMP, EMF, and WMF. Other raster formats can be embedded by decompressing image data and using other versions of Image::Create(...) method. :type encoder_hints: :py:class:`Obj` :param encoder_hints: - An optional SDF::Obj containing a hint (or an SDF::Array of hints) that could be used to select a specific compression method and compression parameters. For a concrete example of how to create encoder hints, please take a look at JBIG2Test and AddImage sample projects. The image encoder accepts the following hints: - /JBIG2; SDF::Name("JBIG2"), An SDF::Name Object with value equal to "JBIG2". If the image is monochrome (i.e. bpc == 1), the encoder will compress the image using JBIG2Decode filter. Note that JBIG2 compression is not recommended for use on scanned text/financial documents or equivalent since its lossless nature can lead to similar looking numbers or characters being replaced. - [/JBIG2 /Threshold 0.6 /SharePages 50] - Compress a monochrome image using lossy JBIG2Decode compression with the given image threshold and by sharing segments from a specified number of pages. The threshold is a doubleing point number in the range from 0.4 to 0.9. Increasing the threshold value will increase image quality, but may increase the file size. The default value for threshold is 0.85. "SharePages" parameter can be used to specify the maximum number of pages sharing a common 'JBIG2Globals' segment stream. Increasing the value of this parameter improves compression ratio at the expense of memory usage. - [/CCITT] - Compress a monochrome (i.e. bpc == 1) image using CCITT Group 4 compression. This algorithm typically produces larger output than JBIG2, but is lossless. This makes it much more suitable for scanned text documents. CCITT is the best option for more general monochrome compression use cases, since JBIG2 has potential to change image content. - [/JPEG] - Use JPEG compression with default compression. - [/JPEG /Quality 60] - Use JPEG compression with given quality setting. The "Quality" value is expressed on the 0..100 scale. - [/JPEG2000] - Use JPEG2000 compression to compress a RGB or a grayscale image.<para> - [/JP2] - Use JPEG2000 compression with JP2 encoding. JP2 does not support CMYK images.<para> - [/Flate] - Use Flate compression with maximum compression at the expense of speed. - [/Flate /Level 9] - Use Flate compression using specified compression level. Compression "Level" must be a number between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). - /RAW or [/RAW] - The encoder will not use any compression method and the image will be stored in the raw format. :rtype: :py:class:`Image` :return: PDF::Image object representing the embedded image. Notes: For C++ developers: Current document does not take the ownership of the encoder_hints object. Therefore it is a good programming practice to create encoder_hints object on the stack. | Overload 2: Create and embed an Image. Embed the raw image data taking into account specified compression hints. By default the function will compress all images using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). :type buf: unsigned char :param buf: - The stream or buffer containing image data. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details). :type width: int :param width: - The width of the image, in samples. :type height: int :param height: - The height of the image, in samples. :type bpc: int :param bpc: - The number of bits used to represent each color component. :type color_space: :py:class:`ColorSpace` :param color_space: - The color space in which image samples are represented. :type encoder_hints: :py:class:`Obj` :param encoder_hints: - An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image::Create() for details. :rtype: :py:class:`Image` :return: PDF::Image object representing the embedded image. | Overload 3: Create and embed an Image. Embed the raw image data taking into account specified compression hints. By default the function will compress all images using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). :type buf: unsigned char :param buf: - The stream or buffer containing image data. The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details). :type width: int :param width: - The width of the image, in samples. :type height: int :param height: - The height of the image, in samples. :type bpc: int :param bpc: - The number of bits used to represent each color component. :type color_space: :py:class:`ColorSpace` :param color_space: - The color space in which image samples are represented. :param encoder_hints: - An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image::Create() for details. :rtype: :py:class:`Image` :return: PDF::Image object representing the embedded image. | Overload 4: Create and embed an Image. Embed the raw image data taking into account specified compression hints. Notes: see Image::Create for details. | Overload 5: Create and embed an Image. Embed the raw image data taking into account specified compression hints. Notes: see Image::Create for details. | Overload 6: Create and embed an Image. Embed the raw image data taking into account specified compression hints. Notes: see Image::Create for details. | Overload 7: Create and embed an Image. Embed the raw image data taking into account specified compression hints. Notes: see Image::Create for details. | Overload 8: Create and embed an Image. Embed the raw image data taking into account specified compression hints. Notes: see Image::Create for details. PDFNet takes ownership of the filter | Overload 9: Create and embed an Image. Embed the raw image data taking into account specified compression hints. Notes: see Image::Create for details. PDFNet takes ownership of the filter | Overload 10: Directly embed the image that is already compressed using the Image::InputFilter format. The function can be used to pass-through pre-compressed image data. :type doc: :py:class:`SDFDoc` :param doc: - A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). :type buf: string :param buf: - The stream or buffer containing compressed image data. The compression format must match the input_format parameter. :type width: int :param width: - The width of the image, in samples. :type height: int :param height: - The height of the image, in samples. :type bpc: int :param bpc: - The number of bits used to represent each color component. :type color_space: :py:class:`ColorSpace` :param color_space: - The color space in which image samples are specified. :type input_format: int :param input_format: - Image::InputFilter describing the format of pre-compressed image data. :rtype: :py:class:`Image` :return: PDF::Image object representing the embedded image. | Overload 11: Embed the raw image data taking into account specified compression hints. Notes: see the above method for details. """ return _PDFNetPython.Image_Create(args)
[docs] class PageLabel(object): r""" PDF page labels can be used to describe a page. This is used to allow for non-sequential page numbering or the addition of arbitrary labels for a page (such as the inclusion of Roman numerals at the beginning of a book). PDFNet PageLabel object can be used to specify the numbering style to use (for example, upper- or lower-case Roman, decimal, and so forth), the starting number for the first page, and an arbitrary prefix to be pre-appended to each number (for example, "A-" to generate "A-1", "A-2", "A-3", and so forth.) PageLabel corresponds to the PDF Page Label object (Section 8.3.1, 'Page Labels' in the PDF Reference Manual. Each page in a PDF document is identified by an integer page index that expresses the page's relative position within the document. In addition, a document may optionally define page labels to identify each page visually on the screen or in print. Page labels and page indices need not coincide: the indices are fixed, running consecutively through the document starting from 1 for the first page, but the labels can be specified in any way that is appropriate for the particular document. For example, if the document begins with 12 pages of front matter numbered in roman numerals and the remainder of the document is numbered in Arabic, the first page would have a page index of 1 and a page label of i, the twelfth page would have index 12 and label xii, and the thirteenth page would have index 13 and label 1. For purposes of page labeling, a document can be divided into labeling ranges, each of which is a series of consecutive pages using the same numbering system. Pages within a range are numbered sequentially in ascending order. A page's label consists of a numeric portion based on its position within its labeling range, optionally preceded by a label prefix denoting the range itself. For example, the pages in an appendix might be labeled with decimal numeric portions prefixed with the string "A-" and the resulting page labels would be "A-1", "A-2", Notes: There is no default numbering style; if no 'S' (Style) entry is present, page labels consist solely of a label prefix with no numeric portion. For example, if the 'P' entry (Prefix) specifies the label prefix "Appendix", each page is simply labeled "Appendix" with no page number. If the 'P' entry is also missing or empty, the page label is an empty string. Sample code (See PableLabelsTest sample project for examples): .. code-block:: c++ // Create a page labeling scheme that starts with the first page in // the document (page 1) and is using uppercase roman numbering // style. doc.SetPageLabel(1, PageLabel::Create(doc, PageLabel::e_roman_uppercase, "My Prefix ", 1)); // Create a page labeling scheme that starts with the fourth page in // the document and is using decimal Arabic numbering style. // Also the numeric portion of the first label should start with number // 4 (otherwise the first label would be "My Prefix 1"). PageLabel L2 = PageLabel::Create(doc, PageLabel::e_decimal, "My Prefix ", 4); doc.SetPageLabel(4, L2); // Create a page labeling scheme that starts with the seventh page in // the document and is using alphabetic numbering style. The numeric // portion of the first label should start with number 1. PageLabel L3 = PageLabel::Create(doc, PageLabel::e_alphabetic_uppercase, "My Prefix ", 1); doc.SetPageLabel(7, L3); // Read page labels from an existing PDF document. PageLabel label; for (int i=1; i=doc.GetPageCount(); ++i) { label = doc.GetPageLabel(i); if (label.IsValid()) { UString title = label.GetLabelTitle(i); } """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_decimal = _PDFNetPython.PageLabel_e_decimal r""" Decimal Arabic numerals""" e_roman_uppercase = _PDFNetPython.PageLabel_e_roman_uppercase r""" Uppercase Roman numerals""" e_roman_lowercase = _PDFNetPython.PageLabel_e_roman_lowercase r""" Lowercase Roman numerals""" e_alphabetic_uppercase = _PDFNetPython.PageLabel_e_alphabetic_uppercase r""" Uppercase letters (A to Z for the first 26 pages, AA to ZZ for the next 26, and so on)""" e_alphabetic_lowercase = _PDFNetPython.PageLabel_e_alphabetic_lowercase r""" Lowercase letters (a to z for the first 26 pages, aa to zz for the next 26, and so on)""" e_none = _PDFNetPython.PageLabel_e_none r""" No numeric portion in the label"""
[docs] @staticmethod def Create(args): r""" Creates a new PageLabel. :type doc: :py:class:`SDFDoc` :param doc: A document to which the page label is added. :type style: int :param style: The numbering style for the label. :type prefix: string :param prefix: The string used to prefix the numeric portion of the page label. :type start_at: int :param start_at: the value to use when generating the numeric portion of the first label in this range; must be greater than or equal to 1. :rtype: :py:class:`PageLabel` :return: newly created PageLabel object. """ return _PDFNetPython.PageLabel_Create(args)
def __eq__(self, d): r""" Compares two PageLabel-s for equality. The comparison will return true only if both labels share the same underlying SDF/Cos object. Two labels are also equivalent if they have the same style, starting number (numeric value of the first page associated with the label), and prefix strings which are the same byte-for-byte. """ return _PDFNetPython.PageLabel___eq__(self, d)
[docs] def IsValid(self): r""" :rtype: boolean :return: whether this is a valid (non-null) PageLabel. If the function returns false the underlying SDF/Cos object is null or is not valid and the PageLabel object should be treated as null as well. """ return _PDFNetPython.PageLabel_IsValid(self)
[docs] def GetLabelTitle(self, page_num): r""" :rtype: string :return: the full label title that is in effect for the given page. If there is no label object in effect, this method returns an empty string. """ return _PDFNetPython.PageLabel_GetLabelTitle(self, page_num)
[docs] def SetStyle(self, style): r""" Sets the numbering style for the label. :type style: int :param style: the numbering style for the label. You may use label style to customize the page numbering schemes used throughout a document. There are three numbering formats: - decimal (often used for normal page ranges) - roman (often used for front matter such as a preface) - alphabetic (often used for back matter such as appendices) Notes: There is no default numbering style; if no 'S' (Style) entry is present, page labels consist solely of a label prefix with no numeric portion. """ return _PDFNetPython.PageLabel_SetStyle(self, style)
[docs] def GetStyle(self): r""" :rtype: int :return: page numbering style. """ return _PDFNetPython.PageLabel_GetStyle(self)
[docs] def GetPrefix(self): r""" :rtype: string :return: the string used to prefix the numeric portion of the page label """ return _PDFNetPython.PageLabel_GetPrefix(self)
[docs] def SetPrefix(self, prefix): r""" :type prefix: string :param prefix: the string used to prefix the numeric portion of the page label. """ return _PDFNetPython.PageLabel_SetPrefix(self, prefix)
[docs] def GetStart(self): r""" :rtype: int :return: the value to use when generating the numeric portion of the first label in this range; must be greater than or equal to 1. """ return _PDFNetPython.PageLabel_GetStart(self)
[docs] def SetStart(self, start_at): r""" :type start_at: int :param start_at: the value to use when generating the numeric portion of the first label in this range; must be greater than or equal to 1. """ return _PDFNetPython.PageLabel_SetStart(self, start_at)
[docs] def GetFirstPageNum(self): r""" :rtype: int :return: the first page in the range associated with this label or -1 if the label is not associated with any page. """ return _PDFNetPython.PageLabel_GetFirstPageNum(self)
[docs] def GetLastPageNum(self): r""" :rtype: int :return: the last page in the range associated with this label or -1 if the label is not associated with any page. """ return _PDFNetPython.PageLabel_GetLastPageNum(self)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: The pointer to the underlying SDF/Cos object. """ return _PDFNetPython.PageLabel_GetSDFObj(self)
def __init__(self, args): _PDFNetPython.PageLabel_swiginit(self, _PDFNetPython.new_PageLabel(args)) __swig_destroy__ = _PDFNetPython.delete_PageLabel
# Register PageLabel in _PDFNetPython: _PDFNetPython.PageLabel_swigregister(PageLabel)
[docs] def PageLabel_Create(args): r""" Creates a new PageLabel. :type doc: :py:class:`SDFDoc` :param doc: A document to which the page label is added. :type style: int :param style: The numbering style for the label. :type prefix: string :param prefix: The string used to prefix the numeric portion of the page label. :type start_at: int :param start_at: the value to use when generating the numeric portion of the first label in this range; must be greater than or equal to 1. :rtype: :py:class:`PageLabel` :return: newly created PageLabel object. """ return _PDFNetPython.PageLabel_Create(args)
e_downloadedtype_page = _PDFNetPython.e_downloadedtype_page r""" A new page has been downloaded.""" e_downloadedtype_thumb = _PDFNetPython.e_downloadedtype_thumb r""" A thumbnail has been downloaded.""" e_downloadedtype_named_dests = _PDFNetPython.e_downloadedtype_named_dests r""" The named destinations have been downloaded. These may be necessary for link activation.""" e_downloadedtype_outline = _PDFNetPython.e_downloadedtype_outline r""" The document outline (bookmarks) has been downloaded.""" e_downloadedtype_finished = _PDFNetPython.e_downloadedtype_finished r""" The entire document has been downloaded.""" e_downloadedtype_failed = _PDFNetPython.e_downloadedtype_failed r""" An error has occurred while downloading and downloading has stopped.""" e_downloadedtype_opened = _PDFNetPython.e_downloadedtype_opened r""" The initial document information is available and it is now ok to query for document information."""
[docs] class Separation(object): r""" This class is used to store separations in PDFRasterize and PDFDraw""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_Separation def __init__(self, args): _PDFNetPython.Separation_swiginit(self, _PDFNetPython.new_Separation(args))
[docs] def C(self): return _PDFNetPython.Separation_C(self)
[docs] def M(self): return _PDFNetPython.Separation_M(self)
[docs] def Y(self): return _PDFNetPython.Separation_Y(self)
[docs] def K(self): return _PDFNetPython.Separation_K(self)
[docs] def GetDataSize(self): return _PDFNetPython.Separation_GetDataSize(self)
[docs] def GetSeparationName(self): return _PDFNetPython.Separation_GetSeparationName(self)
[docs] def GetData(self): return _PDFNetPython.Separation_GetData(self)
m_separation_name = property(_PDFNetPython.Separation_m_separation_name_get, _PDFNetPython.Separation_m_separation_name_set)
# Register Separation in _PDFNetPython: _PDFNetPython.Separation_swigregister(Separation)
[docs] class PDFRasterizer(object): r""" PDFRasterizer is a low-level PDF rasterizer. The main purpose of this class is to convert PDF pages to raster images (or bitmaps). Notes: PDFRasterizer is a relatively low-level class. If you need to convert PDF page to an image format or a Bitmap, consider using PDF::PDFDraw. Similarly, if you are building an interactive PDF viewing application you may want to use PDF::PDFView instead. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_BuiltIn = _PDFNetPython.PDFRasterizer_e_BuiltIn r""" high-quality, platform independent rasterizer.""" e_GDIPlus = _PDFNetPython.PDFRasterizer_e_GDIPlus r""" GDI+ based rasterizer. (Deprecated)""" e_op_off = _PDFNetPython.PDFRasterizer_e_op_off e_op_on = _PDFNetPython.PDFRasterizer_e_op_on e_op_pdfx_on = _PDFNetPython.PDFRasterizer_e_op_pdfx_on def __init__(self, args): r"""PDFRasterizerructor and destructor""" _PDFNetPython.PDFRasterizer_swiginit(self, _PDFNetPython.new_PDFRasterizer(args)) __swig_destroy__ = _PDFNetPython.delete_PDFRasterizer
[docs] def Rasterize(self, page, width, height, stride, num_comps, demult, device_mtx, clip=None, scrl_clip_regions=None): r""" Draws the page into a given memory buffer. Notes: This method is available on all platforms and in all rasterizer implementations. :type page: :py:class:`Page` :param page: The page to rasterize. :param in_out_image_buffer: A pointer to a memory buffer. The buffer must contain at least (stride height) bytes. :type width: int :param width: The width of the target image in pixels. :type height: int :param height: The height of the target image in pixels (the number of rows). :type stride: int :param stride: Stride determines the physical width (in bytes) of one row in memory. If this value is negative the direction of the Y axis is inverted. The absolute value of stride is of importance, because it allows rendering in buffers where rows are padded in memory (e.g. in Windows bitmaps are padded on 4 byte boundaries). Besides allowing rendering on the whole buffer stride parameter can be used for rendering in a rectangular subset of a buffer. :type num_comps: int :param num_comps: The number (4 or 5) representing the number of color components in the device color space. For BGR+Alpha set this parameter to 4, and for CMYK+Alpha use 5. If other values are set, exceptions will be thrown. :type demult: boolean :param demult: - Specifies if the alpha is de-multiplied from the resulting color components. :type device_mtx: :py:class:`Matrix2D` :param device_mtx: Device transformation matrix that maps PDF page from PDF user space into device coordinate space (e.g. pixel space). PDF user space is represented in page units, where one unit corresponds to 1/72 of an inch. :type clip: :py:class:`Rect` :param clip: Optional parameter defining the clip region for the page. If the parameter is null or is not specified, PDFRasterizer uses page's crop box as a default clip region. :param scrl_clp_regions: Optional parameter reserved for a future use. :param cancel: An optional variable that can be used to stop the rendering thread. Sample code: .. code-block:: c++ double drawing_scale = 2: Common::Matrix2D mtx(drawing_scale, 0, 0, drawing_scale, 0, 0); PDF::Rect bbox(page.GetMediaBox()); bbox.Normalize(); int width = int(bbox.Width() drawing_scale); int height = int(bbox.Height() drawing_scale); // Stride is represented in bytes and is aligned on 4 byte // boundary so that you can render directly to GDI bitmap. // A negative value for stride can be used to flip the image // upside down. int comps = 4; // for BGRA int stride = ((width comps + 3) / 4) 4; // buf is a memory buffer containing at least (strideheight) bytes. memset(ptr, 0xFF, heightstride); // Clear the background to opaque white paper color. PDFRasterizer rast; rast.Rasterize(page, buf, width, height, stride, 4, false, mtx); """ return _PDFNetPython.PDFRasterizer_Rasterize(self, page, width, height, stride, num_comps, demult, device_mtx, clip, scrl_clip_regions)
[docs] def RasterizeSeparations(self, page, width, height, mtx, clip, cancel): r""" Draws the page into a given memory buffer. Notes: This method is available on all platforms and in all rasterizer implementations. :type page: :py:class:`Page` :param page: The page to rasterize. :type width: int :param width: The width of the target image in pixels. :type height: int :param height: The height of the target image in pixels (the number of rows). :type mtx: :py:class:`Matrix2D` :param mtx: Device transformation matrix that maps PDF page from PDF user space into device coordinate space (e.g. pixel space). PDF user space is represented in page units, where one unit corresponds to 1/72 of an inch. :type clip: :py:class:`Rect` :param clip: Optional parameter defining the clip region for the page. If the parameter is null or is not specified, PDFRasterizer uses page's crop box as a default clip region. :type cancel: boolean :param cancel: An optional variable that can be used to stop the rendering thread. """ return _PDFNetPython.PDFRasterizer_RasterizeSeparations(self, page, width, height, mtx, clip, cancel)
[docs] def SetDrawAnnotations(self, render_annots): r""" Enable or disable annotation and forms rendering. By default, annotations and forms are rendered. :type render_annots: boolean :param render_annots: True to draw annotations, false otherwise. """ return _PDFNetPython.PDFRasterizer_SetDrawAnnotations(self, render_annots)
[docs] def SetHighlightFields(self, highlight_fields): r""" Enable or disable highlighting form fields. Default is disabled. :type highlight_fields: boolean :param highlight_fields: true to highlight, false otherwise. """ return _PDFNetPython.PDFRasterizer_SetHighlightFields(self, highlight_fields)
[docs] def SetDrawUIElements(self, draw_ui_elements): r""" Enable or disable drawing ui elements. Default is disabled. :type draw_ui_elements: boolean :param draw_ui_elements: true to draw ui elements, false otherwise. """ return _PDFNetPython.PDFRasterizer_SetDrawUIElements(self, draw_ui_elements)
[docs] def SetAntiAliasing(self, enable_aa): r""" Enable or disable anti-aliasing. Anti-Aliasing is a technique used to improve the visual quality of images when displaying them on low resolution devices (for example, low DPI computer monitors). Anti-aliasing is enabled by default. """ return _PDFNetPython.PDFRasterizer_SetAntiAliasing(self, enable_aa)
[docs] def SetPathHinting(self, enable_hinting): r""" Enable or disable path hinting. :type enable_hinting: boolean :param enable_hinting: if true path hinting is enabled. Path hinting is used to slightly adjust paths in order to avoid or alleviate artifacts of hair line cracks between certain graphical elements. This option is turned on by default. """ return _PDFNetPython.PDFRasterizer_SetPathHinting(self, enable_hinting)
[docs] def SetThinLineAdjustment(self, pixel_grid_fit, stroke_adjust): r""" Set thin line adjustment parameters. :type pixel_grid_fit: boolean :param pixel_grid_fit: if true (horizontal/vertical) thin lines will be snapped to integer pixel positions. This helps make thin lines look sharper and clearer. This option is turned off by default and it only works if path hinting is enabled. :type stroke_adjust: boolean :param stroke_adjust: if true auto stroke adjustment is enabled. Currently, this would make lines with sub-pixel width to be one-pixel wide. This option is turned on by default. """ return _PDFNetPython.PDFRasterizer_SetThinLineAdjustment(self, pixel_grid_fit, stroke_adjust)
[docs] def SetThinLineScaling(self, scaling): r""" This setting controls the thickness of zero-width lines when rendered. In a PDF, a line width of zero denotes the thinnest line that can be rendered at device resolution: 1 device pixel wide. However, on high-resolution devices, a single pixel can be nearly invisible. :type scaling: double :param scaling: use this setting to increase the apparent thickness of these zero-width lines. 1.0 (1 pixel wide) """ return _PDFNetPython.PDFRasterizer_SetThinLineScaling(self, scaling)
[docs] def SetNightModeTuning(self, contrast, saturation, flipness): r""" This setting controls the contrast, saturation and flipness of a rendered PDF when night mode is set. By default no additional tuning is done. :type contrast: double :param contrast: change the difference in luminance or color that makes an object distinguishable from other objects. :type saturation: double :param saturation: change the color intensity. :type flipness: double :param flipness: controls the inversion of colors when rendered. Notes: values range from 0.0 to 1.0 """ return _PDFNetPython.PDFRasterizer_SetNightModeTuning(self, contrast, saturation, flipness)
[docs] def SetImageSmoothing(self, smoothing_enabled=True, hq_image_resampling=False): r""" Enable or disable image smoothing. The rasterizer allows a tradeoff between rendering quality and rendering speed. This function can be used to indicate the preference between rendering speed and quality. Notes: image smoothing option has effect only if the source image has higher resolution that the output resolution of the image on the rasterized page. PDFNet automatically controls at what resolution/zoom factor, 'image smoothing' needs to take effect. :type smoothing_enabled: boolean :param smoothing_enabled: True to enable image smoothing, false otherwise. :type hq_image_resampling: boolean :param hq_image_resampling: True to use a higher quality (but slower) smoothing algorithm image smoothing is enabled and hq_image_resampling is false. """ return _PDFNetPython.PDFRasterizer_SetImageSmoothing(self, smoothing_enabled, hq_image_resampling)
[docs] def SetCaching(self, enabled=True): r""" Enables or disables caching. Caching can improve the rendering performance in cases where the same page will be drawn multiple times. :type enabled: boolean :param enabled: - if true PDFRasterizer will cache frequently used graphics objects. """ return _PDFNetPython.PDFRasterizer_SetCaching(self, enabled)
[docs] def SetGamma(self, expgamma): r""" Sets the gamma factor used for anti-aliased rendering. :type expgamma: double :param expgamma: is the exponent value of gamma function. Typical values are in the range from 0.1 to 3. Gamma correction can be used to improve the quality of anti-aliased image output and can (to some extent) decrease the appearance common anti-aliasing artifacts (such as pixel width lines between polygons). Notes: Gamma correction is used only in the built-in rasterizer. """ return _PDFNetPython.PDFRasterizer_SetGamma(self, expgamma)
[docs] def SetOCGContext(self, ctx): r""" Sets the Optional Content Group (OCG) context that should be used when rendering the page. This function can be used to selectively render optional content (such as PDF layers) based on the states of optional content groups in the given context. :type ctx: :py:class:`Context` :param ctx: Optional Content Group (OCG) context, or NULL if the rasterizer should render all content on the page. """ return _PDFNetPython.PDFRasterizer_SetOCGContext(self, ctx)
[docs] def SetPrintMode(self, is_printing): r""" Tells the rasterizer to render the page 'print' mode. Certain page elements (such as annotations or OCG-s) are meant to be visible either on the screen or on the printed paper but not both. A common example, is the "Submit" button on electronic forms. :type is_printing: boolean :param is_printing: set to true is the page should be rendered in print mode. By default, print mode flag is set to false. """ return _PDFNetPython.PDFRasterizer_SetPrintMode(self, is_printing)
[docs] def SetOverprint(self, op): r""" Enable or disable support for overprint and overprint simulation. Overprint is a device dependent feature and the results will vary depending on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc). By default overprint is only enabled for PDF/X files. :type op: int :param op: e_op_on: always enabled; e_op_off: always disabled; e_op_pdfx_on: enabled for PDF/X files only. """ return _PDFNetPython.PDFRasterizer_SetOverprint(self, op)
[docs] def SetErrorReportProc(self, instance): r""" Sets the error handling function to be called in case an error is encountered during page rendering. :param error_proc: Error handling callback function (or delegate in .NET) :param data: Custom data to be passed as a second parameter to 'error_proc'. """ return _PDFNetPython.PDFRasterizer_SetErrorReportProc(self, instance)
[docs] def SetRasterizerType(self, type): r""" Sets the core graphics library used for rasterization and rendering. Using this method it is possible to quickly switch between different implementations. By default, PDFNet uses a built-in, high-quality, and platform independent rasterizer. :type type: int :param type: Rasterizer type. Notes: This method is deprecated, since the GDI+ rasterizer itself is deprecated and will be removed in a future version of PDFNet. It is strongly recommended to use the built-in rasterizer and to use the XPS print path where vector conversion is needed. """ return _PDFNetPython.PDFRasterizer_SetRasterizerType(self, type)
[docs] def GetRasterizerType(self): r""" :rtype: int :return: the type of current rasterizer. Notes: This method is deprecated, since the GDI+ rasterizer itself is deprecated and will be removed in a future version of PDFNet. It is strongly recommended to use the built-in rasterizer and to use the XPS print path where vector conversion is needed. """ return _PDFNetPython.PDFRasterizer_GetRasterizerType(self)
e_postprocess_none = _PDFNetPython.PDFRasterizer_e_postprocess_none e_postprocess_invert = _PDFNetPython.PDFRasterizer_e_postprocess_invert e_postprocess_gradient_map = _PDFNetPython.PDFRasterizer_e_postprocess_gradient_map e_postprocess_night_mode = _PDFNetPython.PDFRasterizer_e_postprocess_night_mode
[docs] def SetColorPostProcessMode(self, mode): r""" Set the color post processing transformation. This transform is applied to the rasterized bitmap as the final step in the rasterization process, and is applied directly to the resulting bitmap (disregarding any color space information). Color post processing only supported for RGBA output. :type mode: int :param mode: is the specific transform to be applied """ return _PDFNetPython.PDFRasterizer_SetColorPostProcessMode(self, mode)
[docs] def GetColorPostProcessMode(self): r""" :rtype: int :return: the current color post processing mode. """ return _PDFNetPython.PDFRasterizer_GetColorPostProcessMode(self)
[docs] def UpdateBuffer(self): r""" This function is typically called for progressive rendering, in which we don't want to stop the main rendering thread. Since the rendering thread may modify separation channels, we don't consider separations in progressive rendering. """ return _PDFNetPython.PDFRasterizer_UpdateBuffer(self)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.PDFRasterizer_Destroy(self)
mp_rast = property(_PDFNetPython.PDFRasterizer_mp_rast_get, _PDFNetPython.PDFRasterizer_mp_rast_set)
# Register PDFRasterizer in _PDFNetPython: _PDFNetPython.PDFRasterizer_swigregister(PDFRasterizer)
[docs] class ViewerOptimizedOptions(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): _PDFNetPython.ViewerOptimizedOptions_swiginit(self, _PDFNetPython.new_ViewerOptimizedOptions())
[docs] def SetThumbnailRenderingThreshold(self, threshold): r""" For any pages that are not forced to include thumbnails this function adjusts whether we should include them depending on the complexity of the page. This can be used to include fewer or more thumbnails as required by the use case. In particular reducing this value will tend to increase the number of page thumbnails included and vice versa. :type threshold: int :param threshold: A number from 0 (include all thumbnails) to 100 (include only the first thumbnail) representing the complexity at which SaveViewerOptimized would include the thumbnail. The default value is 50. """ return _PDFNetPython.ViewerOptimizedOptions_SetThumbnailRenderingThreshold(self, threshold)
[docs] def SetMinimumInitialThumbnails(self, initial_thumbs): r""" Set the number of pages starting from the first for which to guarantee thumbnails regardless of page complexity. This can help improve the viewing experience on the first few pages without increasing the file size dramatically. If this number is greater than the number of pages in the document all of the pages will have thumbnails. :type initial_thumbs: int :param initial_thumbs: The number of pages starting with the first which are guaranteed to have thumbnails. The default value is 1, which means only the first page is guaranteed to have a thumbnail. """ return _PDFNetPython.ViewerOptimizedOptions_SetMinimumInitialThumbnails(self, initial_thumbs)
[docs] def SetThumbnailSize(self, size): r""" The maximum allowed length for the thumbnail's height/width. The default thumbnail size is 1024. :type size: int :param size: the maximum dimension (width or height) that thumbnails will have. """ return _PDFNetPython.ViewerOptimizedOptions_SetThumbnailSize(self, size)
[docs] def SetOverprint(self, mode): r""" Enable or disable support for overprint and overprint simulation in generated thumbnails. Overprint is a device dependent feature and the results will vary depending on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc). Default is e_op_pdfx_on. :type mode: int :param mode: e_op_on: always enabled; e_op_off: always disabled; e_op_pdfx_on: enabled for PDF/X files only. """ return _PDFNetPython.ViewerOptimizedOptions_SetOverprint(self, mode)
m_obj = property(_PDFNetPython.ViewerOptimizedOptions_m_obj_get, _PDFNetPython.ViewerOptimizedOptions_m_obj_set) m_objset = property(_PDFNetPython.ViewerOptimizedOptions_m_objset_get, _PDFNetPython.ViewerOptimizedOptions_m_objset_set) __swig_destroy__ = _PDFNetPython.delete_ViewerOptimizedOptions
# Register ViewerOptimizedOptions in _PDFNetPython: _PDFNetPython.ViewerOptimizedOptions_swigregister(ViewerOptimizedOptions)
[docs] class PDFDocViewPrefs(object): r""" PDFDocViewPrefs is a high-level utility class that can be used to control the way the document is to be presented on the screen or in print. PDFDocViewPrefs class corresponds to PageMode, PageLayout, and ViewerPreferences entries in the document's catalog. For more details please refer to section 8.1 'Viewer Preferences' in PDF Reference Manual. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def SetInitialPage(self, dest): r""" A utility method used to set the fist page displayed after the document is opened. This method is equivalent to PDFDoc::SetOpenAction(goto_action). If OpenAction is not specified the document should be opened to the top of the first page at the default magnification factor. :type dest: :py:class:`Destination` :param dest: A value specifying the page destination to be displayed when the document is opened. Example: .. code-block:: c++ Destination dest = Destination::CreateFit(page); pdfdoc.GetViewPrefs().SetInitialPage(dest); """ return _PDFNetPython.PDFDocViewPrefs_SetInitialPage(self, dest)
e_UseNone = _PDFNetPython.PDFDocViewPrefs_e_UseNone e_UseThumbs = _PDFNetPython.PDFDocViewPrefs_e_UseThumbs e_UseBookmarks = _PDFNetPython.PDFDocViewPrefs_e_UseBookmarks e_FullScreen = _PDFNetPython.PDFDocViewPrefs_e_FullScreen e_UseOC = _PDFNetPython.PDFDocViewPrefs_e_UseOC e_UseAttachments = _PDFNetPython.PDFDocViewPrefs_e_UseAttachments
[docs] def SetPageMode(self, mode): r""" Sets PageMode property and change the value of the PageMode key in the Catalog dictionary. :type mode: int :param mode: New PageMode setting. Default value is e_UseNone. """ return _PDFNetPython.PDFDocViewPrefs_SetPageMode(self, mode)
[docs] def GetPageMode(self): r""" :rtype: int :return: The value of currently selected PageMode property. """ return _PDFNetPython.PDFDocViewPrefs_GetPageMode(self)
e_Default = _PDFNetPython.PDFDocViewPrefs_e_Default e_SinglePage = _PDFNetPython.PDFDocViewPrefs_e_SinglePage e_OneColumn = _PDFNetPython.PDFDocViewPrefs_e_OneColumn e_TwoColumnLeft = _PDFNetPython.PDFDocViewPrefs_e_TwoColumnLeft e_TwoColumnRight = _PDFNetPython.PDFDocViewPrefs_e_TwoColumnRight e_TwoPageLeft = _PDFNetPython.PDFDocViewPrefs_e_TwoPageLeft e_TwoPageRight = _PDFNetPython.PDFDocViewPrefs_e_TwoPageRight
[docs] def SetLayoutMode(self, layout): r""" Sets PageLayout property and change the value of the PageLayout key in the Catalog dictionary. :param mode: New PageLayout setting. Default value is e_SinglePage. """ return _PDFNetPython.PDFDocViewPrefs_SetLayoutMode(self, layout)
[docs] def GetLayoutMode(self): r""" :rtype: int :return: The value of currently selected PageLayout property. """ return _PDFNetPython.PDFDocViewPrefs_GetLayoutMode(self)
e_HideToolbar = _PDFNetPython.PDFDocViewPrefs_e_HideToolbar e_HideMenubar = _PDFNetPython.PDFDocViewPrefs_e_HideMenubar e_HideWindowUI = _PDFNetPython.PDFDocViewPrefs_e_HideWindowUI e_FitWindow = _PDFNetPython.PDFDocViewPrefs_e_FitWindow e_CenterWindow = _PDFNetPython.PDFDocViewPrefs_e_CenterWindow e_DisplayDocTitle = _PDFNetPython.PDFDocViewPrefs_e_DisplayDocTitle
[docs] def SetPref(self, pref, value): r""" Sets the value of given ViewerPref property. :type pref: int :param pref: the ViewerPref property type to modify. :type value: boolean :param value: The new value for the property. """ return _PDFNetPython.PDFDocViewPrefs_SetPref(self, pref, value)
[docs] def GetPref(self, pref): r""" :rtype: boolean :return: the value of given ViewerPref property. :type pref: int :param pref: the ViewerPref property type to query. """ return _PDFNetPython.PDFDocViewPrefs_GetPref(self, pref)
[docs] def SetNonFullScreenPageMode(self, mode): r""" Set the document's page mode, specifying how to display the document on exiting full-screen mode. :type mode: int :param mode: PageMode used after exiting full-screen mode. Default value: e_UseNone. Notes: This entry is meaningful only if the value of the PageMode is set to e_FullScreen; it is ignored otherwise. """ return _PDFNetPython.PDFDocViewPrefs_SetNonFullScreenPageMode(self, mode)
[docs] def GetNonFullScreenPageMode(self): r""" :rtype: int :return: the PageMode used after exiting full-screen mode. Notes: This entry is meaningful only if the value of the PageMode is set to e_FullScreen; it is ignored otherwise. """ return _PDFNetPython.PDFDocViewPrefs_GetNonFullScreenPageMode(self)
[docs] def SetDirection(self, left_to_right): r""" Sets the predominant reading order for text. This flag has no direct effect on the document's contents or page numbering but can be used to determine the relative positioning of pages when displayed side by side or printed n-up. :type left_to_right: boolean :param left_to_right: - true if the predominant reading order for text is from left to right and false if it is right to left (including vertical writing systems, such as Chinese, Japanese, and Korean). Default value: left_to_right is true. """ return _PDFNetPython.PDFDocViewPrefs_SetDirection(self, left_to_right)
[docs] def GetDirection(self): r""" :rtype: boolean :return: true is the predominant reading order for text is left to right, false otherwise. See SetDirection() for more information. """ return _PDFNetPython.PDFDocViewPrefs_GetDirection(self)
[docs] def SetViewArea(self, box): r""" Sets the page boundary representing the area of a page to be displayed when viewing the document on the screen. :type box: int :param box: page boundary displayed when viewing the document on the screen. By default, PDF viewers will display the crop-box. """ return _PDFNetPython.PDFDocViewPrefs_SetViewArea(self, box)
[docs] def GetViewArea(self): r""" :rtype: int :return: the page boundary representing the area of a page to be displayed when viewing the document on the screen. """ return _PDFNetPython.PDFDocViewPrefs_GetViewArea(self)
[docs] def SetViewClip(self, box): r""" Sets the page boundary to which the contents of a page are to be clipped when viewing the document on the screen. :type box: int :param box: screen clip region. The default value is page crop-box. """ return _PDFNetPython.PDFDocViewPrefs_SetViewClip(self, box)
[docs] def GetViewClip(self): r""" :rtype: int :return: the page boundary to which the contents of a page are to be clipped when viewing the document on the screen. """ return _PDFNetPython.PDFDocViewPrefs_GetViewClip(self)
[docs] def SetPrintArea(self, box): r""" Sets the page boundary representing the area of a page to be rendered when printing the document. :type box: int :param box: printing region. The default value is page crop-box. """ return _PDFNetPython.PDFDocViewPrefs_SetPrintArea(self, box)
[docs] def GetPrintArea(self): r""" :rtype: int :return: the page boundary representing the area of a page to be rendered when printing the document. """ return _PDFNetPython.PDFDocViewPrefs_GetPrintArea(self)
[docs] def SetPrintClip(self, box): r""" Sets the page boundary to which the contents of a page are to be clipped when printing the document. :type box: int :param box: printing clip region. The default value is page crop-box. """ return _PDFNetPython.PDFDocViewPrefs_SetPrintClip(self, box)
[docs] def GetPrintClip(self): r""" :rtype: int :return: the page boundary to which the contents of a page are to be clipped when printing the document. """ return _PDFNetPython.PDFDocViewPrefs_GetPrintClip(self)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: document's SDF/Cos 'ViewerPreferences' dictionary or NULL if the object is not present. """ return _PDFNetPython.PDFDocViewPrefs_GetSDFObj(self)
mp_prefs = property(_PDFNetPython.PDFDocViewPrefs_mp_prefs_get, _PDFNetPython.PDFDocViewPrefs_mp_prefs_set) def __init__(self, args): _PDFNetPython.PDFDocViewPrefs_swiginit(self, _PDFNetPython.new_PDFDocViewPrefs(args)) __swig_destroy__ = _PDFNetPython.delete_PDFDocViewPrefs
# Register PDFDocViewPrefs in _PDFNetPython: _PDFNetPython.PDFDocViewPrefs_swigregister(PDFDocViewPrefs)
[docs] class PDFDocInfo(object): r""" PDFDocInfo is a high-level utility class that can be used to read and modify document's metadata. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def GetTitle(self): r""" :rtype: string :return: The document's title. """ return _PDFNetPython.PDFDocInfo_GetTitle(self)
[docs] def GetTitleObj(self): r""" :rtype: :py:class:`Obj` :return: SDF/Cos string object representing document's title. """ return _PDFNetPython.PDFDocInfo_GetTitleObj(self)
[docs] def SetTitle(self, title): r""" Set document's title. :type title: string :param title: New title of the document. """ return _PDFNetPython.PDFDocInfo_SetTitle(self, title)
[docs] def GetAuthor(self): r""" :rtype: string :return: The name of the person who created the document. """ return _PDFNetPython.PDFDocInfo_GetAuthor(self)
[docs] def GetAuthorObj(self): r""" :rtype: :py:class:`Obj` :return: SDF/Cos string object representing document's author. """ return _PDFNetPython.PDFDocInfo_GetAuthorObj(self)
[docs] def SetAuthor(self, author): r""" Set the author of the document. :type author: string :param author: The name of the person who created the document. """ return _PDFNetPython.PDFDocInfo_SetAuthor(self, author)
[docs] def GetSubject(self): r""" :rtype: string :return: The subject of the document. """ return _PDFNetPython.PDFDocInfo_GetSubject(self)
[docs] def GetSubjectObj(self): r""" :rtype: :py:class:`Obj` :return: SDF/Cos string object representing document's subject. """ return _PDFNetPython.PDFDocInfo_GetSubjectObj(self)
[docs] def SetSubject(self, subject): r""" Set the subject of the document :type subject: string :param subject: The subject of the document. """ return _PDFNetPython.PDFDocInfo_SetSubject(self, subject)
[docs] def GetKeywords(self): r""" :rtype: string :return: Keywords associated with the document. """ return _PDFNetPython.PDFDocInfo_GetKeywords(self)
[docs] def GetKeywordsObj(self): r""" :rtype: :py:class:`Obj` :return: SDF/Cos string object representing document's keywords. """ return _PDFNetPython.PDFDocInfo_GetKeywordsObj(self)
[docs] def SetKeywords(self, keywords): r""" Set keywords associated with the document. :type keywords: string :param keywords: Keywords associated with the document. """ return _PDFNetPython.PDFDocInfo_SetKeywords(self, keywords)
[docs] def GetCreator(self): r""" :rtype: string :return: If the document was converted to PDF from another format, the name of the application that created the original document from which it was converted. """ return _PDFNetPython.PDFDocInfo_GetCreator(self)
[docs] def GetCreatorObj(self): r""" :rtype: :py:class:`Obj` :return: SDF/Cos string object representing document's creator. """ return _PDFNetPython.PDFDocInfo_GetCreatorObj(self)
[docs] def SetCreator(self, creator): r""" Set document's creator. :type creator: string :param creator: The name of the application that created the original document. """ return _PDFNetPython.PDFDocInfo_SetCreator(self, creator)
[docs] def GetProducer(self): r""" :rtype: string :return: If the document was converted to PDF from another format, the name of the application (for example, Distiller) that converted it to PDF. """ return _PDFNetPython.PDFDocInfo_GetProducer(self)
[docs] def GetProducerObj(self): r""" :rtype: :py:class:`Obj` :return: SDF/Cos string object representing document's producer. """ return _PDFNetPython.PDFDocInfo_GetProducerObj(self)
[docs] def SetProducer(self, producer): r""" Set document's producer. :type producer: string :param producer: The name of the application that generated PDF. """ return _PDFNetPython.PDFDocInfo_SetProducer(self, producer)
[docs] def GetCreationDate(self): r""" :rtype: :py:class:`Date` :return: The date and time the document was created, in human-readable form. """ return _PDFNetPython.PDFDocInfo_GetCreationDate(self)
[docs] def SetCreationDate(self, creation_date): r""" Set document's creation date. :type creation_date: :py:class:`Date` :param creation_date: The date and time the document was created. """ return _PDFNetPython.PDFDocInfo_SetCreationDate(self, creation_date)
[docs] def GetModDate(self): r""" :rtype: :py:class:`Date` :return: The date and time the document was most recently modified, in human-readable form. """ return _PDFNetPython.PDFDocInfo_GetModDate(self)
[docs] def SetModDate(self, mod_date): r""" Set document's modification date. :type mod_date: :py:class:`Date` :param mod_date: The date and time the document was most recently modified. """ return _PDFNetPython.PDFDocInfo_SetModDate(self, mod_date)
[docs] def GetSDFObj(self): r""" :rtype: :py:class:`Obj` :return: document's SDF/Cos 'Info' dictionary or NULL if the info dictionary is not available. """ return _PDFNetPython.PDFDocInfo_GetSDFObj(self)
mp_info = property(_PDFNetPython.PDFDocInfo_mp_info_get, _PDFNetPython.PDFDocInfo_mp_info_set) def __init__(self, args): _PDFNetPython.PDFDocInfo_swiginit(self, _PDFNetPython.new_PDFDocInfo(args)) __swig_destroy__ = _PDFNetPython.delete_PDFDocInfo
# Register PDFDocInfo in _PDFNetPython: _PDFNetPython.PDFDocInfo_swigregister(PDFDocInfo)
[docs] class PDFDoc(object): r""" PDFDoc is a high-level class describing a single PDF (Portable Document Format) document. Most applications using PDFNet will use this class to open existing PDF documents, or to create new PDF documents from scratch. The class offers a number of entry points into the document. For example, - To access pages use pdfdoc.GetPageIterator() or pdfdoc.GetPage(page_num). - To access form fields use pdfdoc.GetFieldIterator(), pdfdoc.GetFieldIterator(name) or pdfdoc.GetField(name). - To access document's meta-data use pdfdoc.GetDocInfo(). - To access the outline tree use pdfdoc.GetFirstBookmark(). - To access low-level Document Catalog use pdfdoc.GetRoot(). ... The class also offers utility methods to slit and merge PDF pages, to create new pages, to flatten forms, to change security settings, etc. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_PDFDoc
[docs] def Close(self): r""" Close PDFDoc""" return _PDFNetPython.PDFDoc_Close(self)
[docs] def IsEncrypted(self): r""" :rtype: boolean :return: true if the document is/was originally encrypted false otherwise. """ return _PDFNetPython.PDFDoc_IsEncrypted(self)
[docs] def InitSecurityHandler(self): r""" Initializes document's SecurityHandler. This version of InitSecurityHandler() works with Standard and Custom PDF security and can be used in situations where the password is obtained dynamically via user feedback. See EncTest sample for example code. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized it can be later obtained using GetSecurityHandler() method. :raises: An exception is thrown if the matching handler for document's security was not found in the global SecurityManager. In this case, you need to register additional custom security handlers with the global SecurityManager (using SecurityManagerSingleton). :rtype: boolean :return: true if the SecurityHandler was successfully initialized (this may include authentication data collection, verification etc.), false otherwise. :param custom_data: An optional parameter used to specify custom data that should be passed in SecurityHandler::Initialize() callback. """ return _PDFNetPython.PDFDoc_InitSecurityHandler(self)
[docs] def InitStdSecurityHandler(self, args): r""" Overload 1: Initializes document's SecurityHandler using the supplied password. This version of InitSecurityHandler() assumes that document uses Standard security and that a password is specified directly. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized, it can be later obtained using GetSecurityHandler() method. :rtype: boolean :return: true if the given password successfully unlocked the document, false otherwise. :raises: An exception is thrown if the document's security Filter is not 'Standard'. In this case, you need to register additional custom security handlers with the global SecurityManager (SecurityManagerSingleton). :type password: string :param password: Specifies the password used to open the document without any user feedback. If you would like to dynamically obtain the password, you need to derive a custom class from StdSecurityHandler() and use InitSecurityHandler() without any parameters. See EncTest sample for example code. :type password_sz: int :param password_sz: An optional parameter used to specify the size of the password buffer, in bytes. If the 'password_sz' is 0, or if the parameter is not specified, the function assumes that the string is null terminated. Remarks: Deprecated. Use versions that accepts UString or buffer instead. | Overload 2: Initializes document's SecurityHandler using the supplied password. This version of InitSecurityHandler() assumes that document uses Standard security and that a password is specified directly. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized, it can be later obtained using GetSecurityHandler() method. :type password: string :param password: Specifies the password used to open the document without any user feedback. If you would like to dynamically obtain the password, you need to derive a custom class from StdSecurityHandler() and use InitSecurityHandler() without any parameters. See EncTest sample for example code. :rtype: boolean :return: true if the given password successfully unlocked the document, false otherwise. :raises: An exception is thrown if the document's security Filter is not 'Standard'. In this case, you need to register additional custom security handlers with the global SecurityManager (SecurityManagerSingleton). | Overload 3: Initializes document's SecurityHandler using the supplied password. This version of InitSecurityHandler() assumes that document uses Standard security and that a password is specified directly. This function should be called immediately after an encrypted document is opened. The function does not have any side effects on documents that are not encrypted. If the security handler was successfully initialized, it can be later obtained using GetSecurityHandler() method. :type password_buf: std::vector< int,std::allocator< int > > :param password_buf: Specifies the password used to open the document without any user feedback. If you would like to dynamically obtain the password, you need to derive a custom class from StdSecurityHandler() and use InitSecurityHandler() without any parameters. See EncTest sample for example code. :rtype: boolean :return: true if the given password successfully unlocked the document, false otherwise. :raises: An exception is thrown if the document's security Filter is not 'Standard'. In this case, you need to register additional custom security handlers with the global SecurityManager (SecurityManagerSingleton). """ return _PDFNetPython.PDFDoc_InitStdSecurityHandler(self, args)
[docs] def GetSecurityHandler(self): r""" :rtype: :py:class:`SecurityHandler` :return: Currently selected SecurityHandler. Notes: InitSecurityHandler() should be called before GetSecurityHandler() in order to initialize the handler. Returned security handler can be modified in order to change the security settings of the existing document. Changes to the current handler will not invalidate the access to the original file and will take effect during document Save(). If the security handler is modified, document will perform a full save even if e_incremental was given as a flag in Save() method. """ return _PDFNetPython.PDFDoc_GetSecurityHandler(self)
[docs] def SetSecurityHandler(self, handler): r""" The function sets a new SecurityHandler as the current security handler. :type handler: :py:class:`SecurityHandler` :param handler: new SecurityHandler Notes: Setting a new security handler will not invalidate the access to the original file and will take effect during document Save(). If the security handler is modified, document will perform a full save even if e_incremental was given as a flag in Save() method. """ return _PDFNetPython.PDFDoc_SetSecurityHandler(self, handler)
[docs] def RemoveSecurity(self): r"""This function removes document security.""" return _PDFNetPython.PDFDoc_RemoveSecurity(self)
[docs] def HasSignatures(self): r""" Indicates whether this documents contains any digital signatures. :rtype: boolean :return: True if a digital signature is found in this PDFDoc. """ return _PDFNetPython.PDFDoc_HasSignatures(self)
[docs] def AddSignatureHandler(self, signature_handler): r""" Adds a signature handler to the signature manager. :type signature_handler: :py:class:`SignatureHandler` :param signature_handler: The signature handler instance to add to the signature manager. :rtype: int :return: A unique ID representing the SignatureHandler within the SignatureManager. """ return _PDFNetPython.PDFDoc_AddSignatureHandler(self, signature_handler)
[docs] def AddStdSignatureHandler(self, args): r""" Overload 1: Adds a standard (built-in) signature handler to the signature manager. This method will use cryptographic algorithm based on Adobe.PPKLite/adbe.pkcs7.detached filter to sign a PDF. :param pkcs12_file: The private key certificate store to use. :param pkcs12_pass: The passphrase for the provided private key. :rtype: int :return: A unique ID representing the SignatureHandler within the SignatureManager. | Overload 2: Adds a standard (built-in) signature handler to the signature manager. This method will use cryptographic algorithm based on Adobe.PPKLite/adbe.pkcs7.detached filter to sign a PDF. :type pkcs12_keybuffer: std::vector< unsigned char,std::allocator< unsigned char > > :param pkcs12_keybuffer: The private key certificate store to use (as a data buffer in an array of bytes). :param pkcs12_pass: The passphrase for the provided private key. :rtype: int :return: A unique ID representing the SignatureHandler within the SignatureManager. """ return _PDFNetPython.PDFDoc_AddStdSignatureHandler(self, args)
[docs] def RemoveSignatureHandler(self, signature_handler_id): r""" Removes a signature handler from the signature manager. :type signature_handler_id: int :param signature_handler_id: The unique id of the signature handler to remove. """ return _PDFNetPython.PDFDoc_RemoveSignatureHandler(self, signature_handler_id)
[docs] def GetSignatureHandler(self, signature_handler_id): r""" Gets the associated signature handler instance from the signature manager by looking it up with the handler name. :type signature_handler_id: int :param signature_handler_id: The unique id of the signature handler to get. :rtype: :py:class:`SignatureHandler` :return: The signature handler instance if found, otherwise NULL. """ return _PDFNetPython.PDFDoc_GetSignatureHandler(self, signature_handler_id)
[docs] def GetUndoManager(self): r""" :rtype: :py:class:`UndoManager` :return: The UndoManager object (one-to-one mapped to document) """ return _PDFNetPython.PDFDoc_GetUndoManager(self)
[docs] def CreateDigitalSignatureField(self, args): r""" Creates an unsigned digital signature form field inside the document. :type in_sig_field_name: string :param in_sig_field_name: The fully-qualified name to give the digital signature field. If one is not provided, a unique name is created automatically. :rtype: :py:class:`DigitalSignatureField` :return: A DigitalSignatureField object representing the created digital signature field. """ return _PDFNetPython.PDFDoc_CreateDigitalSignatureField(self, args)
[docs] def GetDigitalSignatureFieldIterator(self): r""" Retrieves an iterator that iterates over digital signature fields. :rtype: :py:class:`DigitalSignatureFieldIterator` :return: An iterator that iterates over digital signature fields. """ return _PDFNetPython.PDFDoc_GetDigitalSignatureFieldIterator(self)
[docs] def GetDigitalSignaturePermissions(self): r""" Retrieves the most restrictive document permissions locking level from all of the signed digital signatures in the document. :rtype: int :return: An enumerated value representing the most restrictive document permission level found in the document. """ return _PDFNetPython.PDFDoc_GetDigitalSignaturePermissions(self)
[docs] def GetDocInfo(self): r""" :rtype: :py:class:`PDFDocInfo` :return: The class representing document information metadata. (i.e. entries in the document information dictionary). """ return _PDFNetPython.PDFDoc_GetDocInfo(self)
[docs] def GetViewPrefs(self): r""" :rtype: :py:class:`PDFDocViewPrefs` :return: Viewer preferences for this document. PDFDocViewPrefs is a high-level utility class that can be used to control the way the document is to be presented on the screen or in print. """ return _PDFNetPython.PDFDoc_GetViewPrefs(self)
e_action_trigger_doc_will_close = _PDFNetPython.PDFDoc_e_action_trigger_doc_will_close e_action_trigger_doc_will_save = _PDFNetPython.PDFDoc_e_action_trigger_doc_will_save e_action_trigger_doc_did_save = _PDFNetPython.PDFDoc_e_action_trigger_doc_did_save e_action_trigger_doc_will_print = _PDFNetPython.PDFDoc_e_action_trigger_doc_will_print e_action_trigger_doc_did_print = _PDFNetPython.PDFDoc_e_action_trigger_doc_did_print
[docs] def GetTriggerAction(self, trigger): r""" Get the Action associated with the selected Doc Trigger event. :type trigger: int :param trigger: the type of trigger event to get :rtype: :py:class:`Obj` :return: the Action Obj if present, otherwise NULL """ return _PDFNetPython.PDFDoc_GetTriggerAction(self, trigger)
[docs] def IsModified(self): r""" Call this function to determine whether the document has been modified since it was last saved. :rtype: boolean :return: - true if document was modified, false otherwise """ return _PDFNetPython.PDFDoc_IsModified(self)
[docs] def HasRepairedXRef(self): r""" Checks whether or not the underlying file has an XRef table that had to be repaired when the file was opened. If the document had an invalid XRef table when opened, PDFNet will have repaired the XRef table for its working representation of the document. :rtype: boolean :return: - true if document was found to be corrupted, and was repaired, during opening and has not been saved since. Notes: - If this function returns true, it is not possible to incrementally save the document (see http://www.pdftron.com/kb_corrupt_xref) """ return _PDFNetPython.PDFDoc_HasRepairedXRef(self)
[docs] def IsLinearized(self): r""" Call this function to determine whether the document is represented in linearized (fast web view) format. :rtype: boolean :return: - true if document is stored in fast web view format, false otherwise. Notes: any changes to the document can invalidate linearization. The function will return 'true' only if the original document is linearized and if it is not modified. In order to provide good performance over relatively slow communication links, PDFNet can generate PDF documents with linearized objects and hint tables that can allow a PDF viewer application to download and view one page of a PDF file at a time, rather than requiring the entire file (including fonts and images) to be downloaded before any of it can be viewed. To save a document in linearized (fast web view) format you only need to pass 'Doc.SaveOptions.e_linearized' flag in the Save method. """ return _PDFNetPython.PDFDoc_IsLinearized(self)
[docs] def HasDownloader(self): r""" Indicates whether this document was created via the `PDFViewCtrl` method `OpenURLAsync`. :rtype: boolean :return: True if the document was created via the `PDFViewCtrl` method `OpenURLAsync`; False otherwise. """ return _PDFNetPython.PDFDoc_HasDownloader(self)
[docs] def GetDownloadedByteCount(self): r""" Returns the number of bytes that have been downloaded, when `HasDownloader()` is True. :rtype: int :return: The number bytes downloaded. :raises: if 'HasDownloader()` returns False, calling this method will result in an exception. """ return _PDFNetPython.PDFDoc_GetDownloadedByteCount(self)
[docs] def GetTotalRemoteByteCount(self): r""" Returns the document's total size in bytes, when `HasDownloader()` is True. :rtype: int :return: The total number of bytes in the remote document. :raises: if 'HasDownloader()` returns False, calling this method will result in an exception. """ return _PDFNetPython.PDFDoc_GetTotalRemoteByteCount(self)
[docs] def Save(self, args): r""" Overload 1: Saves the document to a file. If a full save is requested to the original path, the file is saved to a file system-determined temporary file, the old file is deleted, and the temporary file is renamed to path. A full save with remove unused or linearization option may re-arrange object in the cross reference table. Therefore all pointers and references to document objects and resources should be re acquired in order to continue document editing. In order to use incremental save the specified path must match original path and e_incremental flag bit should be set. :type path: string :param path: - The full path name to which the file is saved. :type flags: int :param flags: - A bit field composed of an OR of SDFDoc::SaveOptions values. :raises: - if the file can't be opened for saving or if there is a problem during Save an Exception object will be thrown. Notes: - Save will modify the PDFDoc object's internal representation. As such, the user should acquire a write lock before calling save. - If the original pdf has a corrupt xref table (see HasRepairedXref), then it can not be saved using the e_incremental flag. | Overload 2: Saves the document to a stream. :type stream: :py:class:`Filter` :param stream: The output stream where to write data. :type flags: int :param flags: - A bit field composed of an OR of the SDFDoc::SaveOptions values. :raises: - if there is a problem during Save an Exception object will be thrown. Notes: - Save will modify the PDFDoc object's internal representation. As such, the user should acquire a write lock before calling save. - If the original pdf has a corrupt xref table (see HasRepairedXref), then it can not be saved using the e_incremental flag. """ return _PDFNetPython.PDFDoc_Save(self, args)
[docs] def SaveCustomSignature(self, args): r""" Overload 1: Saves a custom signature Contents to a document which has been prepared to receive it. No changes should be made to document in meantime. :type in_signature: std::vector< UChar,std::allocator< UChar > > :param in_signature: The signature Contents to write :type in_field: :py:class:`DigitalSignatureField` :param in_field: The signature field to which to write :type in_path: string :param in_path: The full path name to which the file is saved. :raises: - if there is a problem during Save an Exception object will be thrown. | Overload 2: Saves a custom signature Contents to a document which has been prepared to receive it. No changes should be made to document in meantime. :type in_signature: std::vector< UChar,std::allocator< UChar > > :param in_signature: The signature Contents to write :type in_field: :py:class:`DigitalSignatureField` :param in_field: The signature field to which to write :type out_stream: :py:class:`Filter` :param out_stream: The output stream where to write data. :raises: - if there is a problem during Save an Exception object will be thrown. """ return _PDFNetPython.PDFDoc_SaveCustomSignature(self, args)
[docs] def GetPageIterator(self, page_number=1): r""" Use the Next() method on the returned iterator to traverse all pages in the document. For example: .. code-block:: c++ PageIterator itr = pdfdoc.GetPageIterator(); while (itr.HasNext()) { // Read every page Page page = itr.Current(); // ... itr.Next() } For full sample code, please take a look at ElementReader, PDFPageTest and PDFDraw sample projects. :rtype: :py:class:`PageIterator` :return: an iterator to the first page in the document. :type page_number: int :param page_number: page to set the iterator on. 1 corresponds to the first page. """ return _PDFNetPython.PDFDoc_GetPageIterator(self, page_number)
[docs] def GetPage(self, page_number): r""" :type page_number: int :param page_number: - the page number in document's page sequence. Page numbers in document's page sequence are indexed from 1. :rtype: :py:class:`Page` :return: a Page corresponding to a given page number, or null (invalid page) if the document does not contain the given page number. For example: .. code-block:: c++ Page page = pdfdoc.GetPage(page_num); if (page == null) return; // Page not found """ return _PDFNetPython.PDFDoc_GetPage(self, page_number)
[docs] def PageRemove(self, page_itr): r""" :type page_itr: :py:class:`PageIterator` :param page_itr: - the PageIterator to the page that should be removed A PageIterator for the given page can be obtained using PDFDoc::GetPageIterator(page_num) or using direct iteration through document's page sequence. """ return _PDFNetPython.PDFDoc_PageRemove(self, page_itr)
e_none = _PDFNetPython.PDFDoc_e_none e_insert_bookmark = _PDFNetPython.PDFDoc_e_insert_bookmark e_insert_goto_bookmark = _PDFNetPython.PDFDoc_e_insert_goto_bookmark
[docs] def PageInsert(self, where, page): r""" Insert/Import a single page at a specific location in the page sequence. :type where: :py:class:`PageIterator` :param where: - The location in the page sequence indicating where to insert the page. The page is inserted before the specified location. :type page: :py:class:`Page` :param page: - A page to insert. Notes: Invalidates all PageIterators pointing to the document. """ return _PDFNetPython.PDFDoc_PageInsert(self, where, page)
[docs] def InsertPages(self, args): r""" Overload 1: Inserts a range of pages from specified PDFDoc :type insert_before_page_number: int :param insert_before_page_number: - the destination of the insertion. If less than or equal to 1, the pages are added to the beginning of the document. If larger than the number of pages in the destination document, the pages are appended to the document. :type src_doc: :py:class:`PDFDoc` :param src_doc: - source PDFDoc to insert from :type start_page: int :param start_page: - start of the page number to insert :type end_page: int :param end_page: - end of the page number to insert :type flag: int :param flag: - specifies insert options :param progress: - A pointer to the progress interface. NULL if progress tracking is not required. | Overload 2: Inserts a range of pages from specified PDFDoc using PageSet :type insert_before_page_number: int :param insert_before_page_number: - the destination of the insertion. If less than or equal to 1, the pages are added to the beginning of the document. If larger than the number of pages in the destination document, the pages are appended to the document. :type src_doc: :py:class:`PDFDoc` :param src_doc: - source PDFDoc to insert from :type source_page_set: :py:class:`PageSet` :param source_page_set: - a collection of the page number to insert :type flag: int :param flag: - specifies insert options :param progress: - A pointer to the progress interface. NULL if progress tracking is not required. """ return _PDFNetPython.PDFDoc_InsertPages(self, args)
[docs] def MovePages(self, args): r""" Overload 1: Moves a range of pages from specified PDFDoc. Pages are deleted from source document after move. :type move_before_page_number: int :param move_before_page_number: - the destination of the move. If less than or equal to 1, the pages are moved to the beginning of the document. If larger than the number of pages in the destination document, the pages are moved to the end of the document. :type src_doc: :py:class:`PDFDoc` :param src_doc: - source PDFDoc to move from :type start_page: int :param start_page: - start of the page number to move :type end_page: int :param end_page: - end of the page number to move :type flag: int :param flag: - specifies insert options :param progress: - A pointer to the progress interface. NULL if progress tracking is not required. Notes: MovePages function does not save src_doc. It merely delete pages in memeory. For permanent changes, PDFDoc::Save should be used to save src_doc after function exists. | Overload 2: Moves a range of pages from specified PDFDoc. Pages are deleted from source document after move. :type move_before_page_number: int :param move_before_page_number: - the destination of the move. If less than or equal to 1, the pages are moved to the beginning of the document. If larger than the number of pages in the destination document, the pages are moved to the end of the document. :type src_doc: :py:class:`PDFDoc` :param src_doc: - source PDFDoc to move from :type source_page_set: :py:class:`PageSet` :param source_page_set: - a collection of the page number to move :type flag: int :param flag: - specifies insert options :param progress: - A pointer to the progress interface. NULL if progress tracking is not required. Notes: MovePages function does not save src_doc. It merely delete pages in memeory. For permanent changes, PDFDoc::Save should be used to save src_doc after function exists. """ return _PDFNetPython.PDFDoc_MovePages(self, args)
[docs] def PagePushFront(self, page): r""" Adds a page to the beginning of a document's page sequence. :type page: :py:class:`Page` :param page: - a page to prepend to the document Invalidates all PageIterators pointing to the document. """ return _PDFNetPython.PDFDoc_PagePushFront(self, page)
[docs] def PagePushBack(self, page): r""" Adds a page to the end of a document's page sequence. :type page: :py:class:`Page` :param page: - a page to append to the document Notes: Invalidates all PageIterators pointing to the document. """ return _PDFNetPython.PDFDoc_PagePushBack(self, page)
[docs] def ImportPages(self, pages, import_bookmarks=False): r""" The function imports a list of pages to this document. Although a list of pages can be imported using repeated calls to PageInsert(), PageImport will not import duplicate copies of resources that are shared across pages (such as fonts, images, colorspaces etc). Therefore this method is recommended when a page import list consists of several pages that share the same resources. :type pages: std::vector< PDF::Page,std::allocator< PDF::Page > > :param pages: A list of pages to import. All pages should belong to the same source document. :type import_bookmarks: boolean :param import_bookmarks: An optional flag specifying whether any bookmark items pointing to pages in the import list should be merged with the target (i.e. this) document. :rtype: std::vector< PDF::Page,std::allocator< PDF::Page > > :return: a list of imported pages. Note that imported pages are not placed in the document page sequence. This can be done using methods such as PageInsert(), PagePushBack(), etc. """ return _PDFNetPython.PDFDoc_ImportPages(self, pages, import_bookmarks)
[docs] def PageCreate(self, args): r""" Create a new, empty page in the document. You can use PageWriter to fill the page with new content. Finally the page should be inserted at specific place within document page sequence using PageInsert/PagePushFront/PagePushBack methods. :rtype: :py:class:`Page` :return: A new, empty page. Notes: the new page still does not belong to document page sequence and should be subsequently placed at a specific location within the sequence. :type media_box: :py:class:`Rect` :param media_box: A rectangle, expressed in default user space units, defining the boundaries of the physical medium on which the page is intended to be displayed or printed. A user space units is 1/72 of an inch. If media_box is not specified the default dimensions of the page are 8.5 x 11 inches (or 8.572, 1172 units). The following is a listing of some standard U.S. page sizes: Letter = Rect(0, 0, 612, 792) Legal = Rect(0, 0, 612, 1008) Ledger = Rect(0, 0, 1224, 792) Tabloid = Rect(0, 0, 792, 1224) Executive = Rect(0, 0, 522, 756) The following is a listing of ISO standard page sizes: 4A0 = Rect(0, 0, 4768, 6741) 2A0 = Rect(0, 0, 3370, 4768) A0 = Rect(0, 0, 2384, 3370) A1 = Rect(0, 0, 1684, 2384) A2 = Rect(0, 0, 1191, 1684) A3 = Rect(0, 0, 842, 1191) A4 = Rect(0, 0, 595, 842) A5 = Rect(0, 0, 420, 595) A6 = Rect(0, 0, 298, 420) A7 = Rect(0, 0, 210, 298) A8 = Rect(0, 0, 147, 210) A9 = Rect(0, 0, 105, 147) A10 = Rect(0, 0, 74, 105) B0 = Rect(0, 0, 2835, 4008) B1 = Rect(0, 0, 2004, 2835) B2 = Rect(0, 0, 1417, 2004) B3 = Rect(0, 0, 1001, 1417) B4 = Rect(0, 0, 709, 1001) B5 = Rect(0, 0, 499, 709) B6 = Rect(0, 0, 354, 499) B7 = Rect(0, 0, 249, 354) B8 = Rect(0, 0, 176, 249) B9 = Rect(0, 0, 125, 176) B10 = Rect(0, 0, 88, 125) C0 = Rect(0, 0, 2599, 3677) C1 = Rect(0, 0, 1837, 2599) C2 = Rect(0, 0, 1298, 1837) C3 = Rect(0, 0, 918, 1298) C4 = Rect(0, 0, 649, 918) C5 = Rect(0, 0, 459, 649) C6 = Rect(0, 0, 323, 459) C7 = Rect(0, 0, 230, 323) C8 = Rect(0, 0, 162, 230) C9 = Rect(0, 0, 113, 162) C10 = Rect(0, 0, 79, 113) """ return _PDFNetPython.PDFDoc_PageCreate(self, args)
[docs] def AppendTextDiff(self, args): r""" Overload 1: Imports two external pages and highlights the differences between them. This function adds two new pages to the current document. The two input pages are typically coming from two different PDF files. Note: Each contiguous block of change is considered a single difference. A deletion immediately followed by an insertion is considered a single edit. :type page1: :py:class:`Page` :param page1: is the before page, the basis of the comparison (read-only) :type page2: :py:class:`Page` :param page2: is the after page, to which the basis is compared (read-only) :rtype: int :return: the total number of differences found | Overload 2: Imports two external PDFs and highlights the differences between them. This function appends alternating pages from the two input documents into the current document. Note: Each contiguous block of change is considered a single difference. A deletion immediately followed by an insertion is considered a single edit. :type doc1: :py:class:`PDFDoc` :param doc1: is the before document, the basis of the comparison (read-only) :type doc2: :py:class:`PDFDoc` :param doc2: is the after document, to which the basis is compared (read-only) :rtype: int :return: the total number of differences found | Overload 3: Imports two external PDFs and highlights the differences between them. This function appends alternating pages from the two input documents into the current document. Note: Each contiguous block of change is considered a single difference. A deletion immediately followed by an insertion is considered a single edit. :type doc1: :py:class:`PDFDoc` :param doc1: is the before document, the basis of the comparison (read-only) :type doc2: :py:class:`PDFDoc` :param doc2: is the after document, to which the basis is compared (read-only) :type options: :py:class:`TextDiffOptions` :param options: processing options (optional) :rtype: int :return: the total number of differences found """ return _PDFNetPython.PDFDoc_AppendTextDiff(self, args)
[docs] @staticmethod def HighlightTextDiff(doc1, doc2, options): r""" Imports two external PDFs and highlights the differences between them. This function directly adds the highlights to the two input documents. Note: Each contiguous block of change is considered a single difference. A deletion immediately followed by an insertion is considered a single edit. :type doc1: :py:class:`PDFDoc` :param doc1: is the before document, the basis of the comparison :type doc2: :py:class:`PDFDoc` :param doc2: is the after document, to which the basis is compared :type options: :py:class:`TextDiffOptions` :param options: processing options (optional) :rtype: int :return: the total number of differences found """ return _PDFNetPython.PDFDoc_HighlightTextDiff(doc1, doc2, options)
[docs] def GetFirstBookmark(self): r""" :rtype: :py:class:`Bookmark` :return: - the first Bookmark from the document's outline tree. If the Bookmark tree is empty the underlying SDF/Cos Object is null and returned Bookmark is not valid (i.e. Bookmark::IsValid() returns false). """ return _PDFNetPython.PDFDoc_GetFirstBookmark(self)
[docs] def AddRootBookmark(self, root_bookmark): r""" Adds/links the specified Bookmark to the root level of document's outline tree. :type root_bookmark: :py:class:`Bookmark` :param root_bookmark: Bookmark to Add/link Notes: parameter 'root_bookmark' must not be linked (must not be belong) to a bookmark tree. """ return _PDFNetPython.PDFDoc_AddRootBookmark(self, root_bookmark)
[docs] def GetTrailer(self): r""" :rtype: :py:class:`Obj` :return: - A dictionary representing the Cos root of the document (document's trailer) """ return _PDFNetPython.PDFDoc_GetTrailer(self)
[docs] def GetRoot(self): r""" :rtype: :py:class:`Obj` :return: - A dictionary representing the Cos root of the document (/Root entry within the trailer dictionary) """ return _PDFNetPython.PDFDoc_GetRoot(self)
[docs] def GetPages(self): r""" :rtype: :py:class:`Obj` :return: - A dictionary representing the root of the low level page-tree """ return _PDFNetPython.PDFDoc_GetPages(self)
[docs] def GetPageCount(self): r""" :rtype: int :return: the number of pages in the document. """ return _PDFNetPython.PDFDoc_GetPageCount(self)
[docs] def GetFieldIterator(self, args): r""" Overload 1: An interactive form (sometimes referred to as an AcroForm) is a collection of fields for gathering information interactively from the user. A PDF document may contain any number of fields appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document. The following methods are used to access and manipulate Interactive form fields (sometimes referred to as AcroForms). :rtype: :py:class:`FieldIterator` :return: an iterator to the first Field in the document. The list of all Fields present in the document can be traversed as follows: .. code-block:: c++ FieldIterator itr = pdfdoc.GetFieldIterator(); for(; itr.HasNext(); itr.Next()) { Field field = itr.Current(); Console.WriteLine("Field name: {0}", field.GetName()); } For a sample, please refer to 'InteractiveForms' sample project. | Overload 2: An interactive form (sometimes referred to as an AcroForm) is a collection of fields for gathering information interactively from the user. A PDF document may contain any number of fields appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document. The following methods are used to access and manipulate Interactive form fields (sometimes referred to as AcroForms). :type field_name: string :param field_name: String representing the name of the field to get. :rtype: :py:class:`FieldIterator` :return: an iterator to the Field in the document. For a sample, please refer to 'InteractiveForms' sample project. """ return _PDFNetPython.PDFDoc_GetFieldIterator(self, args)
[docs] def GetField(self, field_name): r""" :type field_name: string :param field_name: - a string representing the fully qualified name of the field (e.g. "employee.name.first"). :rtype: :py:class:`Field` :return: a FieldIterator referring to an interactive Field or to invalid field if the field name was not found. If a given field name was not found itr.HasNext() will return false. For example: .. code-block:: c++ FieldIterator itr = pdfdoc.GetFieldIterator("name"); if (itr.HasNext()) { Console.WriteLine("Field name: {0}", itr.Current().GetName()); } else { ...field was not found... } """ return _PDFNetPython.PDFDoc_GetField(self, field_name)
[docs] def FieldCreate(self, args): r""" Overload 1: Create a new interactive form Field. :type field_name: string :param field_name: a string representing the fully qualified name of the field (e.g. "employee.name.first"). field_name must be either a unique name or equal to an existing terminal field name. :type type: int :param type: field type (e.g. Field::e_text, Field::e_button, etc.) :type field_value: :py:class:`Obj` :param field_value: :type def_field_value: :py:class:`Obj` :param def_field_value: :rtype: :py:class:`Field` :return: the new form Field. :raises: if 'field_name' is equal to an existing non-terminal field name an exception is thrown. | Overload 2: Create a new interactive form Field. :type field_name: string :param field_name: a string representing the fully qualified name of the field (e.g. "employee.name.first"). field_name must be either a unique name or equal to an existing terminal field name. :type type: int :param type: field type (e.g. Field::e_text, Field::e_button, etc.) :type field_value: string :param field_value: :type def_field_value: string :param def_field_value: :rtype: :py:class:`Field` :return: the new form Field. :raises: if 'field_name' is equal to an existing non-terminal field name an exception is thrown. | Overload 3: Create a new interactive form Field. :type field_name: string :param field_name: a string representing the fully qualified name of the field (e.g. "employee.name.first"). field_name must be either a unique name or equal to an existing terminal field name. :type type: int :param type: field type (e.g. Field::e_text, Field::e_button, etc.) :type field_value: string :param field_value: :param def_field_value: :rtype: :py:class:`Field` :return: the new form Field. :raises: if 'field_name' is equal to an existing non-terminal field name an exception is thrown. """ return _PDFNetPython.PDFDoc_FieldCreate(self, args)
[docs] def RefreshFieldAppearances(self): r""" Regenerates the appearance stream for every widget annotation in the document Call this method if you modified field's value and would like to update field's appearances. """ return _PDFNetPython.PDFDoc_RefreshFieldAppearances(self)
[docs] def RefreshAnnotAppearances(self, options=None): r""" Generates the appearance stream for annotations in the document using the specified options. A common use case is to generate appearances only for missing annotations, which can be accomplished using the default options. :type options: :py:class:`RefreshOptions` :param options: Options that can be used to adjust this generation process. """ return _PDFNetPython.PDFDoc_RefreshAnnotAppearances(self, options)
[docs] def FlattenAnnotations(self, forms_only=False): r""" Flatten all annotations in the document. :type forms_only: boolean :param forms_only: if false flatten all annotations, otherwise flatten only form fields. """ return _PDFNetPython.PDFDoc_FlattenAnnotations(self, forms_only)
[docs] def GetAcroForm(self): r""" :rtype: :py:class:`Obj` :return: the AcroForm dictionary located in "/Root" or NULL if dictionary is not present. """ return _PDFNetPython.PDFDoc_GetAcroForm(self)
e_forms_only = _PDFNetPython.PDFDoc_e_forms_only e_annots_only = _PDFNetPython.PDFDoc_e_annots_only e_both = _PDFNetPython.PDFDoc_e_both e_annots_only_no_links = _PDFNetPython.PDFDoc_e_annots_only_no_links
[docs] def FDFExtract(self, args): r""" Overload 1: Extract form data and/or annotations to FDF :type flag: int :param flag: - specifies extract options :rtype: :py:class:`FDFDoc` :return: a pointer to the newly created FDF file with an interactive data. | Overload 2: Extract form data and/or annotations to FDF :type pages_to_extract: :py:class:`PageSet` :param pages_to_extract: The set of pages for which to extract interactive data. :type flag: int :param flag: specifies extract options :rtype: :py:class:`FDFDoc` :return: a pointer to the newly created FDF file with an interactive data. | Overload 3: Extract form data and/or annotations to FDF :type pages_to_extract: :py:class:`PageSet` :param pages_to_extract: The set of pages for which to extract interactive data. :param flag: specifies extract options :rtype: :py:class:`FDFDoc` :return: a pointer to the newly created FDF file with an interactive data. | Overload 4: Extract selected annotations to FDF :type annotations: std::vector< PDF::Annot,std::allocator< PDF::Annot > > :param annotations: the annotation(s) to extract :rtype: :py:class:`FDFDoc` :return: a pointer to the newly created FDF file with the interactive data. | Overload 5: Extract annotations to FDF :type annot_added: std::vector< PDF::Annot,std::allocator< PDF::Annot > > :param annot_added: specifies the array of added annotations :type annot_modified: std::vector< PDF::Annot,std::allocator< PDF::Annot > > :param annot_modified: specifies the array of modified annotations :type annot_deleted: std::vector< PDF::Annot,std::allocator< PDF::Annot > > :param annot_deleted: specifies the array of deleted annotations :rtype: :py:class:`FDFDoc` :return: a pointer to the newly created FDF file with an interactive data. """ return _PDFNetPython.PDFDoc_FDFExtract(self, args)
[docs] def FDFMerge(self, fdf_doc): r""" Import form data from FDF file to PDF interactive form. :type fdf_doc: :py:class:`FDFDoc` :param fdf_doc: a reference to the FDF file """ return _PDFNetPython.PDFDoc_FDFMerge(self, fdf_doc)
[docs] def FDFUpdate(self, fdf_doc): r""" Replace existing form and annotation data with those imported from the FDF file. It will make annotations in the FDF match those in the PDF. Since this method avoids updating annotations unnecessarily it works well with incremental save and can sometimes preserve annotation appearances, but it requires that the annotations intended to be in the final document be in the provided FDF file. Notes: Some PDF viewers (like Chrome) cannot display annotations that don't already have an appearance, so it is often desirable to call PDFDoc.RefreshAnnotAppearances after this method to ensure these annotations can still be displayed in those applications. This method is not suitable for realtime collaboration. :type fdf_doc: :py:class:`FDFDoc` :param fdf_doc: a pointer to the FDF file """ return _PDFNetPython.PDFDoc_FDFUpdate(self, fdf_doc)
[docs] def GetOpenAction(self): r""" :rtype: :py:class:`Action` :return: Action that is triggered when the document is opened. The returned action can be either a destination or some other kind of Action (see Section 8.5, 'Actions' in PDF Reference Manual). Notes: if the document does not nave associated action the returned Action will be null (i.e. Action.IsValid() returns false) """ return _PDFNetPython.PDFDoc_GetOpenAction(self)
[docs] def SetOpenAction(self, action): r""" Sets the Action that will be triggered when the document is opened. :type action: :py:class:`Action` :param action: A new Action that will be triggered when the document is opened. An example of such action is a GoTo Action that takes the user to a given location in the document. """ return _PDFNetPython.PDFDoc_SetOpenAction(self, action)
[docs] def AddFileAttachment(self, file_key, embedded_file): r""" Associates a file attachment with the document. The file attachment will be displayed in the user interface of a viewer application (in Acrobat this is File Attachment tab). The function differs from Annot.CreateFileAttachment() because it associates the attachment with the whole document instead of an annotation on a specific page. :type file_key: string :param file_key: A key/name under which the attachment will be stored. :type embedded_file: :py:class:`FileSpec` :param embedded_file: Embedded file stream Notes: Another way to associate a file attachment with the document is using SDF::NameTree: .. code-block:: c++ SDF::NameTree names = SDF::NameTree::Create(doc, "EmbeddedFiles"); names.Put(file_key, file_keysz, embedded_file.GetSDFObj()); """ return _PDFNetPython.PDFDoc_AddFileAttachment(self, file_key, embedded_file)
[docs] def GetPageLabel(self, page_num): r""" :rtype: :py:class:`PageLabel` :return: the PageLabel that is in effect for the given page. If there is no label object in effect, this method returns an invalid page label object. :type page_num: int :param page_num: The page number. Because PDFNet indexes pages starting from 1, page_num must be larger than 0. """ return _PDFNetPython.PDFDoc_GetPageLabel(self, page_num)
[docs] def SetPageLabel(self, page_num, label): r""" Attaches a label to a page. This establishes the numbering scheme for that page and all following it, until another page label is encountered. This label allows PDF producers to define a page numbering system other than the default. :type page_num: int :param page_num: The number of the page to label. If page_num is less than 1 or greater than the number of pages in the document, the method does nothing. """ return _PDFNetPython.PDFDoc_SetPageLabel(self, page_num, label)
[docs] def RemovePageLabel(self, page_num): r""" Removes the page label that is attached to the specified page, effectively merging the specified range with the previous page label sequence. :type page_num: int :param page_num: The page from which the page label is removed. Because PDFNet indexes pages starting from 1, page_num must be larger than 0. """ return _PDFNetPython.PDFDoc_RemovePageLabel(self, page_num)
[docs] def IsTagged(self): r""" :rtype: boolean :return: true if this document is marked as Tagged PDF, false otherwise. """ return _PDFNetPython.PDFDoc_IsTagged(self)
[docs] def GetStructTree(self): r""" :rtype: :py:class:`STree` :return: The document's logical structure tree root. """ return _PDFNetPython.PDFDoc_GetStructTree(self)
[docs] def HasOC(self): r""" :rtype: boolean :return: true if the optional content (OC) feature is associated with the document. The document is considered to have optional content if there is an OCProperties dictionary in the document's catalog, and that dictionary has one or more entries in the OCGs array. """ return _PDFNetPython.PDFDoc_HasOC(self)
[docs] def GetOCGs(self): r""" :rtype: :py:class:`Obj` :return: the Obj array that contains optional-content groups (OCGs) for the document, or NULL if the document does not contain any OCGs. The order of the groups is not guaranteed to be the creation order, and is not the same as the display order. """ return _PDFNetPython.PDFDoc_GetOCGs(self)
[docs] def GetOCGConfig(self): r""" :rtype: :py:class:`Config` :return: the default optional-content configuration for the document from the OCProperties D entry. """ return _PDFNetPython.PDFDoc_GetOCGConfig(self)
[docs] def AddHighlights(self, hilite): r""" AddHighlights is used to highlight text in a document using 'Adobe's Highlight File Format' (Technical Note #5172 ). The method will parse the character offset data and modify the current document by adding new highlight annotations. :type hilite: string :param hilite: a string representing the filename for the highlight file or or a data buffer containing XML data. :raises: An exception will be thrown if the XML file is malformed or os out of sync with the document. """ return _PDFNetPython.PDFDoc_AddHighlights(self, hilite)
[docs] def CreateIndirectName(self, name): r""" This method creates an SDF/Cos indirect name object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared). """ return _PDFNetPython.PDFDoc_CreateIndirectName(self, name)
[docs] def CreateIndirectArray(self): r""" This method creates an SDF/Cos indirect array object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared). :rtype: :py:class:`Obj` :return: Returns a new indirect array object. """ return _PDFNetPython.PDFDoc_CreateIndirectArray(self)
[docs] def CreateIndirectBool(self, value): r""" This method creates an SDF/Cos indirect boolean object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared). :rtype: :py:class:`Obj` :return: Returns a new indirect boolean object. :type value: boolean :param value: the value with which to create the boolean object. """ return _PDFNetPython.PDFDoc_CreateIndirectBool(self, value)
[docs] def CreateIndirectDict(self): r""" This method creates an SDF/Cos indirect dict object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared). :rtype: :py:class:`Obj` :return: Returns a new indirect dict object. """ return _PDFNetPython.PDFDoc_CreateIndirectDict(self)
[docs] def CreateIndirectNull(self): r""" This method creates an SDF/Cos indirect null object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared). :rtype: :py:class:`Obj` :return: Returns a new indirect null object. """ return _PDFNetPython.PDFDoc_CreateIndirectNull(self)
[docs] def CreateIndirectNumber(self, value): r""" This method creates an SDF/Cos indirect number object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared). :rtype: :py:class:`Obj` :return: Returns a new indirect number object. :type value: double :param value: the value with which to create the number object. """ return _PDFNetPython.PDFDoc_CreateIndirectNumber(self, value)
[docs] def CreateIndirectString(self, args): r""" Overload 1: This method creates an SDF/Cos indirect string object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared). :rtype: :py:class:`Obj` :return: Returns a new indirect string object. :type value: UChar :param value: Unsigned char pointer with which to create the string object. :type size: int :param size: length of string. | Overload 2: This method creates an SDF/Cos indirect string object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared). :rtype: :py:class:`Obj` :return: Returns a new indirect string object. :type str: string :param str: reference to string with which to create the string object. """ return _PDFNetPython.PDFDoc_CreateIndirectString(self, args)
[docs] def CreateIndirectStream(self, args): r""" Overload 1: This method creates an SDF/Cos indirect stream object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared). :rtype: :py:class:`Obj` :return: Returns a new indirect stream object. :type data: :py:class:`FilterReader` :param data: reference to a FilterReader object with which to create the stream object. :type filter_chain: :py:class:`Filter` :param filter_chain: filter object with which to create the stream object. Defaults to Filters::Filter(0,false) | Overload 2: This method creates an SDF/Cos indirect stream object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared). :rtype: :py:class:`Obj` :return: Returns a new indirect stream object. :type data: string :param data: a buffer from which to create the stream object. :type data_size: int :param data_size: size of the buffer. :type filter_chain: :py:class:`Filter` :param filter_chain: filter object with which to create the stream object. Defaults to Filters::Filter(0,false) | Overload 3: This method creates an SDF/Cos indirect stream object Unlike direct objects, indirect objects can be referenced by more than one object (i.e. indirect objects can be shared). :rtype: :py:class:`Obj` :return: Returns a new indirect stream object. :type data: string :param data: a buffer from which to create the stream object. :type data_size: int :param data_size: size of the buffer. :param filter_chain: filter object with which to create the stream object. Defaults to Filters::Filter(0,false) """ return _PDFNetPython.PDFDoc_CreateIndirectStream(self, args)
[docs] def GetSDFDoc(self): r""" :rtype: :py:class:`SDFDoc` :return: document's SDF/Cos document """ return _PDFNetPython.PDFDoc_GetSDFDoc(self)
[docs] def Lock(self): r""" Locks the document to prevent competing threads from accessing the document at the same time. Threads attempting to access the document will wait in suspended state until the thread that owns the lock calls doc.Unlock(). """ return _PDFNetPython.PDFDoc_Lock(self)
[docs] def Unlock(self): r"""Removes the lock from the document.""" return _PDFNetPython.PDFDoc_Unlock(self)
[docs] def TryLock(self, milliseconds=0): r""" Try locking the document, waiting no longer than specified number of milliseconds. :type milliseconds: int :param milliseconds: - max number of milliseconds to wait for the document to lock :rtype: boolean :return: true if the document is locked for multi-threaded access, false otherwise. """ return _PDFNetPython.PDFDoc_TryLock(self, milliseconds)
[docs] def LockRead(self): r""" Locks the document to prevent competing write threads (using Lock()) from accessing the document at the same time. Other reader threads however, will be allowed to access the document. Threads attempting to obtain write access to the document will wait in suspended state until the thread that owns the lock calls doc.UnlockRead(). Note: To avoid deadlocks obtaining a write lock while holding a read lock is not permitted and will throw an exception. If this situation is encountered please either unlock the read lock before the write lock is obtained or acquire a write lock (rather than read lock) in the first place. """ return _PDFNetPython.PDFDoc_LockRead(self)
[docs] def UnlockRead(self): r"""Removes the read lock from the document.""" return _PDFNetPython.PDFDoc_UnlockRead(self)
[docs] def TryLockRead(self, milliseconds=0): r""" Tries to obtain a read lock the document for <milliseconds> duration, and returns true if the lock was successfully acquired :type milliseconds: int :param milliseconds: duration to obtain a read lock for. :rtype: boolean :return: true if the document is locked for multi-threaded access, false otherwise. """ return _PDFNetPython.PDFDoc_TryLockRead(self, milliseconds)
[docs] def GetFileName(self): r""" :rtype: string :return: The filename of the document if the document is loaded from disk, or empty string if the document is not yet saved or is loaded from a memory buffer. """ return _PDFNetPython.PDFDoc_GetFileName(self)
[docs] def GenerateThumbnails(self, size): r""" Generates thumbnail images for all the pages in this PDF document. :type size: int :param size: The maximum dimension (width or height) that thumbnails will have. """ return _PDFNetPython.PDFDoc_GenerateThumbnails(self, size)
[docs] def AppendVisualDiff(self, p1, p2, opts): r""" Generates a PDF diff of the given pages by overlaying and blending them on top of each other. :type p1: :py:class:`Page` :param p1: one of the two pages for comparing. :type p2: :py:class:`Page` :param p2: the other page for comparing. :type opts: :py:class:`DiffOptions` :param opts: options for comparison results. """ return _PDFNetPython.PDFDoc_AppendVisualDiff(self, p1, p2, opts)
[docs] def SaveViewerOptimized(self, args): r""" Overload 1: Applies optimizations to improve viewing speed and saves the document to the specified file. The main optimizations used are linearization and embedding thumbnails for the first page and any complex pages. :type path: string :param path: The full path name to which the file is saved. :type opts: :py:class:`ViewerOptimizedOptions` :param opts: The optimization options :raises: if the file can't be opened for saving or if there is a problem during Save an Exception object will be thrown. | Overload 2: Applies optimizations to improve viewing speed and saves the document to a memory buffer. The main optimizations used are linearization and embedding thumbnails for the first page and any other pages that are slow to render. :type out_buf: string :param out_buf: a pointer to the buffer containing the serialized version of the document. (C++ Note) The buffer is owned by a document and the client doesn't need to do any initialization or cleanup. :type out_buf_size: int :param out_buf_size: the size of the serialized document (i.e. out_buf) in bytes. :type opts: :py:class:`ViewerOptimizedOptions` :param opts: - The optimization options :raises: - if the file can't be opened for saving or if there is a problem during Save an Exception object will be thrown. """ return _PDFNetPython.PDFDoc_SaveViewerOptimized(self, args)
e_unsigned = _PDFNetPython.PDFDoc_e_unsigned e_failure = _PDFNetPython.PDFDoc_e_failure e_untrusted = _PDFNetPython.PDFDoc_e_untrusted e_unsupported = _PDFNetPython.PDFDoc_e_unsupported e_verified = _PDFNetPython.PDFDoc_e_verified
[docs] def VerifySignedDigitalSignatures(self, in_opts): r""" Attempts to verify all signed cryptographic digital signatures in the document, ignoring unsigned signatures. :rtype: int :return: an enumeration value representing the state of the document's signatures """ return _PDFNetPython.PDFDoc_VerifySignedDigitalSignatures(self, in_opts)
[docs] def MergeXFDF(self, args): r""" Overload 1: Merge existing form and annotation data with those imported from the XFDF file. It will replace annotations from pdfdocument with matching annotations from XFDF. In order for the annotations to be considered matching, "name" of the xfdf annotation needs to match "NM" of that in pdf. XFDF annotations that don't have a match in the pdf document will be added. For regular xfdf files, no deletions will be made This method also supports command form of xfdf, for those files, deletions will be performed for annotations in "delete" section Since this method avoids updating annotations unnecessarily it works well with incremental save. Note: This method is suitable for realtime collaboration. :type stream: :py:class:`Filter` :param stream: - Input Filter which provides the xfdf contents :type opts: MergeXFDFOptions :param opts: - MergeXFDFOptions object for finer control :raises: PDFNetException | Overload 2: Merge existing form and annotation data with those imported from the XFDF file. It will replace annotations from pdfdocument with matching annotations from XFDF. In order for the annotations to be considered matching, "name" of the xfdf annotation needs to match "NM" of that in pdf. XFDF annotations that don't have a match in the pdf document will be added. For regular xfdf files, no deletions will be made This method also supports command form of xfdf, for those files, deletions will be performed for annotations in "delete" section Since this method avoids updating annotations unnecessarily it works well with incremental save. Note: This method is suitable for realtime collaboration. :type xfdf: string :param xfdf: - xfdf contents in string form or the path to the xfdf file :type opts: MergeXFDFOptions :param opts: - MergeXFDFOptions object for finer control :raises: PDFNetException | Overload 3: Merge existing form and annotation data with those imported from the XFDF file. It will replace annotations from pdfdocument with matching annotations from XFDF. In order for the annotations to be considered matching, "name" of the xfdf annotation needs to match "NM" of that in pdf. XFDF annotations that don't have a match in the pdf document will be added. For regular xfdf files, no deletions will be made This method also supports command form of xfdf, for those files, deletions will be performed for annotations in "delete" section Since this method avoids updating annotations unnecessarily it works well with incremental save. Note: This method is suitable for realtime collaboration. :type xfdf: string :param xfdf: - xfdf contents in string form or the path to the xfdf file :param opts: - MergeXFDFOptions object for finer control :raises: PDFNetException """ return _PDFNetPython.PDFDoc_MergeXFDF(self, args)
[docs] @staticmethod def CreateInternal(impl): return _PDFNetPython.PDFDoc_CreateInternal(impl)
[docs] def GetHandleInternal(self): return _PDFNetPython.PDFDoc_GetHandleInternal(self)
mp_doc = property(_PDFNetPython.PDFDoc_mp_doc_get, _PDFNetPython.PDFDoc_mp_doc_set) def __init__(self, args): _PDFNetPython.PDFDoc_swiginit(self, _PDFNetPython.new_PDFDoc(args))
# Register PDFDoc in _PDFNetPython: _PDFNetPython.PDFDoc_swigregister(PDFDoc)
[docs] def PDFDoc_HighlightTextDiff(doc1, doc2, options): r""" Imports two external PDFs and highlights the differences between them. This function directly adds the highlights to the two input documents. Note: Each contiguous block of change is considered a single difference. A deletion immediately followed by an insertion is considered a single edit. :type doc1: :py:class:`PDFDoc` :param doc1: is the before document, the basis of the comparison :type doc2: :py:class:`PDFDoc` :param doc2: is the after document, to which the basis is compared :type options: :py:class:`TextDiffOptions` :param options: processing options (optional) :rtype: int :return: the total number of differences found """ return _PDFNetPython.PDFDoc_HighlightTextDiff(doc1, doc2, options)
[docs] def PDFDoc_CreateInternal(impl): return _PDFNetPython.PDFDoc_CreateInternal(impl)
[docs] class PrintToPdfOptions(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): _PDFNetPython.PrintToPdfOptions_swiginit(self, _PDFNetPython.new_PrintToPdfOptions()) __swig_destroy__ = _PDFNetPython.delete_PrintToPdfOptions
[docs] def GetHorizontalPageMargin(self): r""" Gets the value HorizontalPageMargin from the options object The horizontal margins (left and right) in points. The default is a 1/4 of an inch or 18 points. :rtype: double :return: a double, the current value for HorizontalPageMargin. """ return _PDFNetPython.PrintToPdfOptions_GetHorizontalPageMargin(self)
[docs] def SetHorizontalPageMargin(self, value): r""" Sets the value for HorizontalPageMargin in the options object The horizontal margins (left and right) in points. The default is a 1/4 of an inch or 18 points. :type value: double :param value:: the new value for HorizontalPageMargin :rtype: :py:class:`PrintToPdfOptions` :return: this object, for call chaining """ return _PDFNetPython.PrintToPdfOptions_SetHorizontalPageMargin(self, value)
[docs] def GetPageHeight(self): r""" Gets the value PageHeight from the options object The page height to use in points. If not set (or set to 0), uses letter paper size. :rtype: double :return: a double, the current value for PageHeight. """ return _PDFNetPython.PrintToPdfOptions_GetPageHeight(self)
[docs] def SetPageHeight(self, value): r""" Sets the value for PageHeight in the options object The page height to use in points. If not set (or set to 0), uses letter paper size. :type value: double :param value:: the new value for PageHeight :rtype: :py:class:`PrintToPdfOptions` :return: this object, for call chaining """ return _PDFNetPython.PrintToPdfOptions_SetPageHeight(self, value)
[docs] def GetPageOrientation(self): r""" Gets the value PageOrientation from the options object Page orientation, "portrait" or "landscape". :rtype: string :return: a string, the current value for PageOrientation. """ return _PDFNetPython.PrintToPdfOptions_GetPageOrientation(self)
[docs] def SetPageOrientation(self, value): r""" Sets the value for PageOrientation in the options object Page orientation, "portrait" or "landscape". :type value: string :param value:: the new value for PageOrientation :rtype: :py:class:`PrintToPdfOptions` :return: this object, for call chaining """ return _PDFNetPython.PrintToPdfOptions_SetPageOrientation(self, value)
[docs] def GetPageWidth(self): r""" Gets the value PageWidth from the options object The page width to use in points. If not set (or set to 0), uses letter paper size. :rtype: double :return: a double, the current value for PageWidth. """ return _PDFNetPython.PrintToPdfOptions_GetPageWidth(self)
[docs] def SetPageWidth(self, value): r""" Sets the value for PageWidth in the options object The page width to use in points. If not set (or set to 0), uses letter paper size. :type value: double :param value:: the new value for PageWidth :rtype: :py:class:`PrintToPdfOptions` :return: this object, for call chaining """ return _PDFNetPython.PrintToPdfOptions_SetPageWidth(self, value)
[docs] def GetVerticalPageMargin(self): r""" Gets the value VerticalPageMargin from the options object The vertical margins (top and bottom) in points. The default is a 1/4 of an inch or 18 points. :rtype: double :return: a double, the current value for VerticalPageMargin. """ return _PDFNetPython.PrintToPdfOptions_GetVerticalPageMargin(self)
[docs] def SetVerticalPageMargin(self, value): r""" Sets the value for VerticalPageMargin in the options object The vertical margins (top and bottom) in points. The default is a 1/4 of an inch or 18 points. :type value: double :param value:: the new value for VerticalPageMargin :rtype: :py:class:`PrintToPdfOptions` :return: this object, for call chaining """ return _PDFNetPython.PrintToPdfOptions_SetVerticalPageMargin(self, value)
# Register PrintToPdfOptions in _PDFNetPython: _PDFNetPython.PrintToPdfOptions_swigregister(PrintToPdfOptions)
[docs] class PrintToPdfModule(object): r""" The class PrintToPdfModule. An interface into Apryse SDKs Print To PDF functionality """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def IsModuleAvailable(): r""" Find out whether the PrintToPdf module is available. :rtype: boolean :return: returns true if PrintToPdf can be performed. """ return _PDFNetPython.PrintToPdfModule_IsModuleAvailable()
[docs] @staticmethod def PrintToPdf(pdf_doc, file_to_print, options=None): r""" Generate a PDF file by printing a document to the Apryse PDF printer via the Windows print verb. :type pdf_doc: :py:class:`PDFDoc` :param pdf_doc: -- The destination document. :type file_to_print: string :param file_to_print: -- The source document filename. :type options: :py:class:`PrintToPdfOptions` :param options: -- Print options (optional). """ return _PDFNetPython.PrintToPdfModule_PrintToPdf(pdf_doc, file_to_print, options)
def __init__(self): _PDFNetPython.PrintToPdfModule_swiginit(self, _PDFNetPython.new_PrintToPdfModule()) __swig_destroy__ = _PDFNetPython.delete_PrintToPdfModule
# Register PrintToPdfModule in _PDFNetPython: _PDFNetPython.PrintToPdfModule_swigregister(PrintToPdfModule)
[docs] def PrintToPdfModule_IsModuleAvailable(): r""" Find out whether the PrintToPdf module is available. :rtype: boolean :return: returns true if PrintToPdf can be performed. """ return _PDFNetPython.PrintToPdfModule_IsModuleAvailable()
[docs] def PrintToPdfModule_PrintToPdf(pdf_doc, file_to_print, options=None): r""" Generate a PDF file by printing a document to the Apryse PDF printer via the Windows print verb. :type pdf_doc: :py:class:`PDFDoc` :param pdf_doc: -- The destination document. :type file_to_print: string :param file_to_print: -- The source document filename. :type options: :py:class:`PrintToPdfOptions` :param options: -- Print options (optional). """ return _PDFNetPython.PrintToPdfModule_PrintToPdf(pdf_doc, file_to_print, options)
[docs] class Caret(Markup): r""" A Caret annotation (PDF 1.5) is a visual symbol that indicates the presence of text edits. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(args): r""" Overload 1: Creates a new Caret annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Caret annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Caret annotation's bounds in default user space units. :rtype: :py:class:`Caret` :return: A newly created blank Caret annotation. | Overload 2: Creates a new Caret annotation, in the specified document, specifying a set of four numbers that shall describe the numerical differences between two rectangles: the Rect entry of the annotation and the actual boundaries of the underlying Caret. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Caret annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Caret annotation's bounds in default user space units. :type padding: :py:class:`Rect` :param padding: A set of four numbers(represented as a Rect object)specifying the numerical differences between two rectangles: the Rect entry of the annotation and the actual boundaries of the underlying Caret. :rtype: :py:class:`Caret` :return: A newly created Caret annotation with rectangle difference specified. """ return _PDFNetPython.Caret_Create(args)
[docs] @staticmethod def CreateAnnot(args): return _PDFNetPython.Caret_CreateAnnot(args)
[docs] def GetSymbol(self): r""" Returns the paragraph symbol associated with the caret. :rtype: string :return: The name of the symbol. This can be either "P" (Use a new paragraph symbol) or "None" (Don't use any symbol). Default value: None. """ return _PDFNetPython.Caret_GetSymbol(self)
[docs] def SetSymbol(self, symbol): r""" Sets the caret symbol. :type symbol: string :param symbol: The name of the symbol. This can be either "P" (Use a new paragraph symbol) or "None" (Don't use any symbol). Default value: None. """ return _PDFNetPython.Caret_SetSymbol(self, symbol)
def __init__(self, args): _PDFNetPython.Caret_swiginit(self, _PDFNetPython.new_Caret(args)) __swig_destroy__ = _PDFNetPython.delete_Caret
# Register Caret in _PDFNetPython: _PDFNetPython.Caret_swigregister(Caret)
[docs] def Caret_Create(args): r""" Overload 1: Creates a new Caret annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Caret annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Caret annotation's bounds in default user space units. :rtype: :py:class:`Caret` :return: A newly created blank Caret annotation. | Overload 2: Creates a new Caret annotation, in the specified document, specifying a set of four numbers that shall describe the numerical differences between two rectangles: the Rect entry of the annotation and the actual boundaries of the underlying Caret. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Caret annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Caret annotation's bounds in default user space units. :type padding: :py:class:`Rect` :param padding: A set of four numbers(represented as a Rect object)specifying the numerical differences between two rectangles: the Rect entry of the annotation and the actual boundaries of the underlying Caret. :rtype: :py:class:`Caret` :return: A newly created Caret annotation with rectangle difference specified. """ return _PDFNetPython.Caret_Create(args)
[docs] def Caret_CreateAnnot(args): return _PDFNetPython.Caret_CreateAnnot(args)
[docs] class Circle(Markup): r""" A Circle annotation is a type of markup annotation that displays an ellipse on the page. When opened, it can display a pop-up window containing the text of the associated note. The ellipse may be inscribed and possibly padded within the annotation rectangle defined by the annotation dictionary's Rect entry. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new Circle annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`Circle` :return: A newly created blank Circle annotation. """ return _PDFNetPython.Circle_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.Circle_CreateAnnot(doc, pos)
def __init__(self, args): _PDFNetPython.Circle_swiginit(self, _PDFNetPython.new_Circle(args)) __swig_destroy__ = _PDFNetPython.delete_Circle
# Register Circle in _PDFNetPython: _PDFNetPython.Circle_swigregister(Circle)
[docs] def Circle_Create(doc, pos): r""" Creates a new Circle annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`Circle` :return: A newly created blank Circle annotation. """ return _PDFNetPython.Circle_Create(doc, pos)
[docs] def Circle_CreateAnnot(doc, pos): return _PDFNetPython.Circle_CreateAnnot(doc, pos)
[docs] class HighlightAnnot(TextMarkup): r""" A Highlight annotation covers a word or a group of contiguous words with partially transparent color. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new Highlight annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Highlight annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Highlight annotation's bounds in default user space units. :rtype: :py:class:`HighlightAnnot` :return: A newly created blank Highlight annotation. """ return _PDFNetPython.HighlightAnnot_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.HighlightAnnot_CreateAnnot(doc, pos)
def __init__(self, args): _PDFNetPython.HighlightAnnot_swiginit(self, _PDFNetPython.new_HighlightAnnot(args)) __swig_destroy__ = _PDFNetPython.delete_HighlightAnnot
# Register HighlightAnnot in _PDFNetPython: _PDFNetPython.HighlightAnnot_swigregister(HighlightAnnot)
[docs] def HighlightAnnot_Create(doc, pos): r""" Creates a new Highlight annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Highlight annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Highlight annotation's bounds in default user space units. :rtype: :py:class:`HighlightAnnot` :return: A newly created blank Highlight annotation. """ return _PDFNetPython.HighlightAnnot_Create(doc, pos)
[docs] def HighlightAnnot_CreateAnnot(doc, pos): return _PDFNetPython.HighlightAnnot_CreateAnnot(doc, pos)
[docs] class LineAnnot(Markup): r""" A line annotation (PDF 1.3) is used to display a single straight line on the page. When opened, it should display a pop-up window containing the text of the associated note. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new Line annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`LineAnnot` :return: A newly created blank Line annotation. """ return _PDFNetPython.LineAnnot_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.LineAnnot_CreateAnnot(doc, pos)
[docs] def GetStartPoint(self): r""" Returns the coordinates of the start of a line. :rtype: :py:class:`Point` :return: A point specifying the coordinates of the start of the line. """ return _PDFNetPython.LineAnnot_GetStartPoint(self)
[docs] def SetStartPoint(self, sp): r""" Sets the coordinates of the start of a line. :type sp: :py:class:`Point` :param sp: A point specifying the coordinates of the end of the line. """ return _PDFNetPython.LineAnnot_SetStartPoint(self, sp)
[docs] def GetEndPoint(self): r""" Returns the coordinates of the end of a line. :rtype: :py:class:`Point` :return: A point specifying the coordinates of the end of the line. """ return _PDFNetPython.LineAnnot_GetEndPoint(self)
[docs] def SetEndPoint(self, ep): r""" Sets the coordinates of the end of a line. :type ep: :py:class:`Point` :param ep: - A point specifying the coordinates of the end of the line. """ return _PDFNetPython.LineAnnot_SetEndPoint(self, ep)
e_Square = _PDFNetPython.LineAnnot_e_Square r""" A square filled with the annotation's interior color, if any""" e_Circle = _PDFNetPython.LineAnnot_e_Circle r""" A circle filled with the annotation's interior color, if any""" e_Diamond = _PDFNetPython.LineAnnot_e_Diamond r""" A diamond shape filled with the annotation's interior color, if any""" e_OpenArrow = _PDFNetPython.LineAnnot_e_OpenArrow r""" Two short lines meeting in an acute angle to form an open arrowhead""" e_ClosedArrow = _PDFNetPython.LineAnnot_e_ClosedArrow r""" Two short lines meeting in an acute angle as in the OpenArrow style and connected by a third line to form a triangular closed arrowhead filled with the annotation's interior color, if any""" e_Butt = _PDFNetPython.LineAnnot_e_Butt r""" A short line at the endpoint perpendicular to the line itself""" e_ROpenArrow = _PDFNetPython.LineAnnot_e_ROpenArrow r""" Two short lines in the reverse direction from OpenArrow""" e_RClosedArrow = _PDFNetPython.LineAnnot_e_RClosedArrow r""" A triangular closed arrowhead in the reverse direction from ClosedArrow""" e_Slash = _PDFNetPython.LineAnnot_e_Slash r""" A short line at the endpoint approximately 30 degrees clockwise from perpendicular to the line itself""" e_None = _PDFNetPython.LineAnnot_e_None r""" No special line ending""" e_Unknown = _PDFNetPython.LineAnnot_e_Unknown r""" Non-standard or invalid ending"""
[docs] def GetStartStyle(self): r""" Returns the ending style that applies to the first point of the line. :rtype: int :return: A enum value from the "EndingStyle". Notes: Default value: e_None. """ return _PDFNetPython.LineAnnot_GetStartStyle(self)
[docs] def SetStartStyle(self, sst): r""" Sets the ending style that applies to the first point of the line. (Optional; PDF 1.4.) :type sst: int :param sst: A enum value from the "EndingStyle". Notes: Default value: e_None. """ return _PDFNetPython.LineAnnot_SetStartStyle(self, sst)
[docs] def GetEndStyle(self): r""" Returns the ending style that applies to the second point of the line. :rtype: int :return: A enum value from the "EndingStyle". Notes: Default value: e_None. """ return _PDFNetPython.LineAnnot_GetEndStyle(self)
[docs] def SetEndStyle(self, est): r""" Sets the ending style that applies to the second point of the line. (Optional; PDF 1.4) :type est: int :param est: A enum value from the "EndingStyle". Notes: Default value: e_None. """ return _PDFNetPython.LineAnnot_SetEndStyle(self, est)
[docs] def GetLeaderLineLength(self): r""" Returns the leader line length of a line. :rtype: double :return: A number denoting the length of the leader line in default user space units. Notes: Usually if this entry is specified, the line is intended to be a dimension line (see "IT" entry of the annotation dictionary). Leader length is length of leader lines in default user space that extend from each endpoint of the line perpendicular to the line itself. A positive value shall mean that the leader lines appear in the direction that is clockwise when traversing the line from its starting point to its ending point (as specified by L); a negative value shall indicate the opposite direction. Default value: 0 (no leader lines) """ return _PDFNetPython.LineAnnot_GetLeaderLineLength(self)
[docs] def SetLeaderLineLength(self, length): r""" Sets the leader line length of a line. (PDF 1.6) :type length: double :param length: A number denoting the length of the leader line in default user space units. Notes: Usually if this entry is specified, the line is intended to be a dimension line (see "IT" entry of the annotation dictionary). Leader length is length of leader lines in default user space that extend from each endpoint of the line perpendicular to the line itself. A positive value shall mean that the leader lines appear in the direction that is clockwise when traversing the line from its starting point to its ending point (as specified by L); a negative value shall indicate the opposite direction. Default value: 0 (no leader lines) """ return _PDFNetPython.LineAnnot_SetLeaderLineLength(self, length)
[docs] def GetLeaderLineExtensionLength(self): r""" Returns the leader line extension length of a line. :rtype: double :return: A number denoting the length of the leader line extension in default user space units. Notes: The leader line extension length is a non-negative number that shall represents the length of leader line extensions that extend from the line proper 180 degrees from the leader lines. Default value: 0 (no leader line extensions) """ return _PDFNetPython.LineAnnot_GetLeaderLineExtensionLength(self)
[docs] def SetLeaderLineExtensionLength(self, length): r""" Sets the leader line extension length of a line. (PDF 1.6) :type length: double :param length: A number denoting the length of the leader line extension in default user space units. Notes: The leader line extension length is a non-negative number that shall represents the length of leader line extensions that extend from the line proper 180 degrees from the leader lines. Default value: 0 (no leader line extensions) """ return _PDFNetPython.LineAnnot_SetLeaderLineExtensionLength(self, length)
[docs] def GetShowCaption(self): r""" Returns true if caption is to be shown, otherwise false. :rtype: boolean :return: A boolean value indicating whether the caption will be shown. Notes: If true, the text specified by the Contents or RCentries shall be replicated as a caption in the appearance of the line. The text shall be rendered in a manner appropriate to the content, taking into account factors such as writing direction. Default value: false. """ return _PDFNetPython.LineAnnot_GetShowCaption(self)
[docs] def SetShowCaption(self, showCaption): r""" Sets the option of whether to show caption. :type showCaption: boolean :param showCaption: A boolean value indicating whether the caption will be shown. Notes: If true, the text specified by the Contents or RC entries shall be replicated as a caption in the appearance of the line. The text shall be rendered in a manner appropriate to the content, taking into account factors such as writing direction. Default value: false. """ return _PDFNetPython.LineAnnot_SetShowCaption(self, showCaption)
e_LineArrow = _PDFNetPython.LineAnnot_e_LineArrow r""" Line is an arrow""" e_LineDimension = _PDFNetPython.LineAnnot_e_LineDimension r""" Line is a dimension""" e_null = _PDFNetPython.LineAnnot_e_null
[docs] def GetIntentType(self): r""" Returns the intent type of the line. :rtype: int :return: An intent type value from the "IntentType" enum. Notes: Intent type describes the intent of the line annotation. Valid values shall be "e_LineArrow", which means that the annotation is intended to function as an arrow, and "e_LineDimension", which means that the annotation is intended to function as a dimension line. """ return _PDFNetPython.LineAnnot_GetIntentType(self)
[docs] def SetIntentType(self, it): r""" Sets the intent type of the line. (For PDF 1.6) :type it: int :param it: An intent type value from the "IntentType" enum. Notes: Intent type describes the intent of the line annotation. Valid values shall be "e_LineArrow", which means that the annotation is intended to function as an arrow, and "e_LineDimension", which means that the annotation is intended to function as a dimension line. """ return _PDFNetPython.LineAnnot_SetIntentType(self, it)
[docs] def GetLeaderLineOffset(self): r""" Returns the leader line offset length of a line. :rtype: double :return: A number denoting the length of the leader line offset in default user space units. Notes: Leader line offset number is a non-negative number that shall represent the length of the leader line offset, which is the amount of empty space between the endpoints of the annotation and the beginning of the leader lines. """ return _PDFNetPython.LineAnnot_GetLeaderLineOffset(self)
[docs] def SetLeaderLineOffset(self, length): r""" Sets the leader line offset length of a line. (PDF 1.7) :type length: double :param length: A number denoting the length of the leader line offset in default user space units. Notes: Leader line offset number is a non-negative number that shall represent the length of the leader line offset, which is the amount of empty space between the endpoints of the annotation and the beginning of the leader lines. """ return _PDFNetPython.LineAnnot_SetLeaderLineOffset(self, length)
e_Inline = _PDFNetPython.LineAnnot_e_Inline r""" the caption shall be centered inside the line""" e_Top = _PDFNetPython.LineAnnot_e_Top r""" the caption shall be on top of the line"""
[docs] def GetCaptionPosition(self): r""" Returns the caption position of a line. :rtype: int :return: A cap position value from the "CapPos" enum. Notes: Caption position describes the annotation's caption positioning. Default value: Inline See also: CapPos """ return _PDFNetPython.LineAnnot_GetCaptionPosition(self)
[docs] def SetCaptionPosition(self, style): r""" Sets the caption position of a line. (Optional, PDF 1.7) :type style: int :param style: A caption position value from the "CapPos" enum. Notes: Caption position describes the annotation's caption positioning. Default value: Inline See also: CapPos """ return _PDFNetPython.LineAnnot_SetCaptionPosition(self, style)
[docs] def GetTextHOffset(self): r""" Returns the horizontal offset of the caption. :rtype: double :return: A number denoting the horizontal offset of the caption in default user space units. Notes: The horizontal offset specifies the offset of the caption text from the line's midpoint, with a positive value indicating offset to the right and a negative value indicating offset to the left. Default value: 0 (no offset from normal horizontal positioning). """ return _PDFNetPython.LineAnnot_GetTextHOffset(self)
[docs] def SetTextHOffset(self, offset): r""" Sets the horizontal offset of the caption. (For PDF 1.7 ) :type offset: double :param offset: A number denoting the horizontal offset of the caption in default user space units. Notes: The horizontal offset specifies the offset of the caption text from the line's midpoint, with a positive value indicating offset to the right and a negative value indicating offset to the left. Default value: 0 (no offset from normal horizontal positioning). """ return _PDFNetPython.LineAnnot_SetTextHOffset(self, offset)
[docs] def GetTextVOffset(self): r""" Returns the vertical offset of the caption. :rtype: double :return: A number denoting the vertical offset of the caption in default user space units. Notes: The vertical offset specifies the offset of the caption text perpendicular to the annotation line, with a positive value indicating a shift up and a negative value indicating a shift down. Default value: 0 (no offset from normal vertical positioning). """ return _PDFNetPython.LineAnnot_GetTextVOffset(self)
[docs] def SetTextVOffset(self, offset): r""" Sets the vertical offset of the caption. (For PDF 1.7 ) :type offset: double :param offset: A number denoting the vertical offset of the caption in default user space units. Notes: The vertical offset specifies the offset of the caption text perpendicular to the annotation line, with a positive value indicating a shift up and a negative value indicating a shift down. Default value: 0 (no offset from normal vertical positioning). """ return _PDFNetPython.LineAnnot_SetTextVOffset(self, offset)
def __init__(self, args): _PDFNetPython.LineAnnot_swiginit(self, _PDFNetPython.new_LineAnnot(args)) __swig_destroy__ = _PDFNetPython.delete_LineAnnot
# Register LineAnnot in _PDFNetPython: _PDFNetPython.LineAnnot_swigregister(LineAnnot)
[docs] def LineAnnot_Create(doc, pos): r""" Creates a new Line annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`LineAnnot` :return: A newly created blank Line annotation. """ return _PDFNetPython.LineAnnot_Create(doc, pos)
[docs] def LineAnnot_CreateAnnot(doc, pos): return _PDFNetPython.LineAnnot_CreateAnnot(doc, pos)
[docs] class FreeText(Markup): r""" A FreeText annotation (PDF 1.3) displays text directly on the page. Unlike an ordinary Text annotation, a FreeText annotation has no open or closed state; The content of the FreeText annotation is always visible instead of being displayed in a popup window. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new FreeText annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the FreeText annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the FreeText annotation's bounds in default user space units. :rtype: :py:class:`FreeText` :return: A newly created blank FreeText annotation. """ return _PDFNetPython.FreeText_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.FreeText_CreateAnnot(doc, pos)
[docs] def GetDefaultAppearance(self): r""" Returns the default appearance of the FreeText annotation. :rtype: string :return: A string representing the default appearance of the annotation. Notes: The default appearance string is used to format the text. The annotation dictionary's Appearance entry, if present, will take precedence over this entry. this method corresponds to the 'DA' entry in the annotation dictionary. """ return _PDFNetPython.FreeText_GetDefaultAppearance(self)
[docs] def SetDefaultAppearance(self, app_str): r""" Sets the default appearance of the FreeText annotation. :type app_str: string :param app_str: A string representing the default appearance of the annotation. Notes: The default appearance string is used to format the text. The annotation dictionary's Appearance entry, if present, will take precedence over this entry. this method corresponds to the 'DA' entry in the annotation dictionary. """ return _PDFNetPython.FreeText_SetDefaultAppearance(self, app_str)
[docs] def GetQuaddingFormat(self): r""" Returns the quading format of the FreeText annotation. (PDF 1.4) :rtype: int :return: A int (code) indicating the quading format of the FreeText annotation. Notes: The following are the quading formats corresponding to each int code. 0 Left-justified 1 Centered 2 Right-justified """ return _PDFNetPython.FreeText_GetQuaddingFormat(self)
[docs] def SetQuaddingFormat(self, format): r""" Sets the quading format of the FreeText annotation. (Optional; PDF 1.4) :type format: int :param format: A int code indicating the quading format of the FreeText annotation. Default value: 0 (left-justified). Notes: The int code specifies the form of quadding (justification) that shall be used in displaying the annotation's text: 0 Left-justified 1 Centered 2 Right-justified """ return _PDFNetPython.FreeText_SetQuaddingFormat(self, format)
[docs] def GetCalloutLinePoint1(self): r""" Returns the callout line points of the FreeText annotation. (PDF 1.6) :param p1: The target point. (where the ending style is used) :param p2: The ending point. :param p3: The knee point. :rtype: :py:class:`Point` :return: Three point objects if the line is bent or two point objects if the line is straight. Notes: If the line is straight, i.e. only has two points, two points will be returned in p1 and p2, and p3 will be the same as p2. The coordinates are given in default user space. """ return _PDFNetPython.FreeText_GetCalloutLinePoint1(self)
[docs] def GetCalloutLinePoint2(self): return _PDFNetPython.FreeText_GetCalloutLinePoint2(self)
[docs] def GetCalloutLinePoint3(self): return _PDFNetPython.FreeText_GetCalloutLinePoint3(self)
[docs] def SetCalloutLinePoints(self, args): r""" Overload 1: Sets the callout line points of the FreeText annotation. (Optional; meaningful only if IT is FreeTextCallout; PDF 1.6) :type p1: :py:class:`Point` :param p1: The target point. (where the ending style is used) :type p2: :py:class:`Point` :param p2: The knee point. :type p3: :py:class:`Point` :param p3: The ending point. Notes: The coordinates are defined in default user space. | Overload 2: Sets the callout line points of the FreeText annotation. (Optional; meaningful only if IT is FreeTextCallout; PDF 1.6) :type p1: :py:class:`Point` :param p1: The target point. (where the ending style is used) :type p2: :py:class:`Point` :param p2: The ending point. Notes: The coordinates are defined in default user space. """ return _PDFNetPython.FreeText_SetCalloutLinePoints(self, args)
e_FreeText = _PDFNetPython.FreeText_e_FreeText r"""The annotation intended to function as a plain FreeText annotation.""" e_FreeTextCallout = _PDFNetPython.FreeText_e_FreeTextCallout r"""The annotation is intended to function as a callout.""" e_FreeTextTypeWriter = _PDFNetPython.FreeText_e_FreeTextTypeWriter r"""The annotation is intended to function as a click-to-type or typewriter object and no callout line is drawn.""" e_Unknown = _PDFNetPython.FreeText_e_Unknown r"""User defined or Invalid."""
[docs] def GetIntentName(self): r""" Returns Intent name of the FreeText annotation. (PDF 1.4) :rtype: int :return: The intent name of the annotation as an entry from the enum "IntentName". """ return _PDFNetPython.FreeText_GetIntentName(self)
[docs] def SetIntentName(self, args): r""" Sets the Intent name of the FreeText annotation. (Optional; PDF 1.4) :type mode: int :param mode: The intent name of the annotation as an entry from the enum "IntentName". """ return _PDFNetPython.FreeText_SetIntentName(self, args)
[docs] def GetEndingStyle(self): r""" Returns the ending style of the callout line of the FreeText Annotation. :rtype: int :return: The ending style represented as one of the entries of the enum "EndingStyle" Notes: The ending style specifies the line ending style that shall be used in drawing the callout line specified in CallOut Line Points (CL). The enum entry shall specify the line ending style for the endpoint defined by the target point(p1) of the CallOut Line Points. Default value: e_None. """ return _PDFNetPython.FreeText_GetEndingStyle(self)
[docs] def SetEndingStyle(self, args): r""" Overload 1: Sets the ending style of the callout line of the FreeText Annotation. (Optional; meaningful only if CL is present; PDF 1.6) :type style: int :param style: The ending style represented using one of the entries of the enum "EndingStyle" Notes: The ending style specifies the line ending style that shall be used in drawing the callout line specified in CallOut Line Points (CL). The enum entry shall specify the line ending style for the endpoint defined by the target point(p1) of the CallOut Line Points. Default value: e_None. | Overload 2: Sets the ending style of the callout line of the FreeText Annotation. (Optional; meaningful only if CL is present; PDF 1.6) :type est: string :param est: The ending style represented using a string. Notes: The ending style specifies the line ending style that shall be used in drawing the callout line specified in CallOut Line Points (CL). The enum entry shall specify the line ending style for the endpoint defined by the target point(p1) of the CallOut Line Points. Default value: "None". """ return _PDFNetPython.FreeText_SetEndingStyle(self, args)
[docs] def SetTextColor(self, color, col_comp): r""" Sets the text color of the FreeText Annotation. :type color: :py:class:`ColorPt` :param color: ColorPt object representing the color. :type col_comp: int :param col_comp: number of colorant components in ColorPt object. Notes: Current implementation of this method creates a non-standard entry in the annotation dictionary and uses it to generate the appearance stream. Make sure you call RefreshAppearance() after changing text or line color, and remember that editing the annotation in other PDF applications will produce different appearance. """ return _PDFNetPython.FreeText_SetTextColor(self, color, col_comp)
[docs] def GetTextColor(self): r""" Returns the text color of the FreeText Annotation. Notes: Current implementation of this method uses a non-standard entry in the annotation dictionary and will not return meaningful results when called on annotations not created with PDFTron software. """ return _PDFNetPython.FreeText_GetTextColor(self)
[docs] def GetTextColorCompNum(self): return _PDFNetPython.FreeText_GetTextColorCompNum(self)
[docs] def SetLineColor(self, color, col_comp): r""" Sets the line and border color of the FreeText Annotation. :type color: :py:class:`ColorPt` :param color: ColorPt object representing the color. :type col_comp: int :param col_comp: number of colorant components in ColorPt object. Notes: Current implementation of this method creates a non-standard entry in the annotation dictionary and uses it to generate the appearance stream. Make sure you call RefreshAppearance() after changing text or line color, and remember that editing the annotation in other PDF applications will produce different appearance. """ return _PDFNetPython.FreeText_SetLineColor(self, color, col_comp)
[docs] def GetLineColor(self): r""" Returns the line and border color of the FreeText Annotation. :param color: reference to ColorPt object, where results will be saved. :param col_comp: reference to an integer, where number of colorant components will be written. Notes: Current implementation of this method uses a non-standard entry in the annotation dictionary and will not return meaningful results when called on annotations not created with PDFTron software. """ return _PDFNetPython.FreeText_GetLineColor(self)
[docs] def GetLineColorCompNum(self): return _PDFNetPython.FreeText_GetLineColorCompNum(self)
[docs] def SetFontName(self, fontName): r""" Sets the default appearance font name. :type fontName: string :param fontName: Set the default name name. """ return _PDFNetPython.FreeText_SetFontName(self, fontName)
[docs] def SetFontSize(self, font_size): r""" Sets the default appearance font size. A value of zero specifies that the font size should should adjust so that the text uses as much of the FreeText bounding box as possible. :type font_size: double :param font_size: Set the default font size. A value of zero means auto resize font. """ return _PDFNetPython.FreeText_SetFontSize(self, font_size)
[docs] def GetFontSize(self): r""" Get the default appearance font size. To get the actual font size used, call RefreshAppearance and then use ElementReader on the content stream of this annotation. :rtype: double :return: the default font size, where a value of zero indicates auto sizing. """ return _PDFNetPython.FreeText_GetFontSize(self)
def __init__(self, args): _PDFNetPython.FreeText_swiginit(self, _PDFNetPython.new_FreeText(args)) __swig_destroy__ = _PDFNetPython.delete_FreeText
# Register FreeText in _PDFNetPython: _PDFNetPython.FreeText_swigregister(FreeText)
[docs] def FreeText_Create(doc, pos): r""" Creates a new FreeText annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the FreeText annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the FreeText annotation's bounds in default user space units. :rtype: :py:class:`FreeText` :return: A newly created blank FreeText annotation. """ return _PDFNetPython.FreeText_Create(doc, pos)
[docs] def FreeText_CreateAnnot(doc, pos): return _PDFNetPython.FreeText_CreateAnnot(doc, pos)
# Register Link in _PDFNetPython: _PDFNetPython.Link_swigregister(Link)
[docs] class Movie(Annot): r""" A movie annotation contains animated graphics and sound to be presented on the computer screen and through the speakers. When the annotation is activated, the movie is played. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new Movie annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Movie annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Movie annotation's bounds in default user space units. :rtype: :py:class:`Movie` :return: A newly created blank Movie annotation. """ return _PDFNetPython.Movie_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.Movie_CreateAnnot(doc, pos)
[docs] def GetTitle(self): r""" Returns the title of the Movie Annotation. :rtype: string :return: A string representing the title of the Movie Annotation. Notes: Movie actions may use this title to reference the movie annotation. """ return _PDFNetPython.Movie_GetTitle(self)
[docs] def SetTitle(self, title): r""" Sets the title of the Movie Annotation. (Optional) :type title: string :param title: A string representing the title of the Movie Annotation. Notes: Movie actions may use this title to reference the movie annotation. """ return _PDFNetPython.Movie_SetTitle(self, title)
[docs] def IsToBePlayed(self): r""" Returns the option of whether the Movie is to be played. :rtype: boolean :return: a boolean value indicating if the movie is to be played. Notes: IsToBePlayed is a flag specifying whether to play the movie when the annotation is activated. The movie shall be played using default activation parameters. If the value is false, the movie shall not be played. Default value: true. """ return _PDFNetPython.Movie_IsToBePlayed(self)
[docs] def SetToBePlayed(self, isplay=True): r""" Sets the option of whether the Movie is to be played. (Optional) :type isplay: boolean :param isplay: A boolean value telling if the movie is to be played. Default value: true. Notes: IsToBePlayed is a flag specifying whether to play the movie when the annotation is activated. The movie shall be played using default activation parameters. If the value is false, the movie shall not be played. Default value: true. """ return _PDFNetPython.Movie_SetToBePlayed(self, isplay)
def __init__(self, args): _PDFNetPython.Movie_swiginit(self, _PDFNetPython.new_Movie(args)) __swig_destroy__ = _PDFNetPython.delete_Movie
# Register Movie in _PDFNetPython: _PDFNetPython.Movie_swigregister(Movie)
[docs] def Movie_Create(doc, pos): r""" Creates a new Movie annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Movie annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Movie annotation's bounds in default user space units. :rtype: :py:class:`Movie` :return: A newly created blank Movie annotation. """ return _PDFNetPython.Movie_Create(doc, pos)
[docs] def Movie_CreateAnnot(doc, pos): return _PDFNetPython.Movie_CreateAnnot(doc, pos)
[docs] class PolyLine(LineAnnot): r""" This header defines classes for the Polygon and PolyLine annotations. Polygon annotations (PDF 1.5) display closed polygons on the page. Such polygons may have any number of vertices connected by straight lines. Polyline annotations (PDF 1.5) are similar to polygons, except that the first and last vertex are not implicitly connected. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new PolyLine annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the PolyLine annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the PolyLine annotation's bounds in default user space units. :rtype: :py:class:`PolyLine` :return: A newly created blank PolyLine annotation. """ return _PDFNetPython.PolyLine_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.PolyLine_CreateAnnot(doc, pos)
[docs] def GetVertexCount(self): r""" Returns the number of vertices in the Vertices array. :rtype: int :return: the number of vertices. Notes: The Vertices are the points between which the lines are drawn. The viewer can draw either the straight lines or the smoothly connecting ones. """ return _PDFNetPython.PolyLine_GetVertexCount(self)
[docs] def GetVertex(self, idx): r""" Returns the vertex(as a Point object) corresponding to the index within the Vertices array. :type idx: int :param idx: The index of the vertex, should be less than the value returned by GetVertexCount(). :rtype: :py:class:`Point` :return: A Point object corresponding to the vertex in the specified index position. Notes: The Vertices are the points between which the lines are drawn. The viewer can draw either the straight lines or the smoothly connecting ones. """ return _PDFNetPython.PolyLine_GetVertex(self, idx)
[docs] def SetVertex(self, idx, pt): r""" Sets the vertex(in Point object form) corresponding to the index within the Vertices array. :type idx: int :param idx: The index of the vertex. :type pt: :py:class:`Point` :param pt: A Point object corresponding to the vertex to be added to the array. Notes: The Vertices are the points between which the lines are drawn. The viewer can draw either the straight lines or the smoothly connecting ones. """ return _PDFNetPython.PolyLine_SetVertex(self, idx, pt)
e_PolygonCloud = _PDFNetPython.PolyLine_e_PolygonCloud r""" The annotation is intended to function as a cloud object.""" e_PolyLineDimension = _PDFNetPython.PolyLine_e_PolyLineDimension r""" The polyline annotation is intended to function as a dimension. (PDF 1.7)""" e_PolygonDimension = _PDFNetPython.PolyLine_e_PolygonDimension r""" The polygon annotation is intended to function as a dimension. (PDF 1.7)""" e_Unknown = _PDFNetPython.PolyLine_e_Unknown r""" Non-standard intent type"""
[docs] def GetIntentName(self): r""" Returns the intent name as a value of the "IntentName" enumeration type. :rtype: int :return: The intent type of the annotation. See also: IntentType """ return _PDFNetPython.PolyLine_GetIntentName(self)
[docs] def SetIntentName(self, mode): r""" Sets the Intent name as a value of the "IntentName" enumeration type. (Optional; PDF 1.6 ) :type mode: int :param mode: The intent name of the annotation. See also: IntentType """ return _PDFNetPython.PolyLine_SetIntentName(self, mode)
def __init__(self, args): _PDFNetPython.PolyLine_swiginit(self, _PDFNetPython.new_PolyLine(args)) __swig_destroy__ = _PDFNetPython.delete_PolyLine
# Register PolyLine in _PDFNetPython: _PDFNetPython.PolyLine_swigregister(PolyLine)
[docs] def PolyLine_Create(doc, pos): r""" Creates a new PolyLine annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the PolyLine annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the PolyLine annotation's bounds in default user space units. :rtype: :py:class:`PolyLine` :return: A newly created blank PolyLine annotation. """ return _PDFNetPython.PolyLine_Create(doc, pos)
[docs] def PolyLine_CreateAnnot(doc, pos): return _PDFNetPython.PolyLine_CreateAnnot(doc, pos)
[docs] class Polygon(PolyLine): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new Polygon annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Polygon annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Polygon annotation's bounds in default user space units. :rtype: :py:class:`Polygon` :return: A newly created blank Polygon annotation. """ return _PDFNetPython.Polygon_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.Polygon_CreateAnnot(doc, pos)
def __init__(self, args): _PDFNetPython.Polygon_swiginit(self, _PDFNetPython.new_Polygon(args)) __swig_destroy__ = _PDFNetPython.delete_Polygon
# Register Polygon in _PDFNetPython: _PDFNetPython.Polygon_swigregister(Polygon)
[docs] def Polygon_Create(doc, pos): r""" Creates a new Polygon annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Polygon annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Polygon annotation's bounds in default user space units. :rtype: :py:class:`Polygon` :return: A newly created blank Polygon annotation. """ return _PDFNetPython.Polygon_Create(doc, pos)
[docs] def Polygon_CreateAnnot(doc, pos): return _PDFNetPython.Polygon_CreateAnnot(doc, pos)
[docs] class RedactionAnnot(Markup): r""" A redaction annotation (PDF 1.7) identifies content that is intended to be removed from the document. The intent of redaction annotations is to enable the following: a)Content identification. A user applies redact annotations that specify the pieces or regions of content that should be removed. Up until the next step is performed, the user can see, move and redefine these annotations. b)Content removal. The user instructs the viewer application to apply the redact annotations, after which the content in the area specified by the redact annotations is removed. In the removed content's place, some marking appears to indicate the area has been redacted. Also, the redact annotations are removed from the PDF document. Redaction annotations provide a mechanism for the first step in the redaction process (content identification). This allows content to be marked for redaction in a non-destructive way, thus enabling a review process for evaluating potential redactions prior to removing the specified content. Redaction annotations shall provide enough information to be used in the second phase of the redaction process (content removal). This phase is application-specific and requires the conforming reader to remove all content identified by the redaction annotation, as well as the annotation itself. Conforming readers that support redaction annotations shall provide a mechanism for applying content removal, and they shall remove all traces of the specified content. If a portion of an image is contained in a redaction region, that portion of the image data shall be destroyed; clipping or image masks shall not be used to hide that data. Such conforming readers shall also be diligent in their consideration of all content that can exist in a PDF document, including XML Forms Architecture (XFA) content and Extensible Metadata Platform (XMP) content. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new Redaction annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, in user space coordinates. :rtype: :py:class:`RedactionAnnot` :return: A newly created blank Circle annotation. """ return _PDFNetPython.RedactionAnnot_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.RedactionAnnot_CreateAnnot(doc, pos)
[docs] def GetQuadPointCount(self): r""" Returns the number of QuadPoints in the QuadPoints array of the Redaction annotation. :rtype: int :return: The number of QuadPoints. Notes: An array of n QuadPoints that denote the content region that is intended to be removed. If quad points are not present, the Rect entry denotes the content region that is intended to be removed. """ return _PDFNetPython.RedactionAnnot_GetQuadPointCount(self)
[docs] def GetQuadPoint(self, idx): r""" Returns the QuadPoint located at a certain index of the QuadPoint array of the Redaction annotation. :type idx: int :param idx: The index of the QuadPoint, starts at zero and must be less than return value of GetQuadPointCount(). :rtype: :py:class:`QuadPoint` :return: The QuadPoint located at a certain index of the QuadPoint array of the Redaction annotation. Notes: An array of n QuadPoints that denote the content region that is intended to be removed. If quad points are not present, the Rect entry denotes the content region that is intended to be removed. """ return _PDFNetPython.RedactionAnnot_GetQuadPoint(self, idx)
[docs] def SetQuadPoint(self, idx, qp): r""" Set the QuadPoint to be located at a certain index of the QuadPoint array of the Redaction annotation. (Optional; PDF 1.6 ) :type idx: int :param idx: The index position where the QuadPoint of interest is to be inserted, starting at 0. :type qp: :py:class:`QuadPoint` :param qp: The QuadPoint to be inserted at that position. Notes: For orientation purposes, the bottom of a quadrilateral is the line formed by p1 and p2 of the QuadPoint. QuadPoints shall be ignored if any coordinate in the array lies outside the region specified by Rect. """ return _PDFNetPython.RedactionAnnot_SetQuadPoint(self, idx, qp)
[docs] def GetAppFormXO(self): r""" Returns Overlay appearance of the Redaction annotation. :rtype: :py:class:`Obj` :return: An SDF object that represents the overlay appearance of the Redaction annotation. Notes: This object is a form XObject specifying the overlay appearance for this redaction annotation. After this redaction is applied and the affected content has been removed, the overlay appearance should be drawn such that its origin lines up with the lower-left corner of the annotation rectangle. This form XObject is not necessarily related to other annotation appearances, and may or may not be present in the Appearance dictionary. This entry takes precedence over the Interior Color(IC), OverlayText, OverlayTextAppearance(DA), and QuadPoint(Q) entries. """ return _PDFNetPython.RedactionAnnot_GetAppFormXO(self)
[docs] def SetAppFormXO(self, formxo): r""" Sets Overlay appearance of the Redaction annotation. (Optional) :type formxo: :py:class:`Obj` :param formxo: An SDF object that represents the overlay appearance of the Redaction annotation. Notes: This object is a form XObject specifying the overlay appearance for this redaction annotation. After this redaction is applied and the affected content has been removed, the overlay appearance should be drawn such that its origin lines up with the lower-left corner of the annotation rectangle. This form XObject is not necessarily related to other annotation appearances, and may or may not be present in the Appearance dictionary. This entry takes precedence over the Interior Color(IC), OverlayText, OverlayTextAppearance(DA), and QuadPoint(Q) entries. """ return _PDFNetPython.RedactionAnnot_SetAppFormXO(self, formxo)
[docs] def GetOverlayText(self): r""" Returns Overlay text of the Redaction annotation. :rtype: string :return: A string containing the overlay text of the annotation. Notes: The OverlayText string is a text string specifying the overlay text that should be drawn over the redacted region after the affected content has been removed. This entry is ignored if the Overlay appearance(RO) entry is present. """ return _PDFNetPython.RedactionAnnot_GetOverlayText(self)
[docs] def SetOverlayText(self, title): r""" Sets Overlay text of the Redaction annotation. :type title: string :param title: A string containing the overlay text of the annotation. Notes: The OverlayText string is a text string specifying the overlay text that should be drawn over the redacted region after the affected content has been removed. This entry is ignored if the Overlay appearance stream (RO) entry is present. """ return _PDFNetPython.RedactionAnnot_SetOverlayText(self, title)
[docs] def GetUseRepeat(self): r""" Returns the option of whether to use repeat for the Redaction annotation. :rtype: boolean :return: A bool indicating whether to repeat for the Redaction annotation. Notes: If userepeat value is true, then the text specified by OverlayText should be repeated to fill the redacted region after the affected content has been removed. This entry is ignored if the Overlay appearance stream (RO) entry is present. Default value: false. """ return _PDFNetPython.RedactionAnnot_GetUseRepeat(self)
[docs] def SetUseRepeat(self, userepeat=False): r""" Sets the option of whether to use repeat for the Redaction annotation. :type userepeat: boolean :param userepeat: A bool indicating whether to repeat for the Redaction annotation. Notes: If userepeat value is true, then the text specified by OverlayText should be repeated to fill the redacted region after the affected content has been removed. This entry is ignored if the Overlay appearance stream (RO) entry is present. userepeat = false. """ return _PDFNetPython.RedactionAnnot_SetUseRepeat(self, userepeat)
[docs] def GetOverlayTextAppearance(self): r""" Returns Overlay text appearance of the Redaction annotation. :rtype: string :return: A string containing the overlay text appearance of the annotation. Notes: The overlay text appearance is the appearance string to be used in formatting the overlay text when it is drawn after the affected content has been removed. This entry is ignored if the Overlay appearance stream (RO) entry is present. """ return _PDFNetPython.RedactionAnnot_GetOverlayTextAppearance(self)
[docs] def SetOverlayTextAppearance(self, app): r""" Sets Overlay text appearance of the Redaction annotation. :type app: string :param app: A string containing the overlay text appearance of the annotation. Notes: The overlay text appearance is the appearance string to be used in formatting the overlay text when it is drawn after the affected content has been removed. This entry is ignored if the Overlay appearance stream (RO) entry is present. """ return _PDFNetPython.RedactionAnnot_SetOverlayTextAppearance(self, app)
e_LeftJustified = _PDFNetPython.RedactionAnnot_e_LeftJustified r""" Overlay text is left justified""" e_Centered = _PDFNetPython.RedactionAnnot_e_Centered r""" Overlay text is centered""" e_RightJustified = _PDFNetPython.RedactionAnnot_e_RightJustified r""" Overlay text is right justified""" e_None = _PDFNetPython.RedactionAnnot_e_None r""" No justification to the overlay text."""
[docs] def GetQuadForm(self): r""" Returns Overlay text quadding(justification) format of the Redaction annotation. :rtype: int :return: A value of the "QuadForm" enum type, indicating the overlay text quadding(justification) format of the Redaction annotation's overlay text. """ return _PDFNetPython.RedactionAnnot_GetQuadForm(self)
[docs] def SetQuadForm(self, args): r""" Sets Overlay text quadding (justification) format of the Redaction annotation. :type form: int :param form: A value of the "QuadForm" enum type, indicating the overlay text quadding(justification) format of the Redaction annotation. Notes: Quadding format specifies the form of justification to be used in displaying the overlay text. form=e_LeftJustified """ return _PDFNetPython.RedactionAnnot_SetQuadForm(self, args)
def __init__(self, args): _PDFNetPython.RedactionAnnot_swiginit(self, _PDFNetPython.new_RedactionAnnot(args)) __swig_destroy__ = _PDFNetPython.delete_RedactionAnnot
# Register RedactionAnnot in _PDFNetPython: _PDFNetPython.RedactionAnnot_swigregister(RedactionAnnot)
[docs] def RedactionAnnot_Create(doc, pos): r""" Creates a new Redaction annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, in user space coordinates. :rtype: :py:class:`RedactionAnnot` :return: A newly created blank Circle annotation. """ return _PDFNetPython.RedactionAnnot_Create(doc, pos)
[docs] def RedactionAnnot_CreateAnnot(doc, pos): return _PDFNetPython.RedactionAnnot_CreateAnnot(doc, pos)
[docs] class RubberStamp(Markup): r""" A RubberStamp annotation displays text or graphics intended to look as if they were stamped on the page with a rubber stamp. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_Approved = _PDFNetPython.RubberStamp_e_Approved r"""a stamp with the text "Approved".""" e_Experimental = _PDFNetPython.RubberStamp_e_Experimental r"""a stamp with the text "Experimental".""" e_NotApproved = _PDFNetPython.RubberStamp_e_NotApproved r"""a stamp with the text "Not Approved".""" e_AsIs = _PDFNetPython.RubberStamp_e_AsIs r"""a stamp with the text "As Is".""" e_Expired = _PDFNetPython.RubberStamp_e_Expired r"""a stamp with the text "Expired".""" e_NotForPublicRelease = _PDFNetPython.RubberStamp_e_NotForPublicRelease r"""a stamp with the text "Not For Public Release".""" e_Confidential = _PDFNetPython.RubberStamp_e_Confidential r"""a stamp with the text "Confidential".""" e_Final = _PDFNetPython.RubberStamp_e_Final r"""a stamp with the text "Final".""" e_Sold = _PDFNetPython.RubberStamp_e_Sold r"""a stamp with the text "Sold".""" e_Departmental = _PDFNetPython.RubberStamp_e_Departmental r"""a stamp with the text "Departmental".""" e_ForComment = _PDFNetPython.RubberStamp_e_ForComment r"""a stamp with the text "For Comment".""" e_TopSecret = _PDFNetPython.RubberStamp_e_TopSecret r"""a stamp with the text "Top Secret".""" e_ForPublicRelease = _PDFNetPython.RubberStamp_e_ForPublicRelease r"""a stamp with the text "For Public Release".""" e_Draft = _PDFNetPython.RubberStamp_e_Draft r"""a stamp with the text "Draft".""" e_Unknown = _PDFNetPython.RubberStamp_e_Unknown r""" Non-standard or user defined stamp."""
[docs] @staticmethod def Create(args): r""" Overload 1: Creates a new RubberStamp annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`RubberStamp` :return: A newly created blank RubberStamp annotation. | Overload 2: Creates a new RubberStamp annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :type form_xobject: :py:class:`Obj` :param form_xobject: An object specifying a custom appearance for the annotation, containing TEXT as string (mandatory): The text to be displayed in rubber stamp TEXT_BELOW as string (optional): The text to be displayed below the first text FILL_COLOR as an array of three or four numbers between 0.0 to 1.0 (optional): The fill color TEXT_COLOR as an array of three or four numbers between 0.0 to 1.0 (optional): The text color BORDER_COLOR as an array of three or four numbers between 0.0 to 1.0 (optional): The border color FILL_COLOR_START as an array of three or four numbers between 0.0 to 1.0 (optional): The start fill color if background is gradient FILL_COLOR_END as an array of three or four numbers between 0.0 to 1.0 (optional): The end fill color if background is gradient FILL_OPACITY as a number (optional): the fill opacity TEXT_OPACITY as a number (optional): the text opacity ROTATION as a number (optional): rotation. valid numbers are {0, 90, 180, 270} POINTING_LEFT as a boolean (optional): if the stamp is pointing left POINTING_RIGHT as a boolean (optional): if the stamp is pointing right :rtype: :py:class:`RubberStamp` :return: A newly created RubberStamp annotation. """ return _PDFNetPython.RubberStamp_Create(args)
[docs] @staticmethod def CreateAnnot(args): return _PDFNetPython.RubberStamp_CreateAnnot(args)
[docs] def GetIcon(self): r""" Returns the type of the icon associated with the RubberStamp annotation. :rtype: int :return: A value of enum "Icon" that represents the type of icon associated with the annotation. Default value: e_Draft. """ return _PDFNetPython.RubberStamp_GetIcon(self)
[docs] def GetIconName(self): r""" Returns the name of the icon associated with the RubberStamp annotation. :rtype: string :return: A string that is the name of the icon associated with the RubberStamp annotation. Notes: The following icon names are equivalent to predefined icon types from the enum "Icon": "Approved" = e_Approved "Experimental" = e_Experimental "NotApproved" = e_NotApproved "AsIs" = e_AsIs "Expired" = e_Expired "NotForPublicRelease" = e_NotForPublicRelease "Confidential" = e_Confidential "Final" = e_Final "Sold" = e_Sold "Departmental" = e_Departmental "Format" = e_ForComment "TopSecret" = e_TopSecret "ForPublicRelease" = e_ForPublicRelease "Draft" = e_Draft "Unknown" = e_Unknown Names other than mentioned above do not have predefined icon appearances. """ return _PDFNetPython.RubberStamp_GetIconName(self)
[docs] def SetIcon(self, args): r""" Overload 1: Sets the type of the icon associated with the RubberStamp annotation. :type type: int :param type: A value of enum "Icon" type that represents the type of icon associated with the annotation. Default value: e_Draft. | Overload 2: Sets the name of the icon associated with the RubberStamp annotation. :param iconstring: the name of the icon associated with the RubberStamp annotation. Notes: The following icon names are equivalent to predefined icon types from the enum "Icon": "Approved" = e_Approved "Experimental" = e_Experimental "NotApproved" = e_NotApproved "AsIs" = e_AsIs "Expired" = e_Expired "NotForPublicRelease" = e_NotForPublicRelease "Confidential" = e_Confidential "Final" = e_Final "Sold" = e_Sold "Departmental" = e_Departmental "Format" = e_ForComment "TopSecret" = e_TopSecret "ForPublicRelease" = e_ForPublicRelease "Draft" = e_Draft "Unknown" = e_Unknown Names other than mentioned above do not have predefined icon appearances. """ return _PDFNetPython.RubberStamp_SetIcon(self, args)
[docs] def SetOpacity(self, opacity): r""" Updates the appearance of the stamp with the given opacity value Opacity value does not accumulate in case of subsequent calls - i.e. last call sets the final opacity """ return _PDFNetPython.RubberStamp_SetOpacity(self, opacity)
def __init__(self, args): _PDFNetPython.RubberStamp_swiginit(self, _PDFNetPython.new_RubberStamp(args)) __swig_destroy__ = _PDFNetPython.delete_RubberStamp
# Register RubberStamp in _PDFNetPython: _PDFNetPython.RubberStamp_swigregister(RubberStamp)
[docs] def RubberStamp_Create(args): r""" Overload 1: Creates a new RubberStamp annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`RubberStamp` :return: A newly created blank RubberStamp annotation. | Overload 2: Creates a new RubberStamp annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :type form_xobject: :py:class:`Obj` :param form_xobject: An object specifying a custom appearance for the annotation, containing TEXT as string (mandatory): The text to be displayed in rubber stamp TEXT_BELOW as string (optional): The text to be displayed below the first text FILL_COLOR as an array of three or four numbers between 0.0 to 1.0 (optional): The fill color TEXT_COLOR as an array of three or four numbers between 0.0 to 1.0 (optional): The text color BORDER_COLOR as an array of three or four numbers between 0.0 to 1.0 (optional): The border color FILL_COLOR_START as an array of three or four numbers between 0.0 to 1.0 (optional): The start fill color if background is gradient FILL_COLOR_END as an array of three or four numbers between 0.0 to 1.0 (optional): The end fill color if background is gradient FILL_OPACITY as a number (optional): the fill opacity TEXT_OPACITY as a number (optional): the text opacity ROTATION as a number (optional): rotation. valid numbers are {0, 90, 180, 270} POINTING_LEFT as a boolean (optional): if the stamp is pointing left POINTING_RIGHT as a boolean (optional): if the stamp is pointing right :rtype: :py:class:`RubberStamp` :return: A newly created RubberStamp annotation. """ return _PDFNetPython.RubberStamp_Create(args)
[docs] def RubberStamp_CreateAnnot(args): return _PDFNetPython.RubberStamp_CreateAnnot(args)
[docs] class Screen(Annot): r""" A screen annotation (PDF 1.5) specifies a region of a page upon which media clips may be played. It also serves as an object from which actions can be triggered. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new Screen annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`Screen` :return: A newly created blank Screen annotation. """ return _PDFNetPython.Screen_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.Screen_CreateAnnot(doc, pos)
[docs] def GetTitle(self): r""" Returns the title of the annotation. :rtype: string :return: A string representing the title of the annotation. """ return _PDFNetPython.Screen_GetTitle(self)
[docs] def SetTitle(self, title): r""" Sets the title of the Annotation. (Optional) :type title: string :param title: A string representing the title of the annotation. """ return _PDFNetPython.Screen_SetTitle(self, title)
[docs] def GetAction(self): r""" Returns the action of the Screen annotation :rtype: :py:class:`Action` :return: An action object representing the action of the annotation. Notes: The action is an action that shall be performed when the annotation is activated. """ return _PDFNetPython.Screen_GetAction(self)
[docs] def SetAction(self, action): r""" Sets the action of the Screen annotation (Optional; PDF 1.1 ) :type action: :py:class:`Action` :param action: An action object representing the action of the annotation. Notes: The action is an action that shall be performed when the annotation is activated. """ return _PDFNetPython.Screen_SetAction(self, action)
[docs] def GetBorderColorCompNum(self): r""" Returns the number indicating border color space of the annotation. :rtype: int :return: An integer indicating a color space value from the ColorSpace::Type enum. That is, 1 corresponding to "e_device_gray", 3 corresponding to "e_device_rgb", and 4 corresponding to "e_device_cmyk". 0 means this annotation had no color assigned. """ return _PDFNetPython.Screen_GetBorderColorCompNum(self)
[docs] def GetBorderColor(self): r""" Returns the border color of the annotation. :rtype: :py:class:`ColorPt` :return: A color object that denotes the color of the Screen border. Notes: The color can be in different color spaces: Gray, RGB, or CMYK. Call "GetBorderColorCompNum" to access the color space information corresponding to the border color. """ return _PDFNetPython.Screen_GetBorderColor(self)
[docs] def SetBorderColor(self, col, numcomp): r""" Sets the border color of the annotation. (Optional) :type col: :py:class:`ColorPt` :param col: A color object that denotes the color of the screen border. :type numcomp: int :param numcomp: An integer which value indicates the color space used for the parameter c. """ return _PDFNetPython.Screen_SetBorderColor(self, col, numcomp)
[docs] def GetBackgroundColorCompNum(self): r""" Returns the number indicating background color space of the annotation. :rtype: int :return: An integer indicating a color space value from the ColorSpace::Type enum. That is, 1 corresponding to "e_device_gray", 3 corresponding to "e_device_rgb", and 4 corresponding to "e_device_cmyk" if color space is applicable, 0 means no background color was assigned. """ return _PDFNetPython.Screen_GetBackgroundColorCompNum(self)
[docs] def GetBackgroundColor(self): r""" Returns the background color of the annotation. :rtype: :py:class:`ColorPt` :return: A color object that denotes the color of the Screen background. Notes: The color can be in different color spaces: Gray, RGB, or CMYK. Call "GetBackgroundColorCompNum" to access the color space information corresponding to the border color. """ return _PDFNetPython.Screen_GetBackgroundColor(self)
[docs] def SetBackgroundColor(self, col, numcomp): r""" Sets the background color of the annotation. (Optional) :type col: :py:class:`ColorPt` :param col: A color point that denotes the color of the screen background. :type numcomp: int :param numcomp: An integer which value indicates the color space used for the parameter c. """ return _PDFNetPython.Screen_SetBackgroundColor(self, col, numcomp)
[docs] def GetStaticCaptionText(self): r""" Returns static caption text of the annotation. :rtype: string :return: A string containing the static caption text of the annotation. Notes: The static caption is the annotation's normal caption, which shall be displayed when it is not interacting with the user. """ return _PDFNetPython.Screen_GetStaticCaptionText(self)
[docs] def SetStaticCaptionText(self, contents): r""" Sets static caption text of the annotation. (Optional; button fields only) :type contents: string :param contents: A string containing the static caption text of the annotation. Notes: The static caption is the annotation's normal caption, which shall be displayed when it is not interacting with the user. """ return _PDFNetPython.Screen_SetStaticCaptionText(self, contents)
[docs] def GetRolloverCaptionText(self): r""" Returns the rollover caption text of the annotation. :rtype: string :return: A string containing the rollover caption text of the annotation. Notes: The rollover caption shall be displayed when the user rolls the cursor into its active area without pressing the mouse button. """ return _PDFNetPython.Screen_GetRolloverCaptionText(self)
[docs] def SetRolloverCaptionText(self, contents): r""" Sets the roll over caption text of the annotation. (Optional; button fields only) :type contents: string :param contents: A string containing the roll over caption text of the annotation. Notes: The rollover caption shall be displayed when the user rolls the cursor into its active area without pressing the mouse button. """ return _PDFNetPython.Screen_SetRolloverCaptionText(self, contents)
[docs] def GetMouseDownCaptionText(self): r""" Returns the button down caption text of the annotation. :rtype: string :return: A string containing the button down text of the annotation. Notes: The button down caption shall be displayed when the mouse button is pressed within its active area. """ return _PDFNetPython.Screen_GetMouseDownCaptionText(self)
[docs] def SetMouseDownCaptionText(self, contents): r""" Sets the button down caption text of the annotation. (Optional; button fields only) :type contents: string :param contents: A string containing the button down text of the annotation. Notes: The button down caption shall be displayed when the mouse button is pressed within its active area. """ return _PDFNetPython.Screen_SetMouseDownCaptionText(self, contents)
[docs] def GetStaticIcon(self): r""" Returns the static icon associated with the annotation. :rtype: :py:class:`Obj` :return: An SDF object that represents the static icon associated with the annotation. Notes: The static icon object is a form XObject defining the annotation's normal icon, which shall be displayed when it is not interacting with the user. """ return _PDFNetPython.Screen_GetStaticIcon(self)
[docs] def SetStaticIcon(self, icon): r""" Sets the static icon associated with the annotation. (Optional; button fields only) :type icon: :py:class:`Obj` :param icon: An SDF object that represents the static icon associated with the annotation. Notes: The static icon object is a form XObject defining the annotation's normal icon, which shall be displayed when it is not interacting with the user. """ return _PDFNetPython.Screen_SetStaticIcon(self, icon)
[docs] def GetRolloverIcon(self): r""" Returns the rollover icon associated with the annotation. :rtype: :py:class:`Obj` :return: An SDF object that represents the rollover icon associated with the annotation. Notes: The rollover icon object is a form XObject defining the annotation's rollover icon, which shall be displayed when the user rolls the cursor into its active area without pressing the mouse button. """ return _PDFNetPython.Screen_GetRolloverIcon(self)
[docs] def SetRolloverIcon(self, icon): r""" Sets the rollover icon associated with the annotation. (Optional; button fields only) :type icon: :py:class:`Obj` :param icon: An SDF object that represents the rollover icon associated with the annotation. Notes: The rollover icon object is a form XObject defining the annotation's rollover icon, which shall be displayed when the user rolls the cursor into its active area without pressing the mouse button. """ return _PDFNetPython.Screen_SetRolloverIcon(self, icon)
[docs] def GetMouseDownIcon(self): r""" Returns the Mouse Down icon associated with the annotation. :rtype: :py:class:`Obj` :return: An SDF object that represents the Mouse Down icon associated with the annotation. Notes: The Mouse Down icon object is a form XObject defining the annotation's alternate (down) icon, which shall be displayed when the mouse button is pressed within its active area. """ return _PDFNetPython.Screen_GetMouseDownIcon(self)
[docs] def SetMouseDownIcon(self, icon): r""" Sets the Mouse Down icon associated with the annotation. (Optional; button fields only) :type icon: :py:class:`Obj` :param icon: An SDF object that represents the Mouse Down icon associated with the annotation. Notes: The Mouse Down icon object is a form XObject defining the annotation's alternate (down) icon, which shall be displayed when the mouse button is pressed within its active area. """ return _PDFNetPython.Screen_SetMouseDownIcon(self, icon)
e_NoIcon = _PDFNetPython.Screen_e_NoIcon e_NoCaption = _PDFNetPython.Screen_e_NoCaption e_CBelowI = _PDFNetPython.Screen_e_CBelowI e_CAboveI = _PDFNetPython.Screen_e_CAboveI e_CRightILeft = _PDFNetPython.Screen_e_CRightILeft e_CLeftIRight = _PDFNetPython.Screen_e_CLeftIRight e_COverlayI = _PDFNetPython.Screen_e_COverlayI
[docs] def GetIconCaptionRelation(self): r""" Returns the Icon and caption relationship of the annotation. :rtype: int :return: A value of the "IconCaptionRelation" enum type. Default value: e_NoIcon. See also: IconCaptionRelation """ return _PDFNetPython.Screen_GetIconCaptionRelation(self)
[docs] def SetIconCaptionRelation(self, icr): r""" Sets the Icon and caption relationship of the annotation. (Optional; pushbutton fields only) :type icr: int :param icr: A value of the "IconCaptionRelation" enum type. Default value: e_NoIcon. See also: IconCaptionRelation """ return _PDFNetPython.Screen_SetIconCaptionRelation(self, icr)
e_Always = _PDFNetPython.Screen_e_Always r""" Always scale""" e_WhenBigger = _PDFNetPython.Screen_e_WhenBigger r""" Scale only when the icon is bigger than the annotation rectangle""" e_WhenSmaller = _PDFNetPython.Screen_e_WhenSmaller r""" Scale only when the icon is smaller than the annotation rectangle""" e_Never = _PDFNetPython.Screen_e_Never r""" Never scale"""
[docs] def GetScaleCondition(self): r""" Returns the condition under which the icon should be scaled. :rtype: int :return: A value of the "ScaleCondition" enum type. Default value: e_Always. See also: ScaleCondition """ return _PDFNetPython.Screen_GetScaleCondition(self)
[docs] def SetScaleCondition(self, sc): r""" Sets the condition under which the icon should be scaled. (Optional) :type sc: int :param sc: A value of the "ScaleCondition" enum type. Default value: e_Always. """ return _PDFNetPython.Screen_SetScaleCondition(self, sc)
e_Anamorphic = _PDFNetPython.Screen_e_Anamorphic e_Proportional = _PDFNetPython.Screen_e_Proportional
[docs] def GetScaleType(self): r""" Returns the Scale Type of the annotation. :rtype: int :return: A value of the "ScaleType" enum which represents the Scale Type of the annotation. Default value: P. See also: ScaleType """ return _PDFNetPython.Screen_GetScaleType(self)
[docs] def SetScaleType(self, st): r""" Sets the Scale Type of the annotation. (Optional) :type st: int :param st: An entry of the "ScaleType" enum which represents the Scale Type of the annotation. Default value: P. See also: ScaleType """ return _PDFNetPython.Screen_SetScaleType(self, st)
[docs] def GetHIconLeftOver(self): r""" Returns the horizontal leftover space of the icon within the annotation. :rtype: double :return: A number indicating the horizontal leftover space of the icon within the annotation. Notes: the horizontal leftover is a number that shall be between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the left. A value of 0.0 shall position the icon at the left of the annotation rectangle. A value of 0.5 shall center it in the horizontal direction within the rectangle. This entry shall be used only if the icon is scaled proportionally. Default value: 0.5. """ return _PDFNetPython.Screen_GetHIconLeftOver(self)
[docs] def SetHIconLeftOver(self, hl): r""" Sets the horizontal leftover space of the icon within the annotation. (Optional) :type hl: double :param hl: A number indicating the horizontal leftover space of the icon within the annotation. Notes: the horizontal leftover space is a number that shall be between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the left. A value of 0.0 shall position the icon at the left of the annotation rectangle. A value of 0.5 shall center it in the horizontal direction within the rectangle. This entry shall be used only if the icon is scaled proportionally. Default value: 0.5. """ return _PDFNetPython.Screen_SetHIconLeftOver(self, hl)
[docs] def GetVIconLeftOver(self): r""" Returns the vertical leftover space of the icon within the annotation. :rtype: double :return: a number indicating the vertical leftover space of the icon within the annotation. Notes: the vertical leftover space is a number that shall be between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the bottom of the icon. A value of 0.0 shall position the icon at the bottom of the annotation rectangle. A value of 0.5 shall center it in the vertical direction within the rectangle. This entry shall be used only if the icon is scaled proportionally. Default value: 0.5. """ return _PDFNetPython.Screen_GetVIconLeftOver(self)
[docs] def SetVIconLeftOver(self, vl): r""" Sets the vertical leftover space of the icon within the annotation. (Optional) :type vl: double :param vl: A number indicating the vertical leftover space of the icon within the annotation. Notes: the vertical leftover space is a number that shall be between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the bottom of the icon. A value of 0.0 shall position the icon at the bottom of the annotation rectangle. A value of 0.5 shall center it in the vertical direction within the rectangle. This entry shall be used only if the icon is scaled proportionally. Default value: 0.5. """ return _PDFNetPython.Screen_SetVIconLeftOver(self, vl)
[docs] def GetFitFull(self): r""" Returns the "fit full" flag. :rtype: boolean :return: A boolean value indicating the "fit full" flag value. Notes: the fit full flag, if true, indicates that the button appearance shall be scaled to fit fully within the bounds of the annotation without taking into consideration the line width of the border. Default value: false. """ return _PDFNetPython.Screen_GetFitFull(self)
[docs] def SetFitFull(self, ff): r""" Sets the "fit full" flag. (Optional) :type ff: boolean :param ff: A boolean value indicating the "fit full" flag value. Notes: the fit full flag, if true, indicates that the button appearance shall be scaled to fit fully within the bounds of the annotation without taking into consideration the line width of the border. Default value: false. """ return _PDFNetPython.Screen_SetFitFull(self, ff)
def __init__(self, args): _PDFNetPython.Screen_swiginit(self, _PDFNetPython.new_Screen(args)) __swig_destroy__ = _PDFNetPython.delete_Screen
# Register Screen in _PDFNetPython: _PDFNetPython.Screen_swigregister(Screen)
[docs] def Screen_Create(doc, pos): r""" Creates a new Screen annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`Screen` :return: A newly created blank Screen annotation. """ return _PDFNetPython.Screen_Create(doc, pos)
[docs] def Screen_CreateAnnot(doc, pos): return _PDFNetPython.Screen_CreateAnnot(doc, pos)
[docs] class Sound(Markup): r""" A Sound annotation represents a sound recording attached to a point in the PDF document. When closed, this annotation appear as an icon; when open and activated, a sound record from the computer's microphone or imported from a file associated with this annotation is played.The icon of this annotation by default is a speaker. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_Speaker = _PDFNetPython.Sound_e_Speaker r""" Speaker sound""" e_Mic = _PDFNetPython.Sound_e_Mic r""" Mic sound""" e_Unknown = _PDFNetPython.Sound_e_Unknown r""" Invalid or non-standard"""
[docs] @staticmethod def CreateWithData(args): r""" Creates a new Sound annotation in the specified document. Accepts raw audio data, along with a few parameters describing the format of that data :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :type source_data: :py:class:`Filter` :param source_data: The raw sound data for the newly created annot :type bits_per_sample: int :param bits_per_sample: The number of bits per sample in source data :type sample_freq: int :param sample_freq: The number of samples per second present in source data :type num_channels: int :param num_channels: The number of audio channels in source_data :type icon: int :param icon: A value of the "Icon" enumeration type specifying the icon to display. :rtype: :py:class:`Sound` :return: A newly created blank Sound annotation. """ return _PDFNetPython.Sound_CreateWithData(args)
[docs] @staticmethod def Create(args): r""" Overload 1: Creates a new Sound annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`Sound` :return: A newly created blank Sound annotation. | Overload 2: Creates a new Sound annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Point` :param pos: A point specifying the annotation's location in default user space units. :rtype: :py:class:`Sound` :return: A newly created blank Sound annotation. | Overload 3: Creates a new Sound annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Point` :param pos: A point specifying the annotation's location in default user space units. :rtype: :py:class:`Sound` :return: A newly created blank Sound annotation. """ return _PDFNetPython.Sound_Create(args)
[docs] @staticmethod def CreateAnnot(args): return _PDFNetPython.Sound_CreateAnnot(args)
[docs] def GetSoundStream(self): r""" Returns the sound object of the Sound annotation. :rtype: :py:class:`Obj` :return: An SDF object representing a sound stream. Notes: The sound stream is to be played when the Sound annotation is activated. """ return _PDFNetPython.Sound_GetSoundStream(self)
[docs] def SetSoundStream(self, icon): r""" Sets the sound object of the Sound annotation. :type icon: :py:class:`Obj` :param icon: An SDF object representing a sound stream. Notes: The sound stream is to be played when the Sound annotation is activated. """ return _PDFNetPython.Sound_SetSoundStream(self, icon)
[docs] def GetIcon(self): r""" Returns the Icon of the Sound annotation. :rtype: int :return: A value of the "Icon" enum. Default value: e_Speaker. Notes: The Icon defines the appearance associated with the Sound annotation. The annotation's appearance stream, if present, will take precedence over this entry. """ return _PDFNetPython.Sound_GetIcon(self)
[docs] def GetIconName(self): r""" Returns the Icon name of the Sound annotation. :rtype: string :return: A string denoting the Icon name of the Sound annotation. Notes: The following Icon names are equivalent to predefined Icons from the enum "Icon": "Speaker" = e_Speaker "Mic" = e_Mic "Unknown" = e_Unknown The Icon defines the appearance associated with the Sound annotation. Names other than mentioned above do not have predefined icon appearances. The annotation's appearance stream, if present, will take precedence over this entry. """ return _PDFNetPython.Sound_GetIconName(self)
[docs] def SetIcon(self, args): r""" Overload 1: Sets the Icon of the Sound annotation. (Optional) :type type: int :param type: A value of the "Icon" enumeration type specifying the icon to display. Default value: e_Speaker. Notes: The Icon defines the appearance associated with the Sound annotation. The annotation's appearance stream, if present, will take precedence over this entry. | Overload 2: Sets the Icon name of the Sound annotation. (Optional) :type type: string :param type: A string denoting the Icon name of the Sound annotation. Notes: The following Icon names are equivalent to predefined types from the enum "Icon": "Speaker" = e_Speaker "Mic" = e_Mic "Unknown" = e_Unknown The Icon defines the appearance associated with the Sound annotation. Names other than mentioned above do not have predefined icon appearances. The annotation's appearance stream, if present, will take precedence over this entry. """ return _PDFNetPython.Sound_SetIcon(self, args)
def __init__(self, args): _PDFNetPython.Sound_swiginit(self, _PDFNetPython.new_Sound(args)) __swig_destroy__ = _PDFNetPython.delete_Sound
# Register Sound in _PDFNetPython: _PDFNetPython.Sound_swigregister(Sound)
[docs] def Sound_CreateWithData(args): r""" Creates a new Sound annotation in the specified document. Accepts raw audio data, along with a few parameters describing the format of that data :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :type source_data: :py:class:`Filter` :param source_data: The raw sound data for the newly created annot :type bits_per_sample: int :param bits_per_sample: The number of bits per sample in source data :type sample_freq: int :param sample_freq: The number of samples per second present in source data :type num_channels: int :param num_channels: The number of audio channels in source_data :type icon: int :param icon: A value of the "Icon" enumeration type specifying the icon to display. :rtype: :py:class:`Sound` :return: A newly created blank Sound annotation. """ return _PDFNetPython.Sound_CreateWithData(args)
[docs] def Sound_Create(args): r""" Overload 1: Creates a new Sound annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`Sound` :return: A newly created blank Sound annotation. | Overload 2: Creates a new Sound annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Point` :param pos: A point specifying the annotation's location in default user space units. :rtype: :py:class:`Sound` :return: A newly created blank Sound annotation. | Overload 3: Creates a new Sound annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Point` :param pos: A point specifying the annotation's location in default user space units. :rtype: :py:class:`Sound` :return: A newly created blank Sound annotation. """ return _PDFNetPython.Sound_Create(args)
[docs] def Sound_CreateAnnot(args): return _PDFNetPython.Sound_CreateAnnot(args)
[docs] class Square(Markup): r""" Square annotation is used to display a rectangle on the page. When opened, a square annotation can display a pop-up window containing the text of the associated note. The rectangle may be inscribed and possibly padded within the annotation rectangle defined by the annotation dictionary's Rect entry. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new Square annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, in user space coordinates. :rtype: :py:class:`Square` :return: A newly created blank Square annotation. """ return _PDFNetPython.Square_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.Square_CreateAnnot(doc, pos)
def __init__(self, args): _PDFNetPython.Square_swiginit(self, _PDFNetPython.new_Square(args)) __swig_destroy__ = _PDFNetPython.delete_Square
# Register Square in _PDFNetPython: _PDFNetPython.Square_swigregister(Square)
[docs] def Square_Create(doc, pos): r""" Creates a new Square annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, in user space coordinates. :rtype: :py:class:`Square` :return: A newly created blank Square annotation. """ return _PDFNetPython.Square_Create(doc, pos)
[docs] def Square_CreateAnnot(doc, pos): return _PDFNetPython.Square_CreateAnnot(doc, pos)
[docs] class Squiggly(TextMarkup): r""" A Squiggly annotation shows as a wavy line segment across the bottom of a word or a group of contiguous words. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new Squiggly annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Popup annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Popup annotation's bounds in default user space units. :rtype: :py:class:`Squiggly` :return: A newly created blank Squiggly annotation. """ return _PDFNetPython.Squiggly_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.Squiggly_CreateAnnot(doc, pos)
def __init__(self, args): _PDFNetPython.Squiggly_swiginit(self, _PDFNetPython.new_Squiggly(args)) __swig_destroy__ = _PDFNetPython.delete_Squiggly
# Register Squiggly in _PDFNetPython: _PDFNetPython.Squiggly_swigregister(Squiggly)
[docs] def Squiggly_Create(doc, pos): r""" Creates a new Squiggly annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Popup annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Popup annotation's bounds in default user space units. :rtype: :py:class:`Squiggly` :return: A newly created blank Squiggly annotation. """ return _PDFNetPython.Squiggly_Create(doc, pos)
[docs] def Squiggly_CreateAnnot(doc, pos): return _PDFNetPython.Squiggly_CreateAnnot(doc, pos)
[docs] class StrikeOut(TextMarkup): r""" A StrikeOut annotation shows as a line segment crossing out a word or a group of contiguous words. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new StrikeOut annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Popup annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Popup annotation's bounds in default user space units. :rtype: :py:class:`StrikeOut` :return: A newly created blank StrikeOut annotation. """ return _PDFNetPython.StrikeOut_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.StrikeOut_CreateAnnot(doc, pos)
def __init__(self, args): _PDFNetPython.StrikeOut_swiginit(self, _PDFNetPython.new_StrikeOut(args)) __swig_destroy__ = _PDFNetPython.delete_StrikeOut
# Register StrikeOut in _PDFNetPython: _PDFNetPython.StrikeOut_swigregister(StrikeOut)
[docs] def StrikeOut_Create(doc, pos): r""" Creates a new StrikeOut annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Popup annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Popup annotation's bounds in default user space units. :rtype: :py:class:`StrikeOut` :return: A newly created blank StrikeOut annotation. """ return _PDFNetPython.StrikeOut_Create(doc, pos)
[docs] def StrikeOut_CreateAnnot(doc, pos): return _PDFNetPython.StrikeOut_CreateAnnot(doc, pos)
[docs] class Text(Markup): r""" A text annotation represents a "sticky note" attached to a point in the PDF document. When closed, the annotation shall appear as an icon; when open, it shall display a pop-up window containing the text of the note in a font and size chosen by the conforming reader. Text annotations do not scale and rotate with the page (i.e. they should behave as if the NoZoom and NoRotate annotation flags). """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(args): r""" Overload 1: Creates a new Text annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`Text` :return: A newly created blank Text annotation. Creates a new Text annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :type contents: string :param contents: The text of the annotation, that shall be displayed in its popup window. :rtype: :py:class:`Text` :return: A newly created Text annotation. | Overload 2: Creates a new Text annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Point` :param pos: A point specifying the annotation's location in default user space units. This determines the location of bottom left corner of the annotation's icon. :type contents: string :param contents: The text of the annotation, that shall be displayed in its popup window. :rtype: :py:class:`Text` :return: A newly created Text annotation. | Overload 3: Creates a new Text annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Point` :param pos: A point specifying the annotation's location in default user space units. This determines the location of bottom left corner of the annotation's icon. :param contents: The text of the annotation, that shall be displayed in its popup window. :rtype: :py:class:`Text` :return: A newly created Text annotation. """ return _PDFNetPython.Text_Create(args)
[docs] @staticmethod def CreateAnnot(args): return _PDFNetPython.Text_CreateAnnot(args)
[docs] def IsOpen(self): r""" Returns the initial status of the Text annotation. :rtype: boolean :return: A boolean value that specifies whether the annotation shall initially be displayed as opened. Default value: false. """ return _PDFNetPython.Text_IsOpen(self)
[docs] def SetOpen(self, isopen): r""" Sets the initial status of the Text annotation. (Optional) :type isopen: boolean :param isopen: A boolean value that specifies whether the annotation shall initially be displayed as opened. Default value: false. """ return _PDFNetPython.Text_SetOpen(self, isopen)
e_Comment = _PDFNetPython.Text_e_Comment r"""comment icon""" e_Key = _PDFNetPython.Text_e_Key r"""key icon""" e_Help = _PDFNetPython.Text_e_Help r"""Help icon""" e_NewParagraph = _PDFNetPython.Text_e_NewParagraph r"""New Paragraph icon""" e_Paragraph = _PDFNetPython.Text_e_Paragraph r"""Paragraph icon""" e_Insert = _PDFNetPython.Text_e_Insert r"""Insert icon""" e_Note = _PDFNetPython.Text_e_Note r"""Note icon""" e_Unknown = _PDFNetPython.Text_e_Unknown r"""Unknown, no icon associated or non-standard icon."""
[docs] def GetIcon(self): r""" Returns the type of the icon associated with the Text annotation. :rtype: int :return: A value of the enumeration type "Icon". Default value: e_Note. Notes: The annotation's appearance stream, if present, will take precedence over this entry. """ return _PDFNetPython.Text_GetIcon(self)
[docs] def GetIconName(self): r""" Returns the name of the icon associated with the Text annotation. :rtype: string :return: A string denoting the name of the icon. Notes: The following icon names are equivalent to predefined icon types from the enum "Icon": "Comment" = e_Comment "Key" = e_Key "Help" = e_Help "NewParagraph" = e_NewParagraph "Paragraph" = e_Paragraph "Insert" = e_Insert "Note" = e_Note "Unknown" = e_Unknown Names other than mentioned above do not have predefined icon appearances. The annotation's appearance stream, if present, will take precedence over this entry. """ return _PDFNetPython.Text_GetIconName(self)
[docs] def SetIcon(self, args): r""" Overload 1: Sets the type of the icon associated with the Text annotation. (Optional) :type icon: int :param icon: A value of the enum "Icon" type. Default value: e_Note. Notes: The annotation's appearance stream, if present, will take precedence over this entry. | Overload 2: Sets the name of the icon associated with the Text annotation. (Optional) :type icon: string :param icon: A string denoting the name of the icon. Notes: The following icon names are equivalent to predefined icon types from the enum "Icon": "Comment" = e_Comment "Key" = e_Key "Help" = e_Help "NewParagraph" = e_NewParagraph "Paragraph" = e_Paragraph "Insert" = e_Insert "Note" = e_Note "Unknown" = e_Unknown Names other than mentioned above do not have predefined icon appearances. The annotation's appearance stream, if present, will take precedence over this entry. """ return _PDFNetPython.Text_SetIcon(self, args)
[docs] def GetState(self): r""" Returns the string indicating the state of the Text annotation. (PDF 1.5) :rtype: string :return: A string that indicates the state of the Text annotation when first loaded. Default: "Unmarked" if StateModel is "Marked"; "None" if StateModel is "Review". """ return _PDFNetPython.Text_GetState(self)
[docs] def SetState(self, args): r""" Sets the string indicating the state of the Text annotation. (Optional; PDF 1.5 ) :type state: string :param state: A string that indicates the state of the Text annotation when first loaded. Default: "Unmarked" if StateModel is "Marked"; "None" if StateModel is "Review". """ return _PDFNetPython.Text_SetState(self, args)
[docs] def GetStateModel(self): r""" Returns the string indicating the state model of the Text annotation. (PDF 1.5) :rtype: string :return: A string containing the state model name - either "Marked" or "Review". """ return _PDFNetPython.Text_GetStateModel(self)
[docs] def SetStateModel(self, sm): r""" Sets the string indicating the state model of the Text annotation. (Required if State is present, otherwise optional; PDF 1.5 ) :type sm: string :param sm: A string containing the state model name - either "Marked" or "Review". """ return _PDFNetPython.Text_SetStateModel(self, sm)
[docs] def GetAnchorPosition(self): r""" Returns anchor point position (in relative coordinates) - the point that won't move when the page is zoomed in/out Anchor point position is in relative coordinates [0,1], and default is upper-left corner (0,1) :rtype: :py:class:`Point` :return: Currently stored anchor position or the default (upper-left corner (0,1)) """ return _PDFNetPython.Text_GetAnchorPosition(self)
[docs] def SetAnchorPosition(self, pt): r""" Sets anchor point position (in coordinates relative to the annotation Rect) - the point that won't move when the page is zoomed in/out and/or if the page is rotated. :type pt: :py:class:`Point` :param pt: Anchor point position in relative coordinates [0,1], where 0,0 is bottom left corner of the annotation, and 1,1 is top right corner. Default: 0,1 """ return _PDFNetPython.Text_SetAnchorPosition(self, pt)
def __init__(self, args): _PDFNetPython.Text_swiginit(self, _PDFNetPython.new_Text(args)) __swig_destroy__ = _PDFNetPython.delete_Text
# Register Text in _PDFNetPython: _PDFNetPython.Text_swigregister(Text)
[docs] def Text_Create(args): r""" Overload 1: Creates a new Text annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`Text` :return: A newly created blank Text annotation. Creates a new Text annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :type contents: string :param contents: The text of the annotation, that shall be displayed in its popup window. :rtype: :py:class:`Text` :return: A newly created Text annotation. | Overload 2: Creates a new Text annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Point` :param pos: A point specifying the annotation's location in default user space units. This determines the location of bottom left corner of the annotation's icon. :type contents: string :param contents: The text of the annotation, that shall be displayed in its popup window. :rtype: :py:class:`Text` :return: A newly created Text annotation. | Overload 3: Creates a new Text annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Point` :param pos: A point specifying the annotation's location in default user space units. This determines the location of bottom left corner of the annotation's icon. :param contents: The text of the annotation, that shall be displayed in its popup window. :rtype: :py:class:`Text` :return: A newly created Text annotation. """ return _PDFNetPython.Text_Create(args)
[docs] def Text_CreateAnnot(args): return _PDFNetPython.Text_CreateAnnot(args)
[docs] class Underline(TextMarkup): r""" An Underline annotation shows as a line segment across the bottom of a word or a group of contiguous words. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new Underline annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Underline annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Underline annotation's bounds in default user space units. :rtype: :py:class:`Underline` :return: A newly created blank Underline annotation. """ return _PDFNetPython.Underline_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.Underline_CreateAnnot(doc, pos)
def __init__(self, args): _PDFNetPython.Underline_swiginit(self, _PDFNetPython.new_Underline(args)) __swig_destroy__ = _PDFNetPython.delete_Underline
# Register Underline in _PDFNetPython: _PDFNetPython.Underline_swigregister(Underline)
[docs] def Underline_Create(doc, pos): r""" Creates a new Underline annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the Underline annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the Underline annotation's bounds in default user space units. :rtype: :py:class:`Underline` :return: A newly created blank Underline annotation. """ return _PDFNetPython.Underline_Create(doc, pos)
[docs] def Underline_CreateAnnot(doc, pos): return _PDFNetPython.Underline_CreateAnnot(doc, pos)
[docs] class Watermark(Annot): r""" A Watermark annotation is an annotation that is printed at a fixed size and position on a page, regardless of the dimensions of the printed page. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos): r""" Creates a new Watermark annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`Watermark` :return: A newly created blank Watermark annotation. """ return _PDFNetPython.Watermark_Create(doc, pos)
[docs] @staticmethod def CreateAnnot(doc, pos): return _PDFNetPython.Watermark_CreateAnnot(doc, pos)
def __init__(self, args): _PDFNetPython.Watermark_swiginit(self, _PDFNetPython.new_Watermark(args)) __swig_destroy__ = _PDFNetPython.delete_Watermark
# Register Watermark in _PDFNetPython: _PDFNetPython.Watermark_swigregister(Watermark)
[docs] def Watermark_Create(doc, pos): r""" Creates a new Watermark annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :rtype: :py:class:`Watermark` :return: A newly created blank Watermark annotation. """ return _PDFNetPython.Watermark_Create(doc, pos)
[docs] def Watermark_CreateAnnot(doc, pos): return _PDFNetPython.Watermark_CreateAnnot(doc, pos)
[docs] class Widget(Annot): r""" Interactive forms use widget annotations (PDF 1.2) to represent the appearance of fields and to manage user interactions. As a convenience, when a field has only a single associated widget annotation, the contents of the field dictionary and the annotation dictionary may be merged into a single dictionary containing entries that pertain to both a field and an annotation. NOTE This presents no ambiguity, since the contents of the two kinds of dictionaries do not conflict. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(doc, pos, field): r""" Creates a new widget annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :type field: :py:class:`Field` :param field: A form field associated with this widget. :rtype: :py:class:`Widget` :return: A newly created blank widget annotation. """ return _PDFNetPython.Widget_Create(doc, pos, field)
[docs] def GetField(self): r""" Returns the field associated with the Widget. :rtype: :py:class:`Field` :return: A Field object. """ return _PDFNetPython.Widget_GetField(self)
e_none = _PDFNetPython.Widget_e_none r""" No highlighting.""" e_invert = _PDFNetPython.Widget_e_invert r""" Invert the contents of the annotation rectangle.""" e_outline = _PDFNetPython.Widget_e_outline r""" Invert the annotation's border.""" e_push = _PDFNetPython.Widget_e_push r""" Display the annotation's down appearance, if any. If no down appearance is defined, the contents of the annotation rectangle shall be offset to appear as if it were being pushed below the surface of the page.""" e_toggle = _PDFNetPython.Widget_e_toggle r""" Same as e_push (which is preferred)."""
[docs] def GetHighlightingMode(self): r""" :rtype: int :return: the HighlightingMode of the widget annotation. Notes: The annotation's highlighting mode is the visual effect that shall be used when the mouse button is pressed or held down inside its active area A highlighting mode other than e_push will override any down appearance defined for the annotation. e_invert. """ return _PDFNetPython.Widget_GetHighlightingMode(self)
[docs] def SetHighlightingMode(self, args): r""" Sets the HighlightingMode for the widget annotation. Notes: The annotation's highlighting mode is the visual effect that shall be used when the mouse button is pressed or held down inside its active area :type mode: int :param mode: - New highlighting mode for the widget. A highlighting mode other than e_push shall override any down appearance defined for the annotation. Default value: e_invert. """ return _PDFNetPython.Widget_SetHighlightingMode(self, args)
[docs] def GetAction(self): r""" Returns the action of the widget annotation :rtype: :py:class:`Action` :return: An action object representing the action of the widget annotation that should be performed when the annotation is activated. """ return _PDFNetPython.Widget_GetAction(self)
[docs] def SetAction(self, action): r""" Sets the action of the widget annotation (Optional; PDF 1.2 ) :type action: :py:class:`Action` :param action: An action object representing the action of the widget annotation that should be performed when the annotation is activated. """ return _PDFNetPython.Widget_SetAction(self, action)
[docs] def GetBorderColorCompNum(self): r""" Returns the number indicating border color space of the annotation. :rtype: int :return: An integer indicating a color space value from the ColorSpace::Type enum. That is, 1 corresponding to "e_device_gray", 3 corresponding to "e_device_rgb", and 4 corresponding to "e_device_cmyk". 0 means this annotation had no color assigned. """ return _PDFNetPython.Widget_GetBorderColorCompNum(self)
[docs] def GetBorderColor(self): r""" Returns the border color of the annotation. :rtype: :py:class:`ColorPt` :return: A color object that denotes the color of the Screen border. Notes: The color can be in different color spaces: Gray, RGB, or CMYK. Call "GetBorderColorCompNum" to access the color space information corresponding to the border color. """ return _PDFNetPython.Widget_GetBorderColor(self)
[docs] def SetBorderColor(self, col, compnum): r""" Sets the border color of the annotation. (Optional) :type col: :py:class:`ColorPt` :param col: A color object that denotes the color of the screen border. :type compnum: int :param compnum: An integer which value indicates the color space used for the parameter c. """ return _PDFNetPython.Widget_SetBorderColor(self, col, compnum)
[docs] def GetBackgroundColorCompNum(self): r""" Returns the number indicating background color space of the annotation. :rtype: int :return: An integer indicating a color space value from the ColorSpace::Type enum. That is, 1 corresponding to "e_device_gray", 3 corresponding to "e_device_rgb", and 4 corresponding to "e_device_cmyk" if color space is applicable, 0 means no background color was assigned. """ return _PDFNetPython.Widget_GetBackgroundColorCompNum(self)
[docs] def GetBackgroundColor(self): r""" Returns the background color of the annotation. :rtype: :py:class:`ColorPt` :return: A color object that denotes the color of the Screen background. Notes: The color can be in different color spaces: Gray, RGB, or CMYK. Call "GetBackgroundColorCompNum" to access the color space information corresponding to the border color. """ return _PDFNetPython.Widget_GetBackgroundColor(self)
[docs] def SetBackgroundColor(self, c, compnum): r""" Sets the background color of the annotation. (Optional) :param col: A color point that denotes the color of the screen background. :type compnum: int :param compnum: An integer which value indicates the color space used for the parameter c. """ return _PDFNetPython.Widget_SetBackgroundColor(self, c, compnum)
[docs] def GetStaticCaptionText(self): r""" Returns static caption text of the annotation. :rtype: string :return: A string containing the static caption text of the annotation. Notes: The static caption is the annotation's normal caption, which shall be displayed when it is not interacting with the user. Unlike the remaining entries with the captions, which apply only to widget annotations associated with pushbutton fields, the Static Caption(CA) entry may be used with any type of button field, including check boxes. This property is part of the Widget appearance characteristics dictionary, this dictionary that shall be used inructing a dynamic appearance stream specifying the annotation's visual presentation on the page. """ return _PDFNetPython.Widget_GetStaticCaptionText(self)
[docs] def SetStaticCaptionText(self, contents): r""" Sets static caption text of the annotation. (Optional; button fields only) :type contents: string :param contents: A string containing the static caption text of the annotation. Notes: The static caption is the annotation's normal caption, which shall be displayed when it is not interacting with the user. Unlike the remaining entries with the captions, which apply only to widget annotations associated with pushbutton fields, the Static Caption(CA) entry may be used with any type of button field, including check boxes. This property is part of the Widget appearance characteristics dictionary, this dictionary that shall be used inructing a dynamic appearance stream specifying the annotation's visual presentation on the page. """ return _PDFNetPython.Widget_SetStaticCaptionText(self, contents)
[docs] def GetRolloverCaptionText(self): r""" Returns the rollover caption text of the annotation. :rtype: string :return: A string containing the rollover caption text of the annotation. Notes: The rollover caption shall be displayed when the user rolls the cursor into its active area without pressing the mouse button. """ return _PDFNetPython.Widget_GetRolloverCaptionText(self)
[docs] def SetRolloverCaptionText(self, contents): r""" Sets the roll over caption text of the annotation. (Optional; button fields only) :type contents: string :param contents: A string containing the roll over caption text of the annotation. Notes: The rollover caption shall be displayed when the user rolls the cursor into its active area without pressing the mouse button. """ return _PDFNetPython.Widget_SetRolloverCaptionText(self, contents)
[docs] def GetMouseDownCaptionText(self): r""" Returns the button down caption text of the annotation. :rtype: string :return: A string containing the button down text of the annotation. Notes: The button down caption shall be displayed when the mouse button is pressed within its active area. """ return _PDFNetPython.Widget_GetMouseDownCaptionText(self)
[docs] def SetMouseDownCaptionText(self, contents): r""" Sets the button down caption text of the annotation. (Optional; button fields only) :type contents: string :param contents: A string containing the button down text of the annotation. Notes: The button down caption shall be displayed when the mouse button is pressed within its active area. """ return _PDFNetPython.Widget_SetMouseDownCaptionText(self, contents)
[docs] def GetStaticIcon(self): r""" Returns the static icon associated with the annotation. :rtype: :py:class:`Obj` :return: An SDF object that represents the static icon associated with the annotation. Notes: The static icon object is a form XObject defining the annotation's normal icon, which shall be displayed when it is not interacting with the user. """ return _PDFNetPython.Widget_GetStaticIcon(self)
[docs] def SetStaticIcon(self, icon): r""" Sets the static icon associated with the annotation. (Optional; button fields only) :type icon: :py:class:`Obj` :param icon: An SDF object that represents the static icon associated with the annotation. Notes: The static icon object is a form XObject defining the annotation's normal icon, which shall be displayed when it is not interacting with the user. """ return _PDFNetPython.Widget_SetStaticIcon(self, icon)
[docs] def GetRolloverIcon(self): r""" Returns the rollover icon associated with the annotation. :rtype: :py:class:`Obj` :return: An SDF object that represents the rollover icon associated with the annotation. Notes: The rollover icon object is a form XObject defining the annotation's rollover icon, which shall be displayed when the user rolls the cursor into its active area without pressing the mouse button. """ return _PDFNetPython.Widget_GetRolloverIcon(self)
[docs] def SetRolloverIcon(self, icon): r""" Sets the rollover icon associated with the annotation. (Optional; button fields only) :type icon: :py:class:`Obj` :param icon: An SDF object that represents the rollover icon associated with the annotation. Notes: The rollover icon object is a form XObject defining the annotation's rollover icon, which shall be displayed when the user rolls the cursor into its active area without pressing the mouse button. """ return _PDFNetPython.Widget_SetRolloverIcon(self, icon)
[docs] def GetMouseDownIcon(self): r""" Returns the Mouse Down icon associated with the annotation. :rtype: :py:class:`Obj` :return: An SDF object that represents the Mouse Down icon associated with the annotation. Notes: The Mouse Down icon object is a form XObject defining the annotation's alternate (down) icon, which shall be displayed when the mouse button is pressed within its active area. """ return _PDFNetPython.Widget_GetMouseDownIcon(self)
[docs] def SetMouseDownIcon(self, icon): r""" Sets the Mouse Down icon associated with the annotation. (Optional; button fields only) :type icon: :py:class:`Obj` :param icon: An SDF object that represents the Mouse Down icon associated with the annotation. Notes: The Mouse Down icon object is a form XObject defining the annotation's alternate (down) icon, which shall be displayed when the mouse button is pressed within its active area. """ return _PDFNetPython.Widget_SetMouseDownIcon(self, icon)
e_NoIcon = _PDFNetPython.Widget_e_NoIcon e_NoCaption = _PDFNetPython.Widget_e_NoCaption e_CBelowI = _PDFNetPython.Widget_e_CBelowI e_CAboveI = _PDFNetPython.Widget_e_CAboveI e_CRightILeft = _PDFNetPython.Widget_e_CRightILeft e_CLeftIRight = _PDFNetPython.Widget_e_CLeftIRight e_COverlayI = _PDFNetPython.Widget_e_COverlayI
[docs] def GetIconCaptionRelation(self): r""" Returns the Icon and caption relationship of the annotation. :rtype: int :return: A value of the "IconCaptionRelation" enum type. Default value: e_NoIcon. See also: IconCaptionRelation """ return _PDFNetPython.Widget_GetIconCaptionRelation(self)
[docs] def SetIconCaptionRelation(self, icr): r""" Sets the Icon and caption relationship of the annotation. (Optional; pushbutton fields only) :type icr: int :param icr: A value of the "IconCaptionRelation" enum type. Default value: e_NoIcon. See also: IconCaptionRelation """ return _PDFNetPython.Widget_SetIconCaptionRelation(self, icr)
e_Always = _PDFNetPython.Widget_e_Always r""" Always scale""" e_WhenBigger = _PDFNetPython.Widget_e_WhenBigger r""" Scale only when the icon is bigger than the annotation rectangle""" e_WhenSmaller = _PDFNetPython.Widget_e_WhenSmaller r""" Scale only when the icon is smaller than the annotation rectangle""" e_Never = _PDFNetPython.Widget_e_Never r""" Never scale"""
[docs] def GetScaleCondition(self): r""" Returns the condition under which the icon should be scaled. :rtype: int :return: A value of the "ScaleCondition" enum type. Default value: e_Always. See also: ScaleCondition """ return _PDFNetPython.Widget_GetScaleCondition(self)
[docs] def SetScaleCondition(self, sd): r""" Sets the condition under which the icon should be scaled. (Optional) :type sd: int :param sd: A value of the "ScaleCondition" enum type. Default value: e_Always. """ return _PDFNetPython.Widget_SetScaleCondition(self, sd)
e_Anamorphic = _PDFNetPython.Widget_e_Anamorphic e_Proportional = _PDFNetPython.Widget_e_Proportional
[docs] def GetScaleType(self): r""" Returns the Scale Type of the annotation. :rtype: int :return: A value of the "ScaleType" enum which represents the Scale Type of the annotation. Default value: P. See also: ScaleType """ return _PDFNetPython.Widget_GetScaleType(self)
[docs] def SetScaleType(self, st): r""" Sets the Scale Type of the annotation. (Optional) :type st: int :param st: An entry of the "ScaleType" enum which represents the Scale Type of the annotation. Default value: P. See also: ScaleType """ return _PDFNetPython.Widget_SetScaleType(self, st)
[docs] def GetHIconLeftOver(self): r""" Returns the horizontal leftover space of the icon within the annotation. :rtype: double :return: A number indicating the horizontal leftover space of the icon within the annotation. Notes: the horizontal leftover is a number that shall be between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the left. A value of 0.0 shall position the icon at the left of the annotation rectangle. A value of 0.5 shall center it in the horizontal direction within the rectangle. This entry shall be used only if the icon is scaled proportionally. Default value: 0.5. """ return _PDFNetPython.Widget_GetHIconLeftOver(self)
[docs] def SetHIconLeftOver(self, hl): r""" Sets the horizontal leftover space of the icon within the annotation. (Optional) :type hl: double :param hl: A number indicating the horizontal leftover space of the icon within the annotation. Notes: the horizontal leftover space is a number that shall be between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the left. A value of 0.0 shall position the icon at the left of the annotation rectangle. A value of 0.5 shall center it in the horizontal direction within the rectangle. This entry shall be used only if the icon is scaled proportionally. Default value: 0.5. """ return _PDFNetPython.Widget_SetHIconLeftOver(self, hl)
[docs] def GetVIconLeftOver(self): r""" Returns the vertical leftover space of the icon within the annotation. :rtype: double :return: a number indicating the vertical leftover space of the icon within the annotation. Notes: the vertical leftover space is a number that shall be between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the bottom of the icon. A value of 0.0 shall position the icon at the bottom of the annotation rectangle. A value of 0.5 shall center it in the vertical direction within the rectangle. This entry shall be used only if the icon is scaled proportionally. Default value: 0.5. """ return _PDFNetPython.Widget_GetVIconLeftOver(self)
[docs] def SetVIconLeftOver(self, vl): r""" Sets the vertical leftover space of the icon within the annotation. (Optional) :type vl: double :param vl: A number indicating the vertical leftover space of the icon within the annotation. Notes: the vertical leftover space is a number that shall be between 0.0 and 1.0 indicating the fraction of leftover space to allocate at the bottom of the icon. A value of 0.0 shall position the icon at the bottom of the annotation rectangle. A value of 0.5 shall center it in the vertical direction within the rectangle. This entry shall be used only if the icon is scaled proportionally. Default value: 0.5. """ return _PDFNetPython.Widget_SetVIconLeftOver(self, vl)
[docs] def GetFitFull(self): r""" Returns the "fit full" flag. :rtype: boolean :return: A boolean value indicating the "fit full" flag value. Notes: the fit full flag, if true, indicates that the button appearance shall be scaled to fit fully within the bounds of the annotation without taking into consideration the line width of the border. Default value: false. """ return _PDFNetPython.Widget_GetFitFull(self)
[docs] def SetFitFull(self, ff): r""" Sets the "fit full" flag. (Optional) :type ff: boolean :param ff: A boolean value indicating the "fit full" flag value. Notes: the fit full flag, if true, indicates that the button appearance shall be scaled to fit fully within the bounds of the annotation without taking into consideration the line width of the border. Default value: false. """ return _PDFNetPython.Widget_SetFitFull(self, ff)
[docs] def GetTextColor(self): r""" Returns the text color of the Widget Annotation. :rtype: :py:class:`ColorPt` :return: the text color. Notes: the color can be in different color spaces: Gray, RGB, or CMYK. Call "GetTextColorCompNum" to access the color space information corresponding to the border color. """ return _PDFNetPython.Widget_GetTextColor(self)
[docs] def GetTextColorCompNum(self): r""" Returns the number of color components in the text color of the Widget Annotation. :rtype: int :return: An integer indicating a color space value from the ColorSpace::Type enum. That is, 1 corresponding to "e_device_gray", 3 corresponding to "e_device_rgb", and 4 corresponding to "e_device_cmyk" if color space is applicable. """ return _PDFNetPython.Widget_GetTextColorCompNum(self)
[docs] def SetTextColor(self, color, col_comp): r""" Sets the text color of the Widget Annotation. :type color: :py:class:`ColorPt` :param color: ColorPt object representing the color. :type col_comp: int :param col_comp: An integer indicating a color space value from the ColorSpace::Type enum. That is, 1 corresponding to "e_device_gray", 3 corresponding to "e_device_rgb", and 4 corresponding to "e_device_cmyk". """ return _PDFNetPython.Widget_SetTextColor(self, color, col_comp)
[docs] def GetFontSize(self): r""" Returns the font size used in this Widget Annotation. :rtype: double :return: the font size Notes: A font size of 0 specifies that the text should be autosized to fit in the Widget. """ return _PDFNetPython.Widget_GetFontSize(self)
[docs] def SetFontSize(self, font_size): r""" Sets the font size of the Widget Annotation. :type font_size: double :param font_size: the new font size Notes: A font size of 0 specifies that the text should be autosized to fit in the Widget. """ return _PDFNetPython.Widget_SetFontSize(self, font_size)
[docs] def GetFont(self): r""" Retrieves the font used for displaying text in this Widget. :rtype: :py:class:`Font` :return: the font used by this Widget. """ return _PDFNetPython.Widget_GetFont(self)
[docs] def SetFont(self, font): r""" Specifies a font to be used for text in this Widget. :type font: :py:class:`Font` :param font: the font to use. """ return _PDFNetPython.Widget_SetFont(self, font)
def __init__(self, args): _PDFNetPython.Widget_swiginit(self, _PDFNetPython.new_Widget(args)) __swig_destroy__ = _PDFNetPython.delete_Widget
# Register Widget in _PDFNetPython: _PDFNetPython.Widget_swigregister(Widget)
[docs] def Widget_Create(doc, pos, field): r""" Creates a new widget annotation in the specified document. :type doc: :py:class:`SDFDoc` :param doc: A document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds in default user space units. :type field: :py:class:`Field` :param field: A form field associated with this widget. :rtype: :py:class:`Widget` :return: A newly created blank widget annotation. """ return _PDFNetPython.Widget_Create(doc, pos, field)
[docs] class SignatureWidget(Widget): r"""An object representing a Signature used in a PDF Form. These Widgets can be signed directly, or signed using a DigitalSignatureField.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): r""" Overload 1: Creates a SignatureWidget annotation and initializes it using given Cos/SDF object. :type d: :py:class:`Obj` :param d: the input Cos/SDF object Notes: Theructor does not copy any data, but is instead the logical equivalent of a type cast. | Overload 2: Creates a Widget annotation and initializes it using given annotation object. :type annot: :py:class:`Annot` :param annot: the annot Notes: Theructor does not copy any data, but is instead the logical equivalent of a type cast. """ _PDFNetPython.SignatureWidget_swiginit(self, _PDFNetPython.new_SignatureWidget(args))
[docs] def GetDigitalSignatureField(self): r""" Retrieves the DigitalSignatureField associated with this SignatureWidget. :rtype: :py:class:`DigitalSignatureField` :return: A DigitalSignatureField object representing the digital signature form field associated with this signature widget annotation. """ return _PDFNetPython.SignatureWidget_GetDigitalSignatureField(self)
[docs] def CreateSignatureAppearance(self, img): r""" A function that will create and add an appearance to this widget by centering an image within it. :type img: :py:class:`Image` :param img: A PDF::Image object representing the image to use. """ return _PDFNetPython.SignatureWidget_CreateSignatureAppearance(self, img)
[docs] @staticmethod def Create(args): r""" Overload 1: Creates a new SignatureWidget annotation in the specified document, and adds an associated signature form field to the document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the widget is to be added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the widget's bounds in default user space units. :type field_name: string :param field_name: The name of the digital signature field to create. Optional - autogenerated by default. :rtype: :py:class:`SignatureWidget` :return: A newly-created blank SignatureWidget annotation. | Overload 2: Creates a new SignatureWidget annotation associated with a particular form field in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the widget is to be added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the widget's bounds in default user space units. :type field: :py:class:`Field` :param field: The digital signature field for which to create a signature widget. :rtype: :py:class:`SignatureWidget` :return: A newly-created blank SignatureWidget annotation. | Overload 3: Creates a new SignatureWidget annotation associated with a particular DigitalSignatureField object (representing a signature-type form field) in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the widget is to be added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the widget's bounds in default user space units. :type field: :py:class:`DigitalSignatureField` :param field: The digital signature field for which to create a signature widget. :rtype: :py:class:`SignatureWidget` :return: A newly-created blank SignatureWidget annotation. """ return _PDFNetPython.SignatureWidget_Create(args)
__swig_destroy__ = _PDFNetPython.delete_SignatureWidget
# Register SignatureWidget in _PDFNetPython: _PDFNetPython.SignatureWidget_swigregister(SignatureWidget)
[docs] def SignatureWidget_Create(args): r""" Overload 1: Creates a new SignatureWidget annotation in the specified document, and adds an associated signature form field to the document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the widget is to be added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the widget's bounds in default user space units. :type field_name: string :param field_name: The name of the digital signature field to create. Optional - autogenerated by default. :rtype: :py:class:`SignatureWidget` :return: A newly-created blank SignatureWidget annotation. | Overload 2: Creates a new SignatureWidget annotation associated with a particular form field in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the widget is to be added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the widget's bounds in default user space units. :type field: :py:class:`Field` :param field: The digital signature field for which to create a signature widget. :rtype: :py:class:`SignatureWidget` :return: A newly-created blank SignatureWidget annotation. | Overload 3: Creates a new SignatureWidget annotation associated with a particular DigitalSignatureField object (representing a signature-type form field) in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the widget is to be added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the widget's bounds in default user space units. :type field: :py:class:`DigitalSignatureField` :param field: The digital signature field for which to create a signature widget. :rtype: :py:class:`SignatureWidget` :return: A newly-created blank SignatureWidget annotation. """ return _PDFNetPython.SignatureWidget_Create(args)
[docs] class CheckBoxWidget(Widget): r"""An object representing a check box used in a PDF Form.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): r""" Overload 1: Creates a Check Box Widget annotation and initialize it using given Cos/SDF object. Note: Theructor does not copy any data, but is instead the logical equivalent of a type cast. :type d: :py:class:`Obj` :param d: the object to use to initialize the Check Box Widget | Overload 2: Creates a Check Box Widget annotation and initialize it using given annotation object. Note: Theructor does not copy any data, but is instead the logical equivalent of a type cast. :type annot: :py:class:`Annot` :param annot: The annotation object to use. """ _PDFNetPython.CheckBoxWidget_swiginit(self, _PDFNetPython.new_CheckBoxWidget(args))
[docs] @staticmethod def Create(args): r""" Overload 1: Creates a new Check Box Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is to be added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field_name: string :param field_name: The name of the field for which to create a CheckBox widget. :rtype: :py:class:`CheckBoxWidget` :return: A newly created blank Check Box Widget annotation. | Overload 2: Creates a new Check Box Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is to be added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field: :py:class:`Field` :param field: the field for which to create a CheckBox widget :rtype: :py:class:`CheckBoxWidget` :return: A newly created blank Check Box Widget annotation. """ return _PDFNetPython.CheckBoxWidget_Create(args)
[docs] def IsChecked(self): r""" Returns whether the checkbox is checked. :rtype: boolean :return: A boolean value indicating whether the checkbox is checked. """ return _PDFNetPython.CheckBoxWidget_IsChecked(self)
[docs] def SetChecked(self, checked): r""" Check or uncheck the Check Box Widget :param value: If true, the annotation should be checked. Otherwise it should be unchecked. """ return _PDFNetPython.CheckBoxWidget_SetChecked(self, checked)
__swig_destroy__ = _PDFNetPython.delete_CheckBoxWidget
# Register CheckBoxWidget in _PDFNetPython: _PDFNetPython.CheckBoxWidget_swigregister(CheckBoxWidget)
[docs] def CheckBoxWidget_Create(args): r""" Overload 1: Creates a new Check Box Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is to be added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field_name: string :param field_name: The name of the field for which to create a CheckBox widget. :rtype: :py:class:`CheckBoxWidget` :return: A newly created blank Check Box Widget annotation. | Overload 2: Creates a new Check Box Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is to be added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field: :py:class:`Field` :param field: the field for which to create a CheckBox widget :rtype: :py:class:`CheckBoxWidget` :return: A newly created blank Check Box Widget annotation. """ return _PDFNetPython.CheckBoxWidget_Create(args)
[docs] class PushButtonWidget(Widget): r""" An object representing a push button used in a PDF Form.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): r""" Overload 1: Creates a Push Button Widget annotation and initialize it using given Cos/SDF object. Note: Theructor does not copy any data, but is instead the logical equivalent of a type cast. :type d: :py:class:`Obj` :param d: The object to use to initialize the PushButtonWidget | Overload 2: Creates a Push Button Widget annotation and initialize it using given annotation object. Note: Theructor does not copy any data, but is instead the logical equivalent of a type cast. :type annot: :py:class:`Annot` :param annot: the annotation from which to create a Push Button Widget. """ _PDFNetPython.PushButtonWidget_swiginit(self, _PDFNetPython.new_PushButtonWidget(args))
[docs] @staticmethod def Create(args): r""" Overload 1: Creates a new Push Button Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field_name: string :param field_name: The name of the field for which to create a PushButton widget. :rtype: :py:class:`PushButtonWidget` :return: A newly created default Push Button Widget annotation. | Overload 2: Creates a new Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field: :py:class:`Field` :param field: the field for which to create a Push Button Widget. :rtype: :py:class:`PushButtonWidget` :return: A newly created default Push Button Widget annotation. """ return _PDFNetPython.PushButtonWidget_Create(args)
__swig_destroy__ = _PDFNetPython.delete_PushButtonWidget
# Register PushButtonWidget in _PDFNetPython: _PDFNetPython.PushButtonWidget_swigregister(PushButtonWidget)
[docs] def PushButtonWidget_Create(args): r""" Overload 1: Creates a new Push Button Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field_name: string :param field_name: The name of the field for which to create a PushButton widget. :rtype: :py:class:`PushButtonWidget` :return: A newly created default Push Button Widget annotation. | Overload 2: Creates a new Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field: :py:class:`Field` :param field: the field for which to create a Push Button Widget. :rtype: :py:class:`PushButtonWidget` :return: A newly created default Push Button Widget annotation. """ return _PDFNetPython.PushButtonWidget_Create(args)
[docs] class TextWidget(Widget): r""" An object representing a Text Box used in a PDF Form.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): r""" Overload 1: Creates a Text Widget annotation and initialize it using given Cos/SDF object. Note: Theructor does not copy any data, but is instead the logical equivalent of a type cast. :type d: :py:class:`Obj` :param d: The object to use to initialize the Text Widget | Overload 2: Creates a Text Widget annotation and initialize it using given annotation object. Note: Theructor does not copy any data, but is instead the logical equivalent of a type cast. :type annot: :py:class:`Annot` :param annot: The annotation object to use. """ _PDFNetPython.TextWidget_swiginit(self, _PDFNetPython.new_TextWidget(args))
[docs] @staticmethod def Create(args): r""" Overload 1: Creates a new Text Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field_name: string :param field_name: The name of the field for which to create a Text widget. :rtype: :py:class:`TextWidget` :return: A newly created blank Text Widget annotation. | Overload 2: Creates a new Text Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field: :py:class:`Field` :param field: the field for which to create a Text Widget. :rtype: :py:class:`TextWidget` :return: A newly created blank Widget annotation. """ return _PDFNetPython.TextWidget_Create(args)
[docs] def SetText(self, text): r""" Sets the text content of the Text Widget. :type text: string :param text: The text to be displayed in the Text Widget. """ return _PDFNetPython.TextWidget_SetText(self, text)
[docs] def GetText(self): r""" Retrieves the text content of the Text Widget. :rtype: string :return: The Text Widget contents. """ return _PDFNetPython.TextWidget_GetText(self)
__swig_destroy__ = _PDFNetPython.delete_TextWidget
# Register TextWidget in _PDFNetPython: _PDFNetPython.TextWidget_swigregister(TextWidget)
[docs] def TextWidget_Create(args): r""" Overload 1: Creates a new Text Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field_name: string :param field_name: The name of the field for which to create a Text widget. :rtype: :py:class:`TextWidget` :return: A newly created blank Text Widget annotation. | Overload 2: Creates a new Text Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field: :py:class:`Field` :param field: the field for which to create a Text Widget. :rtype: :py:class:`TextWidget` :return: A newly created blank Widget annotation. """ return _PDFNetPython.TextWidget_Create(args)
[docs] class ComboBoxWidget(Widget): r"""An object representing a combo box used in a PDF Form.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): r""" Overload 1: Creates a Combo Box Widget annotation and initialize it using given Cos/SDF object. Note: Theructor does not copy any data, but is instead the logical equivalent of a type cast. :type d: :py:class:`Obj` :param d: the object to use to initialize the ComboBoxWidget | Overload 2: Creates a Combo Box Widget annotation and initialize it using given annotation object. Note: Theructor does not copy any data, but is instead the logical equivalent of a type cast. :type annot: :py:class:`Annot` :param annot: The annotation to use. """ _PDFNetPython.ComboBoxWidget_swiginit(self, _PDFNetPython.new_ComboBoxWidget(args))
[docs] @staticmethod def Create(args): r""" Overload 1: Creates a new Combo Box Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field_name: string :param field_name: The name of the field for which to create a ComboBox widget :rtype: :py:class:`ComboBoxWidget` :return: A newly created blank Combo Box Widget annotation. | Overload 2: Creates a new Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field: :py:class:`Field` :param field: The field for which to create a Text widget :rtype: :py:class:`ComboBoxWidget` :return: A newly created blank Widget annotation. """ return _PDFNetPython.ComboBoxWidget_Create(args)
[docs] def AddOption(self, value): r""" Adds an option to Combo Box widget. :type value: string :param value: The option to add """ return _PDFNetPython.ComboBoxWidget_AddOption(self, value)
[docs] def AddOptions(self, opts): r""" Adds multiple options to Combo Box widget. :type opts: std::vector< std::string,std::allocator< std::string > > :param opts: The options to add """ return _PDFNetPython.ComboBoxWidget_AddOptions(self, opts)
[docs] def GetOptions(self): r""" Gets all options of the Combo Box widget. :rtype: std::vector< std::string,std::allocator< std::string > > :return: The options of the Combo Box widget """ return _PDFNetPython.ComboBoxWidget_GetOptions(self)
[docs] def ReplaceOptions(self, new_opts): r""" Replaces the current Combo Box widget options with a new set. :type new_opts: std::vector< std::string,std::allocator< std::string > > :param new_opts: The new set of options to use. """ return _PDFNetPython.ComboBoxWidget_ReplaceOptions(self, new_opts)
[docs] def SetSelectedOption(self, value): r""" Selects the given option in the Combo Box widget :type value: string :param value: The option to select """ return _PDFNetPython.ComboBoxWidget_SetSelectedOption(self, value)
[docs] def GetSelectedOption(self): r""" Retrieves the option selected in the ComboBox widget :rtype: string :return: The option selected in the ComboBox widget """ return _PDFNetPython.ComboBoxWidget_GetSelectedOption(self)
[docs] def RemoveOption(self, value): r""" Removes the option from Combo Box widget. :type value: string :param value: The option to remove """ return _PDFNetPython.ComboBoxWidget_RemoveOption(self, value)
__swig_destroy__ = _PDFNetPython.delete_ComboBoxWidget
# Register ComboBoxWidget in _PDFNetPython: _PDFNetPython.ComboBoxWidget_swigregister(ComboBoxWidget)
[docs] def ComboBoxWidget_Create(args): r""" Overload 1: Creates a new Combo Box Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field_name: string :param field_name: The name of the field for which to create a ComboBox widget :rtype: :py:class:`ComboBoxWidget` :return: A newly created blank Combo Box Widget annotation. | Overload 2: Creates a new Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field: :py:class:`Field` :param field: The field for which to create a Text widget :rtype: :py:class:`ComboBoxWidget` :return: A newly created blank Widget annotation. """ return _PDFNetPython.ComboBoxWidget_Create(args)
[docs] class ListBoxWidget(Widget): r"""An object representing a List Box used in a PDF Form.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): r""" Overload 1: Creates a List Box Widget annotation and initialize it using given Cos/SDF object. Note: Theructor does not copy any data, but is instead the logical equivalent of a type cast. :type d: :py:class:`Obj` :param d: the object to use to initialize the List Box Widget | Overload 2: Creates a List Box Widget annotation and initialize it using given annotation object. Note: Theructor does not copy any data, but is instead the logical equivalent of a type cast. :type annot: :py:class:`Annot` :param annot: The annotation to use. """ _PDFNetPython.ListBoxWidget_swiginit(self, _PDFNetPython.new_ListBoxWidget(args))
[docs] @staticmethod def Create(args): r""" Overload 1: Creates a new List Box Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field_name: string :param field_name: The name of the field for which to create a List Box Widget :rtype: :py:class:`ListBoxWidget` :return: A newly created blank List Box Widget annotation. | Overload 2: Creates a new List Box Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field: :py:class:`Field` :param field: the field for which to create a List Box Widget :rtype: :py:class:`ListBoxWidget` :return: A newly created blank List Box Widget annotation. """ return _PDFNetPython.ListBoxWidget_Create(args)
[docs] def AddOption(self, value): r""" Adds option to List Box Widget. :type value: string :param value: The option to add """ return _PDFNetPython.ListBoxWidget_AddOption(self, value)
[docs] def AddOptions(self, opts): r""" Adds multiple options to List Box Widget. :type opts: std::vector< std::string,std::allocator< std::string > > :param opts: The options to add. """ return _PDFNetPython.ListBoxWidget_AddOptions(self, opts)
[docs] def SetSelectedOptions(self, selected_opts): r""" Sets the options for the ListBox widget. :type selected_opts: std::vector< std::string,std::allocator< std::string > > :param selected_opts: The options to select. """ return _PDFNetPython.ListBoxWidget_SetSelectedOptions(self, selected_opts)
[docs] def GetSelectedOptions(self): r""" Gets all selected options in the List Box widget. :rtype: std::vector< std::string,std::allocator< std::string > > :return: The selected options of the List Box widget """ return _PDFNetPython.ListBoxWidget_GetSelectedOptions(self)
[docs] def GetOptions(self): r""" Gets all options of the List Box widget. :rtype: std::vector< std::string,std::allocator< std::string > > :return: The options of the List Box widget """ return _PDFNetPython.ListBoxWidget_GetOptions(self)
[docs] def ReplaceOptions(self, new_opts): r""" Replaces the current List Box widget options with a new set. :type new_opts: std::vector< std::string,std::allocator< std::string > > :param new_opts: The new set of options to use. """ return _PDFNetPython.ListBoxWidget_ReplaceOptions(self, new_opts)
[docs] def RemoveOption(self, value): r""" Removes the option from List Box widget. :type value: string :param value: The option to remove. """ return _PDFNetPython.ListBoxWidget_RemoveOption(self, value)
__swig_destroy__ = _PDFNetPython.delete_ListBoxWidget
# Register ListBoxWidget in _PDFNetPython: _PDFNetPython.ListBoxWidget_swigregister(ListBoxWidget)
[docs] def ListBoxWidget_Create(args): r""" Overload 1: Creates a new List Box Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field_name: string :param field_name: The name of the field for which to create a List Box Widget :rtype: :py:class:`ListBoxWidget` :return: A newly created blank List Box Widget annotation. | Overload 2: Creates a new List Box Widget annotation, in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document to which the annotation is added. :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type field: :py:class:`Field` :param field: the field for which to create a List Box Widget :rtype: :py:class:`ListBoxWidget` :return: A newly created blank List Box Widget annotation. """ return _PDFNetPython.ListBoxWidget_Create(args)
[docs] class RadioButtonWidget(Widget): r"""An object representing a Radio Button used in a PDF Form.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): r""" Overload 1: Creates a Radio Button Widget annotation and initialize it using given Cos/SDF object. Note: Theructor does not copy any data, but is instead the logical equivalent of a type cast. :type d: :py:class:`Obj` :param d: the object to use to initialize the Radio Button Widget | Overload 2: Creates a Radio Button Widget annotation and initialize it using given annotation object. Note: Theructor does not copy any data, but is instead the logical equivalent of a type cast. :type annot: :py:class:`Annot` :param annot: The annotation to use. """ _PDFNetPython.RadioButtonWidget_swiginit(self, _PDFNetPython.new_RadioButtonWidget(args))
[docs] def GetGroup(self): r""" Gets the group to which the current button is connected. :rtype: :py:class:`RadioButtonGroup` :return: The group containing this Radio Button. """ return _PDFNetPython.RadioButtonWidget_GetGroup(self)
[docs] def EnableButton(self): r"""Enable the current radio button. Note that this may disable other Radio Buttons in the same group.""" return _PDFNetPython.RadioButtonWidget_EnableButton(self)
[docs] def IsEnabled(self): r""" Determines whether this button is enabled. :rtype: boolean :return: A boolean value indicating whether the Radio Button is enabled. """ return _PDFNetPython.RadioButtonWidget_IsEnabled(self)
__swig_destroy__ = _PDFNetPython.delete_RadioButtonWidget
# Register RadioButtonWidget in _PDFNetPython: _PDFNetPython.RadioButtonWidget_swigregister(RadioButtonWidget)
[docs] class RadioButtonGroup(object): r""" An object representing a Group of Radio Buttons that can be used to create new Radio Buttons. If a group contains multiple buttons they will be connected. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Create(args): r""" Creates a new RadioButtonGroup in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document in which the RadioButtonGroup is created. :type field_name: string :param field_name: The name of the field to create and use in this RadioButtonGroup. :rtype: :py:class:`RadioButtonGroup` :return: A newly created RadioButtonGroup. """ return _PDFNetPython.RadioButtonGroup_Create(args)
[docs] def Add(self, args): r""" Adds a new RadioButtonWidget to the RadioButtonGroup :type pos: :py:class:`Rect` :param pos: A rectangle specifying the annotation's bounds, specified in user space coordinates. :type onstate: string :param onstate: The onstate for this button. This will rarely need to be explicitly set. However, it can be used to allow multiple radiobuttons in a group to be on at once if they have the same onstate. :rtype: :py:class:`RadioButtonWidget` :return: A newly created default RadioButtonWidget. """ return _PDFNetPython.RadioButtonGroup_Add(self, args)
[docs] def GetNumButtons(self): r""" Gets the number of buttons in this RadioButtonGroup :rtype: int :return: The number of buttons in this RadioButtonGroup """ return _PDFNetPython.RadioButtonGroup_GetNumButtons(self)
[docs] def GetButton(self, index): r""" Retrieves the button at a given index. :type index: int :param index: The index to use. :rtype: :py:class:`RadioButtonWidget` :return: The RadioButtonWidget at the given index """ return _PDFNetPython.RadioButtonGroup_GetButton(self, index)
[docs] def GetField(self): r""" Gets the field associated with this RadioButtonGroup :rtype: :py:class:`Field` :return: The Field associated with this RadioButtonGroup """ return _PDFNetPython.RadioButtonGroup_GetField(self)
[docs] def AddGroupButtonsToPage(self, page): r""" Add all group buttons to the page :type page: :py:class:`Page` :param page: The page in which to add the buttons. """ return _PDFNetPython.RadioButtonGroup_AddGroupButtonsToPage(self, page)
def __init__(self, args): _PDFNetPython.RadioButtonGroup_swiginit(self, _PDFNetPython.new_RadioButtonGroup(args)) __swig_destroy__ = _PDFNetPython.delete_RadioButtonGroup
# Register RadioButtonGroup in _PDFNetPython: _PDFNetPython.RadioButtonGroup_swigregister(RadioButtonGroup)
[docs] def RadioButtonGroup_Create(args): r""" Creates a new RadioButtonGroup in the specified document. :type doc: :py:class:`PDFDoc` :param doc: The document in which the RadioButtonGroup is created. :type field_name: string :param field_name: The name of the field to create and use in this RadioButtonGroup. :rtype: :py:class:`RadioButtonGroup` :return: A newly created RadioButtonGroup. """ return _PDFNetPython.RadioButtonGroup_Create(args)
[docs] class Element(object): r""" Element is the abstract interface used to access graphical elements used to build the display list. Just like many other classes in PDFNet (e.g. ColorSpace, Font, Annot, etc), Element class follows the composite design pattern. This means that all Elements are accessed through the same interface, but depending on the Element type (that can be obtained using GetType()), only methods related to that type can be called. For example, if GetType() returns e_image, it is illegal to call a method specific to another Element type (i.e. a call to a text specific GetTextData() will throw an Exception). """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_null = _PDFNetPython.Element_e_null e_path = _PDFNetPython.Element_e_path e_text_begin = _PDFNetPython.Element_e_text_begin e_text = _PDFNetPython.Element_e_text e_text_new_line = _PDFNetPython.Element_e_text_new_line e_text_end = _PDFNetPython.Element_e_text_end e_image = _PDFNetPython.Element_e_image e_inline_image = _PDFNetPython.Element_e_inline_image e_shading = _PDFNetPython.Element_e_shading e_form = _PDFNetPython.Element_e_form e_group_begin = _PDFNetPython.Element_e_group_begin e_group_end = _PDFNetPython.Element_e_group_end e_marked_content_begin = _PDFNetPython.Element_e_marked_content_begin e_marked_content_end = _PDFNetPython.Element_e_marked_content_end e_marked_content_point = _PDFNetPython.Element_e_marked_content_point def __nonzero__(self): return _PDFNetPython.Element___nonzero__(self) __bool__ = __nonzero__
[docs] def GetType(self): r""" :rtype: int :return: the current element type. """ return _PDFNetPython.Element_GetType(self)
[docs] def GetGState(self): r""" :rtype: :py:class:`GState` :return: GState of this Element """ return _PDFNetPython.Element_GetGState(self)
[docs] def GetCTM(self): r""" :rtype: :py:class:`Matrix2D` :return: Current Transformation Matrix (CTM) that maps coordinates to the initial user space. """ return _PDFNetPython.Element_GetCTM(self)
[docs] def GetBBox(self): r""" Obtains the bounding box for a graphical element. Calculates the bounding box for a graphical element (i.e. an Element that belongs to one of following types: e_path, e_text, e_image, e_inline_image, e_shading e_form). The returned bounding box is guaranteed to encompass the Element, but is not guaranteed to be the smallest box that could contain the element. For example, for Bezier curves the bounding box will enclose all control points, not just the curve itself. :rtype: :py:class:`Rect` :return: true if this is a graphical element and the bounding box can be calculated; false for non-graphical elements which don't have bounding box. :param out_bbox: (Filled by the method) A reference to a rectangle specifying the bounding box of Element (a rectangle that surrounds the entire element). The coordinates are represented in the default PDF page coordinate system and are using units called points ( 1 point = 1/72 inch = 2.54 /72 centimeter). The bounding box already accounts for the effects of current transformation matrix (CTM), text matrix, font size, and other properties in the graphics state. If this is a non-graphical element (i.e. the method returns false) the bounding box is undefined. """ return _PDFNetPython.Element_GetBBox(self)
[docs] def GetParentStructElement(self): r""" :rtype: :py:class:`SElement` :return: Parent logical structure element (such as 'span' or 'paragraph'). If the Element is not associated with any structure element, the returned SElement will not be valid (i.e. selem.IsValid() -> false). """ return _PDFNetPython.Element_GetParentStructElement(self)
[docs] def GetStructMCID(self): r""" :rtype: int :return: Marked Content Identifier (MCID) for this Element or a negative number if the element is not assigned an identifier/MCID. Marked content identifier can be used to associate an Element with logical structure element that refers to the Element. """ return _PDFNetPython.Element_GetStructMCID(self)
[docs] def IsOCVisible(self): r""" :rtype: boolean :return: true if this element is visible in the optional-content context (OCG::Context). The method considers the context's current OCMD stack, the group ON-OFF states, the non-OC drawing status, the drawing and enumeration mode, and the intent. When enumerating page content, OCG::Context can be passed as a parameter in ElementReader.Begin() method. When using PDFDraw, PDFRasterizer, or PDFView class to render PDF pages use PDFDraw::SetOCGContext() method to select an OC context. """ return _PDFNetPython.Element_IsOCVisible(self)
[docs] def IsClippingPath(self): r""" :rtype: boolean :return: true if the current path element is a clipping path and should be added to clipping path stack. """ return _PDFNetPython.Element_IsClippingPath(self)
[docs] def IsStroked(self): r""" :rtype: boolean :return: true if the current path element should be stroked """ return _PDFNetPython.Element_IsStroked(self)
[docs] def IsFilled(self): r""" :rtype: boolean :return: true if the current path element should be filled """ return _PDFNetPython.Element_IsFilled(self)
[docs] def IsWindingFill(self): r""" :rtype: boolean :return: true if the current path should be filled using non-zero winding rule, or false if the path should be filled using even-odd rule. According non-zero winding rule, you can determine whether a test point is inside or outside a closed curve as follows: Draw a line from a test point to a point that is distant from the curve. Count the number of times the curve crosses the test line from left to right, and count the number of times the curve crosses the test line from right to left. If those two numbers are the same, the test point is outside the curve; otherwise, the test point is inside the curve. According to even-odd rule, you can determine whether a test point is inside or outside a closed curve as follows: Draw a line from the test point to a point that is distant from the curve. If that line crosses the curve an odd number of times, the test point is inside the curve; otherwise, the test point is outside the curve. """ return _PDFNetPython.Element_IsWindingFill(self)
[docs] def IsClipWindingFill(self): r""" :rtype: boolean :return: true if the current clip path is using non-zero winding rule, or false for even-odd rule. """ return _PDFNetPython.Element_IsClipWindingFill(self)
[docs] def GetPathData(self): r""" Returns the PathData stored by the path element. :rtype: :py:class:`PathData` :return: The PathData which contains the operators and corresponding point data. """ return _PDFNetPython.Element_GetPathData(self)
[docs] def SetPathData(self, data): r""" Set the PathData of this element. The PathData contains the array of points stored by the element and the array of path segment types. """ return _PDFNetPython.Element_SetPathData(self, data)
[docs] def SetPathClip(self, clip): r""" Indicate whether the path is a clipping path or non-clipping path :type clip: boolean :param clip: true to set path to clipping path. False for non-clipping path. """ return _PDFNetPython.Element_SetPathClip(self, clip)
[docs] def SetPathStroke(self, stroke): r""" Indicate whether the path should be stroked :type stroke: boolean :param stroke: true to set path to be stroked. False for no stroke path. """ return _PDFNetPython.Element_SetPathStroke(self, stroke)
[docs] def SetPathFill(self, fill): r""" Indicate whether the path should be filled :type fill: boolean :param fill: true to set path to be filled. False for no fill path. """ return _PDFNetPython.Element_SetPathFill(self, fill)
[docs] def SetWindingFill(self, winding_rule): r""" Sets path's fill rule. :type winding_rule: boolean :param winding_rule: if winding_rule is true path will be filled using non-zero winding fill rule, otherwise even-odd fill will be used. """ return _PDFNetPython.Element_SetWindingFill(self, winding_rule)
[docs] def SetClipWindingFill(self, winding_rule): r""" Sets clipping path's fill rule. :type winding_rule: boolean :param winding_rule: if winding_rule is true clipping should use non-zero winding rule, or false for even-odd rule. """ return _PDFNetPython.Element_SetClipWindingFill(self, winding_rule)
[docs] def GetXObject(self): r""" :rtype: :py:class:`Obj` :return: the SDF object of the Image/Form object. """ return _PDFNetPython.Element_GetXObject(self)
[docs] def GetImageData(self): r""" :rtype: :py:class:`Filter` :return: A stream (filter) containing decoded image data """ return _PDFNetPython.Element_GetImageData(self)
[docs] def GetImageDataSize(self): r""" :rtype: int :return: the size of image data in bytes """ return _PDFNetPython.Element_GetImageDataSize(self)
[docs] def GetImageColorSpace(self): r""" Convert PDF image to GDI+ Bitmap. :rtype: :py:class:`ColorSpace` :return: GDI+ bitmap from this image. PDFNet creates a GDI+ bitmap that closely matches the original image in terms of the image depth and the number of color channels. PDF color spaces that do not have a counterpart in GDI+ are converted to RGB. Notes: This method is available only on Windows platforms. :rtype: :py:class:`ColorSpace` :return: The SDF object representing the color space in which image are specified or NULL if the image is an image mask The returned color space may be any type of color space except Pattern. """ return _PDFNetPython.Element_GetImageColorSpace(self)
[docs] def GetImageWidth(self): r""" :rtype: int :return: the width of the image, in samples. """ return _PDFNetPython.Element_GetImageWidth(self)
[docs] def GetImageHeight(self): r""" :rtype: int :return: the height of the image, in samples. """ return _PDFNetPython.Element_GetImageHeight(self)
[docs] def GetDecodeArray(self): r""" :rtype: :py:class:`Obj` :return: Decode array or NULL if the parameter is not specified. A decode object is an array of numbers describing how to map image samples into the range of values appropriate for the color space of the image. If ImageMask is true, the array must be either [0 1] or [1 0]; otherwise, its length must be twice the number of color components required by ColorSpace. Default value depends on the color space, See Table 4.36 in PDF Ref. Manual. """ return _PDFNetPython.Element_GetDecodeArray(self)
[docs] def GetBitsPerComponent(self): r""" :rtype: int :return: the number of bits used to represent each color component. Only a single value may be specified; the number of bits is the same for all color components. Valid values are 1, 2, 4, and 8. """ return _PDFNetPython.Element_GetBitsPerComponent(self)
[docs] def GetComponentNum(self): r""" :rtype: int :return: the number of color components per sample. """ return _PDFNetPython.Element_GetComponentNum(self)
[docs] def IsImageMask(self): r""" :rtype: boolean :return: a boolean indicating whether the inline image is to be treated as an image mask. """ return _PDFNetPython.Element_IsImageMask(self)
[docs] def IsImageInterpolate(self): r""" :rtype: boolean :return: a boolean indicating whether image interpolation is to be performed. """ return _PDFNetPython.Element_IsImageInterpolate(self)
[docs] def GetMask(self): r""" :rtype: :py:class:`Obj` :return: an image XObject defining an image mask to be applied to this image (See 'Explicit Masking', 4.8.5), or an array specifying a range of colors to be applied to it as a color key mask (See 'Color Key Masking'). If IsImageMask() return true, this method will return NULL. """ return _PDFNetPython.Element_GetMask(self)
[docs] def GetImageRenderingIntent(self): r""" :rtype: int :return: The color rendering intent to be used in rendering the image. """ return _PDFNetPython.Element_GetImageRenderingIntent(self)
[docs] def GetTextString(self): r""" :rtype: string :return: a pointer to Unicode string for this text Element. The function maps character codes to Unicode array defined by Adobe Glyph List (http://partners.adobe.com/asn/developer/type/glyphlist.txt). Notes: In PDF text can be encoded using various encoding schemes and in some cases it is not possible to extract Unicode encoding. If it is not possible to map charcode to Unicode the function will map a character to undefined code, 0xFFFD. This code is defined in private Unicode range. If you would like to map raw text to Unicode (or some other encoding) yourself use CharIterators returned by CharBegin()/CharEnd() and PDF::Font code mapping methods. The string owner is the current element (i.e. ElementReader or ElementBuilder). """ return _PDFNetPython.Element_GetTextString(self)
[docs] def GetTextData(self): r""" :rtype: std::vector< unsigned char,std::allocator< unsigned char > > :return: a pointer to the internal text buffer for this text element. Notes: GetTextData() returns the raw text data and not a Unicode string. In PDF text can be encoded using various encoding schemes so it is necessary to consider Font encoding while processing the content of this buffer. Most of the time GetTextString() is what you are looking for instead. GetTextString() maps the raw text directly into Unicode (as specified by Adobe Glyph List (AGL) ). Even if you would prefer to decode text yourself it is more convenient to use CharIterators returned by CharBegin()/CharEnd() and PDF::Font code mapping methods. the buffer owner is the current element (i.e. ElementReader or ElementBuilder). """ return _PDFNetPython.Element_GetTextData(self)
[docs] def GetTextDataSize(self): r""" :rtype: int :return: the size of the internal text buffer returned in GetTextData(). """ return _PDFNetPython.Element_GetTextDataSize(self)
[docs] def GetTextMatrix(self): r""" :rtype: :py:class:`Matrix2D` :return: a reference to the current text matrix (Tm). """ return _PDFNetPython.Element_GetTextMatrix(self)
[docs] def GetCharIterator(self): r""" :rtype: :py:class:`CharIterator` :return: a CharIterator addressing the first CharData element in the text run. CharIterator points to CharData. CharData is a data structure that contains the char_code number (used to retrieve glyph outlines, to map to Unicode, etc.), character positioning information (x, y), and the number of bytes taken by the character within the text buffer. Notes: CharIterator follows the standard STL forward-iterator interface. An example of how to use CharIterator. .. code-block:: c++ for (CharIterator itr = element.GetCharIterator(); itr.HasNext(); itr.Next()) { unsigned int char_code = itr.Current().char_code; double char_pos_x = itr.Current().x; double char_pos_y = itr.Current().y; } Character positioning information (x, y) is represented in text space. In order to get the positioning in the user space, the returned value should be scaled using the text matrix (GetTextMatrix()) and the current transformation matrix (GetCTM()). See section 4.2 'Other Coordinate Spaces' in PDF Reference Manual for details and PDFNet FAQ - "How do I get absolute/relative text and character positioning?". within a text run a character may occupy more than a single byte (e.g. in case of composite/Type0 fonts). The role of CharIterator/CharData is to provide a uniform and easy to use interface to access character information. """ return _PDFNetPython.Element_GetCharIterator(self)
[docs] def GetTextLength(self): r""" :rtype: double :return: The text advance distance in text space. The total sum of all of the advance values from rendering all of the characters within this element, including the advance value on the glyphs, the effect of properties such as 'char-spacing', 'word-spacing' and positioning adjustments on 'TJ' elements. Notes: Computed text length is represented in text space. In order to get the length of the text run in the user space, the returned value should be scaled using the text matrix (GetTextMatrix()) and the current transformation matrix (GetCTM()). See section 4.2 'Other Coordinate Spaces' in PDF Reference Manual for details. """ return _PDFNetPython.Element_GetTextLength(self)
[docs] def GetPosAdjustment(self): r""" :rtype: double :return: The number used to adjust text matrix in horizontal direction when drawing text. The number is expressed in thousandths of a unit of text space. The returned number corresponds to a number value within TJ array. For 'Tj' text strings the returned value is always 0. Notes: because CharIterator positioning information already accounts for TJ adjustments this method is rarely used. """ return _PDFNetPython.Element_GetPosAdjustment(self)
[docs] def GetNewTextLineOffset(self): r""" Returns the offset (out_x, out_y) to the start of the current line relative to the beginning of the previous line. out_x and out_y are numbers expressed in unscaled text space units. The returned numbers correspond to the arguments of 'Td' operator. """ return _PDFNetPython.Element_GetNewTextLineOffset(self)
[docs] def SetNewTextLineOffset(self, dx, dy): r""" Sets the offset (dx, dy) to the start of the current line relative to the beginning of the previous line. :type dx: double :param dx: horizontal offset to the start of the curret line :type dy: double :param dy: vertical offset to the start of the current line """ return _PDFNetPython.Element_SetNewTextLineOffset(self, dx, dy)
[docs] def HasTextMatrix(self): r""" :rtype: boolean :return: true if this element is directly associated with a text matrix (that is Tm operator is just before this text element) or false if the text matrix is default or is inherited from previous text elements. """ return _PDFNetPython.Element_HasTextMatrix(self)
[docs] def SetTextData(self, buf_text_data, text_data_size): r""" Set the text data for the current e_text Element. :type buf_text_data: UChar :param buf_text_data: a pointer to a buffer containing text. :type text_data_size: int :param text_data_size: the size of the internal text buffer """ return _PDFNetPython.Element_SetTextData(self, buf_text_data, text_data_size)
[docs] def SetTextMatrix(self, args): r""" Overload 1: Sets the text matrix for a text element. :type mtx: :py:class:`Matrix2D` :param mtx: The new text matrix for this text element | Overload 2: Sets the text matrix for a text element. This method accepts text transformation matrix components directly. A transformation matrix in PDF is specified by six numbers, usually in the form of an array containing six elements. In its most general form, this array is denoted [a b c d h v]; it can represent any linear transformation from one coordinate system to another. For more information about PDF matrices please refer to section 4.2.2 'Common Transformations' in PDF Reference Manual, and to documentation for Matrix2D class. :type a: double :param a: - horizontal 'scaling' component of the new text matrix. :type b: double :param b: - 'rotation' component of the new text matrix. :type c: double :param c: - 'rotation' component of the new text matrix. :type d: double :param d: - vertical 'scaling' component of the new text matrix. :type h: double :param h: - horizontal translation component of the new text matrix. :type v: double :param v: - vertical translation component of the new text matrix. """ return _PDFNetPython.Element_SetTextMatrix(self, args)
[docs] def SetPosAdjustment(self, adjust): r""" :type adjust: double :param adjust: number to set the horizontal adjustment to Notes: Positive values move the current text element backwards (along text direction). Negative values move the current text element forward (along text direction). """ return _PDFNetPython.Element_SetPosAdjustment(self, adjust)
[docs] def UpdateTextMetrics(self): r""" Recompute the character positioning information (i.e. CharIterator-s) and text length. Element objects caches text length and character positioning information. If the user modifies the text data or graphics state the cached information is not correct. UpdateTextMetrics() can be used to recalculate the correct positioning and length information. """ return _PDFNetPython.Element_UpdateTextMetrics(self)
[docs] def GetShading(self): r""" :rtype: :py:class:`Shading` :return: the SDF object of the Shading object. """ return _PDFNetPython.Element_GetShading(self)
[docs] def GetMCPropertyDict(self): r""" :rtype: :py:class:`Obj` :return: a dictionary containing the property list or NULL if property dictionary is not present. Notes: the function automatically looks under Properties sub-dictionary of the current resource dictionary if the dictionary is not in-line. Therefore you can assume that returned Obj is dictionary if it is not NULL. """ return _PDFNetPython.Element_GetMCPropertyDict(self)
[docs] def GetMCTag(self): r""" :rtype: :py:class:`Obj` :return: a tag is a name object indicating the role or significance of the marked content point/sequence. """ return _PDFNetPython.Element_GetMCTag(self)
__swig_destroy__ = _PDFNetPython.delete_Element def __init__(self, args): _PDFNetPython.Element_swiginit(self, _PDFNetPython.new_Element(args)) mp_elem = property(_PDFNetPython.Element_mp_elem_get, _PDFNetPython.Element_mp_elem_set)
# Register Element in _PDFNetPython: _PDFNetPython.Element_swigregister(Element)
[docs] class ElementBuilder(object): r""" ElementBuilder is used to build new PDF::Elements (e.g. image, text, path, etc) from scratch. In conjunction with ElementWriter, ElementBuilder can be used to create new page content. Notes: Analogous to ElementReader, every call to ElementBuilder.Create? method destroys the Element currently associated with the builder and all previous Element pointers are invalidated. For C++ developers. Analogous to ElementReader, ElementBuilder is the owner of all Element objects it creates. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): _PDFNetPython.ElementBuilder_swiginit(self, _PDFNetPython.new_ElementBuilder()) __swig_destroy__ = _PDFNetPython.delete_ElementBuilder
[docs] def Reset(self, args): r""" The function sets the graphics state of this Element to the given value. If 'gs' parameter is not specified or is NULL the function resets the graphics state of this Element to the default graphics state (i.e. the graphics state at the beginning of the display list). The function can be used in situations where the same ElementBuilder is used to create content on several pages, XObjects, etc. If the graphics state is not Reset() when moving to a new display list, the new Element will have the same graphics state as the last Element in the previous display list (and this may or may not be your intent). Another use of Reset(gs) is to make sure that two Elements have the graphics state. :type gs: :py:class:`GState` :param gs: GState (graphics state) object. If NULL or unspecified, resets graphics state to default. """ return _PDFNetPython.ElementBuilder_Reset(self, args)
[docs] def CreateImage(self, args): r""" Overload 1: Create a content image Element out of a given document Image. :type img: :py:class:`Image` :param img: the given image. | Overload 2: Create a content image Element out of a given document Image. :type img: :py:class:`Image` :param img: the given image. :type mtx: :py:class:`Matrix2D` :param mtx: the image transformation matrix. | Overload 3: Create a content image Element out of a given document Image with the lower left corner at (x, y), and scale factors (hscale, vscale). :type img: :py:class:`Image` :param img: the given image. :type x: double :param x: The horizontal x position to place the lower left corner of the image :type y: double :param y: The vertical x position to place the lower left corner of the image :type hscale: double :param hscale: The horizontal scale of the image :type vscale: double :param vscale: The vertical scale of the image """ return _PDFNetPython.ElementBuilder_CreateImage(self, args)
[docs] def CreateGroupBegin(self): r""" Create e_group_begin Element (i.e. 'q' operator in PDF content stream). The function saves the current graphics state. """ return _PDFNetPython.ElementBuilder_CreateGroupBegin(self)
[docs] def CreateGroupEnd(self): r""" Create e_group_end Element (i.e. 'Q' operator in PDF content stream). The function restores the previous graphics state. """ return _PDFNetPython.ElementBuilder_CreateGroupEnd(self)
[docs] def CreateShading(self, sh): r""" :type sh: :py:class:`Shading` :param sh: A Shading object. Shading objects represent a flat interface around all PDF shading types (e_function_shading, e_axial_shading, etc.) Create a shading Element. """ return _PDFNetPython.ElementBuilder_CreateShading(self, sh)
[docs] def CreateForm(self, args): r""" Overload 1: Create a Form XObject Element. :type form: :py:class:`Obj` :param form: a Form XObject content stream | Overload 2: Create a Form XObject Element using the content of the existing page. This method assumes that the XObject will be used in the same document as the given page. If you need to create the Form XObject in a different document use CreateForm(Page, Doc) method. :type page: :py:class:`Page` :param page: A page used to create the Form XObject. | Overload 3: Create a Form XObject Element using the content of the existing page. Unlike CreateForm(Page) method, you can use this method to create form in another document. :type page: :py:class:`Page` :param page: A page used to create the Form XObject. :type doc: :py:class:`PDFDoc` :param doc: Destination document for the Form XObject. """ return _PDFNetPython.ElementBuilder_CreateForm(self, args)
[docs] def CreateTextBegin(self, args): r""" Overload 1: Start a text block ('BT' operator in PDF content stream). The function installs the given font in the current graphics state. :type font: :py:class:`Font` :param font: font to set the text in the text block to :type font_sz: double :param font_sz: size to set the text in the text block to | Overload 2: Start a text block ('BT' operator in PDF content stream). """ return _PDFNetPython.ElementBuilder_CreateTextBegin(self, args)
[docs] def CreateTextEnd(self): r"""Ends a text block.""" return _PDFNetPython.ElementBuilder_CreateTextEnd(self)
[docs] def CreateTextRun(self, args): r""" Overload 1: Create a text run using the given font. Notes: a text run can be created only within a text block | Overload 2: Create a new text run. Notes: a text run can be created only within a text block you must set the current Font and font size before calling this function. """ return _PDFNetPython.ElementBuilder_CreateTextRun(self, args)
[docs] def CreateUnicodeTextRun(self, text_data, text_data_sz): r""" Create a new Unicode text run. :type text_data: int :param text_data: pointer to Unicode text :type text_data_sz: int :param text_data_sz: number of characters (not bytes) in text_data Notes: you must set the current Font and font size before calling this function and the font must be created using Font::CreateCIDTrueTypeFont() method. a text run can be created only within a text block """ return _PDFNetPython.ElementBuilder_CreateUnicodeTextRun(self, text_data, text_data_sz)
[docs] def CreateShapedTextRun(self, text_data): r""" Create a new text run from shaped text. Shaped Text can be created with an approriate Font, using the Font::GetShapedText() method. :type text_data: :py:class:`ShapedText` :param text_data: the shaped text data Notes: you must set the current Font and font size before calling this function and the font must be created using Font::CreateCIDTrueTypeFont() method, and should be the same font used to generate the shaped text content. For best results, the font should be encoded using the e_Indices encoding scheme. a text run can be created only within a text block """ return _PDFNetPython.ElementBuilder_CreateShapedTextRun(self, text_data)
[docs] def CreateTextNewLine(self, args): r""" Overload 1: Create e_text_new_line Element (i.e. a Td operator in PDF content stream). Move to the start of the next line, offset from the start of the current line by (dx , dy). dx and dy are numbers expressed in unscaled text space units. :type dx: double :param dx: The horizontal x offset from the start of the current line :type dy: double :param dy: The vertical y offset from the start of the current line :rtype: :py:class:`Element` :return: the path Element | Overload 2: Create e_text_new_line Element (i.e. a T operator in PDF content stream). :rtype: :py:class:`Element` :return: the path Element """ return _PDFNetPython.ElementBuilder_CreateTextNewLine(self, args)
[docs] def CreatePath(self, points, seg_types): r""" Create a path Element using given path segment data :rtype: :py:class:`Element` :return: the path Element """ return _PDFNetPython.ElementBuilder_CreatePath(self, points, seg_types)
[docs] def CreateRect(self, x, y, width, height): r""" Create a rectangle path Element. :type x: double :param x: The horizontal coordinate of the lower left corner of the rectangle. :type y: double :param y: The vertical coordinate of the lower left corner of the rectangle. :type width: double :param width: The width of the rectangle. :type height: double :param height: The height of the rectangle. :rtype: :py:class:`Element` :return: the path Element """ return _PDFNetPython.ElementBuilder_CreateRect(self, x, y, width, height)
[docs] def CreateEllipse(self, x, y, width, height): r""" Create an ellipse (or circle, if width == height) path Element. :type x: double :param x: The horizontal x coordinate of the ellipse center. :type y: double :param y: The vertical y coordinate of the ellipse center. :type width: double :param width: The width of the ellipse rectangle. :type height: double :param height: The height of the ellipse rectangle. :rtype: :py:class:`Element` :return: the path Element """ return _PDFNetPython.ElementBuilder_CreateEllipse(self, x, y, width, height)
[docs] def PathBegin(self): r""" Starts building a new path Element that can contain an arbitrary sequence of lines, curves, and rectangles. """ return _PDFNetPython.ElementBuilder_PathBegin(self)
[docs] def PathEnd(self): r""" Finishes building of the path Element. :rtype: :py:class:`Element` :return: the path Element """ return _PDFNetPython.ElementBuilder_PathEnd(self)
[docs] def MoveTo(self, x, y): r""" Set the current point. :type x: double :param x: The horizontal x component of the point :type y: double :param y: The vertical y component of the point """ return _PDFNetPython.ElementBuilder_MoveTo(self, x, y)
[docs] def LineTo(self, x, y): r""" Draw a line from the current point to the given point. :type x: double :param x: The horizontal x component of the goal point :type y: double :param y: The vertical y component of the goal point """ return _PDFNetPython.ElementBuilder_LineTo(self, x, y)
[docs] def CurveTo(self, cx1, cy1, cx2, cy2, x2, y2): r""" Draw a Bezier curve from the current point to the given point (x2, y2) using (cx1, cy1) and (cx2, cy2) as control points. :type cx1: double :param cx1: The x component of the first control point :type cy1: double :param cy1: The y component of the first control point :type cx2: double :param cx2: The x component of the second control point :type cy2: double :param cy2: The y component of the second control point :type x2: double :param x2: The horizontal x component of the goal point :type y2: double :param y2: The vertical y component of the goal point """ return _PDFNetPython.ElementBuilder_CurveTo(self, cx1, cy1, cx2, cy2, x2, y2)
[docs] def ArcTo(self, args): r""" Overload 1: Draw an arc with the specified parameters (lower left corner, width, height and angles). :type x: double :param x: The horizontal x coordinate of the lower left corner of the ellipse encompassing rectangle :type y: double :param y: The horizontal y coordinate of the lower left corner of the ellipse encompassing rectangle :type width: double :param width: overall width of the full ellipse (not considering the angular extents). :type height: double :param height: overall height of the full ellipse (not considering the angular extents). :type start: double :param start: starting angle of the arc in degrees :type extent: double :param extent: angular extent of the arc in degrees | Overload 2: Draw an arc from the current point to the end point. :type xr: double :param xr: x radius for the arc :type yr: double :param yr: y radius for the arc :type rx: double :param rx: x-axis rotation in radians :type isLargeArc: boolean :param isLargeArc: indicates if smaller or larger arc is chosen 1 - one of the two larger arc sweeps is chosen 0 - one of the two smaller arc sweeps is chosen :type sweep: boolean :param sweep: direction in which arc is drawn (1 - clockwise, 0 - counterclockwise) :type endX: double :param endX: x coordinate of end point :type endY: double :param endY: y coordinate of end point Notes: The Arc is defined the same way as it is specified by SVG or XPS standards. For further questions please refer to the XPS or SVG standards. """ return _PDFNetPython.ElementBuilder_ArcTo(self, args)
[docs] def Ellipse(self, x, y, width, height): r""" Add an ellipse (or circle, if rx == ry) to the current path as a complete subpath. Setting the current point is not required before using this function. :type x: double :param x: The x coordinate of the ellipse center. :type y: double :param y: The y coordinate of the ellipse center. :type width: double :param width: The x radii of the ellipse. :type height: double :param height: The y radii of the ellipse. """ return _PDFNetPython.ElementBuilder_Ellipse(self, x, y, width, height)
[docs] def Rect(self, x, y, width, height): r""" Add a rectangle to the current path as a complete subpath. Setting the current point is not required before using this function. :type x: double :param x: The x coordinate of the lower left corner of the rectangle. :type y: double :param y: The y coordinate of the lower left corner of the rectangle. :type width: double :param width: The width of the rectangle. :type height: double :param height: The height of the rectangle. """ return _PDFNetPython.ElementBuilder_Rect(self, x, y, width, height)
[docs] def ClosePath(self): r"""Closes the current subpath.""" return _PDFNetPython.ElementBuilder_ClosePath(self)
[docs] def CreateMarkedContentBeginInlineProperties(self, tag): r""" Create e_marked_content_begin element with an inline property dictionary (i.e. BDC operator in PDF content stream). :type tag: string :param tag: the tag entry for this element. :rtype: :py:class:`Element` :return: the marked content begin element. Notes: The inline property dictionary can be accessed and edited using element.GetMCPropertyDict() """ return _PDFNetPython.ElementBuilder_CreateMarkedContentBeginInlineProperties(self, tag)
[docs] def CreateMarkedContentBegin(self, tag, property_dict): r""" Create e_marked_content_begin element with an associated property dictionary (i.e. BMC or BDC operator in PDF content stream). :type tag: string :param tag: the tag entry for this element. :type property_dict: :py:class:`Obj` :param property_dict: the property dictionary. :rtype: :py:class:`Element` :return: the marked content begin element. """ return _PDFNetPython.ElementBuilder_CreateMarkedContentBegin(self, tag, property_dict)
[docs] def CreateMarkedContentEnd(self): r""" Create e_marked_content_end element (i.e. EMC operator in PDF content stream). :rtype: :py:class:`Element` :return: the marked content end element. """ return _PDFNetPython.ElementBuilder_CreateMarkedContentEnd(self)
[docs] def CreateMarkedContentPointInlineProperties(self, tag): r""" Create e_marked_content_point element with an inline property dictionary (i.e. DP operator in PDF content stream). :type tag: string :param tag: the tag entry for this element. :rtype: :py:class:`Element` :return: the marked content point element. Notes: The inline property dictionary can be accessed and edited using element.GetMCPropertyDict() """ return _PDFNetPython.ElementBuilder_CreateMarkedContentPointInlineProperties(self, tag)
[docs] def CreateMarkedContentPoint(self, tag, property_dict): r""" Create e_marked_content_point element with an associated property dictionary (i.e. MP or DP operator in PDF content stream). :type tag: string :param tag: the tag entry for this element. :type property_dict: :py:class:`Obj` :param property_dict: the property dictionary. :rtype: :py:class:`Element` :return: the marked content point element. """ return _PDFNetPython.ElementBuilder_CreateMarkedContentPoint(self, tag, property_dict)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.ElementBuilder_Destroy(self)
mp_builder = property(_PDFNetPython.ElementBuilder_mp_builder_get, _PDFNetPython.ElementBuilder_mp_builder_set)
# Register ElementBuilder in _PDFNetPython: _PDFNetPython.ElementBuilder_swigregister(ElementBuilder)
[docs] class ElementReader(object): r""" ElementReader can be used to parse and process content streams. ElementReader provides a convenient interface used to traverse the Element display list of a page. The display list representing graphical elements (such as text-runs, paths, images, shadings, forms, etc) is accessed using the intrinsic iterator. ElementReader automatically concatenates page contents spanning multiple streams and provides a mechanism to parse contents of sub-display lists (e.g. forms XObjects and Type3 fonts). A sample use case for ElementReader is given below: .. code-block:: c++ ... ElementReader reader; reader.Begin(page); for (Element element=reader.Next(); element; element = reader.Next()) // Read page contents { switch (element.GetType()) { case Element::e_path: { // Process path data... double data = element.GetPathPoints(); int sz = element.GetPointCount(); } break; case Element::e_text: // ... break; } } reader.End(); For a full sample, please refer to ElementReader and ElementReaderAdvTest sample projects. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_ElementReader
[docs] def Begin(self, args): r""" Overload 1: Begin processing a page. :type page: :py:class:`Page` :param page: A page to start processing. :type ocg_context: :py:class:`Context` :param ocg_context: An optional parameter used to specify the Optional Content (OC) Context that should be used when processing the page. When the OCG::Context is specified, Element::IsOCVisible() will return 'true' or 'false' depending on the visibility of the current Optional Content Group (OCG) and the states of flags in the given context. Notes: When page processing is completed, make sure to call ElementReader.End(). | Overload 2: Begin processing given content stream. The content stream may be a Form XObject, Type3 glyph stream, pattern stream or any other content stream. :type content_stream: :py:class:`Obj` :param content_stream: - A stream object representing the content stream (usually a Form XObject). :type resource_dict: :py:class:`Obj` :param resource_dict: - An optional '/Resource' dictionary parameter. If content stream refers to named resources that are not present in the local Resource dictionary, the names are looked up in the supplied resource dictionary. :type ocg_context: :py:class:`Context` :param ocg_context: An optional parameter used to specify the Optional Content (OC) Context that should be used when processing the page. When the OCG::Context is specified, Element::IsOCVisible() will return 'true' or 'false' depending on the visibility of the current Optional Content Group (OCG) and the states of flags in the given context. Notes: When page processing is completed, make sure to call ElementReader.End(). | Overload 3: Begin processing given content stream. The content stream may be a Form XObject, Type3 glyph stream, pattern stream or any other content stream. :type content_stream: :py:class:`Obj` :param content_stream: - A stream object representing the content stream (usually a Form XObject). :type resource_dict: :py:class:`Obj` :param resource_dict: - An optional '/Resource' dictionary parameter. If content stream refers to named resources that are not present in the local Resource dictionary, the names are looked up in the supplied resource dictionary. :param ocg_context: An optional parameter used to specify the Optional Content (OC) Context that should be used when processing the page. When the OCG::Context is specified, Element::IsOCVisible() will return 'true' or 'false' depending on the visibility of the current Optional Content Group (OCG) and the states of flags in the given context. Notes: When page processing is completed, make sure to call ElementReader.End(). | Overload 4: Begin processing given content stream. The content stream may be a Form XObject, Type3 glyph stream, pattern stream or any other content stream. :type content_stream: :py:class:`Obj` :param content_stream: - A stream object representing the content stream (usually a Form XObject). :param resource_dict: - An optional '/Resource' dictionary parameter. If content stream refers to named resources that are not present in the local Resource dictionary, the names are looked up in the supplied resource dictionary. :param ocg_context: An optional parameter used to specify the Optional Content (OC) Context that should be used when processing the page. When the OCG::Context is specified, Element::IsOCVisible() will return 'true' or 'false' depending on the visibility of the current Optional Content Group (OCG) and the states of flags in the given context. Notes: When page processing is completed, make sure to call ElementReader.End(). """ return _PDFNetPython.ElementReader_Begin(self, args)
[docs] def Next(self): r""" :rtype: :py:class:`Element` :return: a page Element or a 'NULL' element if the end of current-display list was reached. You may use GetType() to determine the type of the returned Element. Notes: Every call to ElementReader::Next() destroys the current Element. Therefore, an Element becomes invalid after subsequent ElementReader::Next() operation. """ return _PDFNetPython.ElementReader_Next(self)
[docs] def Current(self): r""" :rtype: :py:class:`Element` :return: the current Element or a 'NULL' Element. The current element is the one returned in the last call to Next(). Notes: Every call to ElementReader::Next() destroys the current Element. Therefore, an Element becomes invalid after subsequent ElementReader::Next() operation. """ return _PDFNetPython.ElementReader_Current(self)
[docs] def FormBegin(self): r""" When the current element is a form XObject you have the option to skip form processing (by not calling FormBegin()) or to open the form stream and continue Element traversal into the form. To open a form XObject display list use FormBegin() method. The Next() returned Element will be the first Element in the form XObject display list. Subsequent calls to Next() will traverse form's display list until NULL is returned. At any point you can close the form sub-list using ElementReader::End() method. After the form display list is closed (using End()) the processing will return to the parent display list at the point where it left off before entering the form XObject. """ return _PDFNetPython.ElementReader_FormBegin(self)
[docs] def PatternBegin(self, fill_pattern, reset_ctm_tfm=False): r""" A method used to spawn the sub-display list representing the tiling pattern of the current element in the ElementReader. You can call this method at any point as long as the current element is valid. :type fill_pattern: boolean :param fill_pattern: If true, the filling pattern of the current element will be spawned; otherwise, the stroking pattern of the current element will be spawned. Note that the graphics state will be inherited from the parent content stream (the content stream in which the pattern is defined as a resource) automatically. :type reset_ctm_tfm: boolean :param reset_ctm_tfm: An optional parameter used to indicate whether the pattern's display list should set its initial CTM and transformation matrices to identity matrix. In general, we should leave it to be false. To open a tiling pattern sub-display list use PatternBegin(pattern) method. The Next() returned Element will be the first Element in the pattern display list. Subsequent calls to Next() will traverse pattern's display list until NULL is encountered. At any point you can close the pattern sub-list using ElementReader::End() method. After the pattern display list is closed, the processing will return to the parent display list at the point where pattern display list was spawned. """ return _PDFNetPython.ElementReader_PatternBegin(self, fill_pattern, reset_ctm_tfm)
[docs] def Type3FontBegin(self, char_data, resource_dict=0): r""" A method used to spawn a sub-display list representing a Type3 Font glyph. You can call this method at any point as long as the current element in the ElementReader is a text element whose font type is type 3. :type char_data: :py:class:`CharData` :param char_data: The information about the glyph to process. You can get this information by dereferencing a CharIterator. :type resource_dict: :py:class:`Obj` :param resource_dict: - An optional '/Resource' dictionary parameter. If any glyph descriptions refer to named resources but Font Resource dictionary is absent, the names are looked up in the supplied resource dictionary. To open a Type3 font sub-display list use Type3FontBegin() method. The Next() returned Element will be the first Element in the glyph's display list. Subsequent calls to Next() will traverse glyph's display list until NULL is returned. At any point you can close the glyph sub-list using ElementReader::End() method. After the glyph display list is closed, the processing will return to the parent display list at the point where glyph display list was spawned. """ return _PDFNetPython.ElementReader_Type3FontBegin(self, char_data, resource_dict)
[docs] def End(self): r""" Close the current display list. If the current display list is a sub-list created using FormBegin(), PatternBegin(), or Type3FontBegin() methods, the function will end the sub-list and will return processing to the parent display list at the point where it left off before entering the sub-list. :rtype: boolean :return: true if the closed display list is a sub-list or false if it is a root display list. """ return _PDFNetPython.ElementReader_End(self)
[docs] def GetChangesIterator(self): r""" :rtype: :py:class:`GSChangesIterator` :return: an iterator to the beginning of the list containing identifiers of modified graphics state attributes since the last call to ClearChangeList(). The list can be consulted to determine which graphics states were modified between two Elements. Attributes are ordered in the same way as they are set in the content stream. Duplicate attributes are eliminated. """ return _PDFNetPython.ElementReader_GetChangesIterator(self)
[docs] def IsChanged(self, attrib): r""" :rtype: boolean :return: true if given GState attribute was changed since the last call to :type attrib: int :param attrib: the GState attribute to test if it has been changed ClearChangeList(). """ return _PDFNetPython.ElementReader_IsChanged(self, attrib)
[docs] def ClearChangeList(self): r""" Clear the list containing identifiers of modified graphics state attributes. The list of modified attributes is then accumulated during a subsequent call(s) to ElementReader.Next(). """ return _PDFNetPython.ElementReader_ClearChangeList(self)
[docs] def AppendResource(self, res): r""" :type res: :py:class:`Obj` :param res: resource dictionary for finding images, fonts, etc. """ return _PDFNetPython.ElementReader_AppendResource(self, res)
[docs] def GetFont(self, name): r""" :type name: string :param name: string of the name of the SDF/Cos object to get :rtype: :py:class:`Obj` :return: SDF/Cos object matching the specified name in the current resource dictionary. For 'Page' the name is looked up in the page's /Resources/<Class> dictionary. For Form XObjects, Patterns, and Type3 fonts that have a content stream within page content stream the specified resource is first looked-up in the resource dictionary of the inner stream. If the resource is not found, the name is looked up in the outer content stream's resource dictionary. The function returns NULL if the resource was not found. """ return _PDFNetPython.ElementReader_GetFont(self, name)
[docs] def GetXObject(self, name): r""" :type name: string :param name: string of the name of the SDF/Cos object to get Notes: see ElementReader::GetFont """ return _PDFNetPython.ElementReader_GetXObject(self, name)
[docs] def GetShading(self, name): r""" :type name: string :param name: string of the name of the SDF/Cos object to get Notes: see ElementReader::GetFont """ return _PDFNetPython.ElementReader_GetShading(self, name)
[docs] def GetColorSpace(self, name): r""" :type name: string :param name: string of the name of the SDF/Cos object to get Notes: see ElementReader::GetFont """ return _PDFNetPython.ElementReader_GetColorSpace(self, name)
[docs] def GetPattern(self, name): r""" :type name: string :param name: string of the name of the SDF/Cos object to get Notes: see ElementReader::GetFont """ return _PDFNetPython.ElementReader_GetPattern(self, name)
[docs] def GetExtGState(self, name): r""" :type name: string :param name: string of the name of the SDF/Cos object to get Notes: see ElementReader::GetFont """ return _PDFNetPython.ElementReader_GetExtGState(self, name)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.ElementReader_Destroy(self)
def __init__(self, args): _PDFNetPython.ElementReader_swiginit(self, _PDFNetPython.new_ElementReader(args)) mp_reader = property(_PDFNetPython.ElementReader_mp_reader_get, _PDFNetPython.ElementReader_mp_reader_set)
# Register ElementReader in _PDFNetPython: _PDFNetPython.ElementReader_swigregister(ElementReader)
[docs] class ElementWriter(object): r""" ElementWriter can be used to assemble and write new content to a page, Form XObject, Type3 Glyph stream, pattern stream, or any other content stream. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_ElementWriter e_underlay = _PDFNetPython.ElementWriter_e_underlay r""" element is put in the background layer of the page""" e_overlay = _PDFNetPython.ElementWriter_e_overlay r""" element appears on top of the existing graphics""" e_replacement = _PDFNetPython.ElementWriter_e_replacement r""" element will replace current page contents"""
[docs] def Begin(self, args): r""" Overload 1: Begin writing to the given page. By default, new content will be appended to the page, as foreground graphics. It is possible to add new page content as background graphics by setting the second parameter in begin method to 'true' (e.g. writer.Begin(page, true)). :type page: :py:class:`Page` :param page: The page to write content. :type placement: int :param placement: An optional flag indicating whether the new content should be added as a foreground or background layer to the existing page. By default, the new content will appear on top of the existing graphics. :type page_coord_sys: boolean :param page_coord_sys: An optional flag used to select the target coordinate system if true (default), the coordinates are relative to the lower-left corner of the page, otherwise the coordinates are defined in PDF user coordinate system (which may, or may not coincide with the page coordinates). :type compress: boolean :param compress: An optional flag indicating whether the page content stream should be compressed. This may be useful for debugging content streams. Also some applications need to do a clear text search on strings in the PDF files. By default, all content streams are compressed. :type resources: :py:class:`Obj` :param resources: the resource dictionary in which to store resources for the final page. By default, a new resource dictionary will be created. | Overload 2: Begin writing an Element sequence to a new stream. Use this function to write Elements to a content stream other than the page. For example, you can create Form XObjects (See Section '4.9 Form XObjects' in PDF Reference for more details) pattern streams, Type3 font glyph streams, etc. :type doc: :py:class:`SDFDoc` :param doc: - A low-level SDF/Cos document that will contain the new stream. You can access low-level document using PDFDoc::GetSDFDoc() or Obj::GetDoc() methods. :type compress: boolean :param compress: An optional flag indicating whether the page content stream should be compressed. This may be useful for debugging content streams. Also some applications need to do a clear text search on strings in the PDF files. By default, all content streams are compressed. Notes: the newly created content stream object is returned when writing operations are completed (i.e. after the call to ElementWriter::End()). | Overload 3: Begin writing an Element sequence to a new stream. Use this function to write Elements to a content stream other than the page. For example, you can create Form XObjects (See Section '4.9 Form XObjects' in PDF Reference for more details) pattern streams, Type3 font glyph streams, etc. :type doc: :py:class:`SDFDoc` :param doc: - A low-level SDF/Cos document that will contain the new stream. You can access low-level document using PDFDoc::GetSDFDoc() or Obj::GetDoc() methods. :param compress: An optional flag indicating whether the page content stream should be compressed. This may be useful for debugging content streams. Also some applications need to do a clear text search on strings in the PDF files. By default, all content streams are compressed. Notes: the newly created content stream object is returned when writing operations are completed (i.e. after the call to ElementWriter::End()). | Overload 4: Begin writing an Element sequence to a stream. Use this function to write Elements to a content stream which will replace an existing content stream in an object passed as a parameter. :type stream_obj_to_update: :py:class:`Obj` :param stream_obj_to_update: - A low-level SDF stream object that will contain the new stream. Old stream inside that object will be discarded. :type compress: boolean :param compress: An optional flag indicating whether the content stream should be compressed. This may be useful for debugging content streams. Also some applications need to do a clear text search on strings in the PDF files. By default, all content streams are compressed. :type resources: :py:class:`Obj` :param resources: the resource dictionary in which to store resources for the final page. By default, a new resource dictionary will be created. Notes: The content stream object is returned when writing operations are completed (i.e. after the call to ElementWriter::End()). | Overload 5: Begin writing an Element sequence to a stream. Use this function to write Elements to a content stream which will replace an existing content stream in an object passed as a parameter. :type stream_obj_to_update: :py:class:`Obj` :param stream_obj_to_update: - A low-level SDF stream object that will contain the new stream. Old stream inside that object will be discarded. :type compress: boolean :param compress: An optional flag indicating whether the content stream should be compressed. This may be useful for debugging content streams. Also some applications need to do a clear text search on strings in the PDF files. By default, all content streams are compressed. :param resources: the resource dictionary in which to store resources for the final page. By default, a new resource dictionary will be created. Notes: The content stream object is returned when writing operations are completed (i.e. after the call to ElementWriter::End()). | Overload 6: Begin writing an Element sequence to a stream. Use this function to write Elements to a content stream which will replace an existing content stream in an object passed as a parameter. :type stream_obj_to_update: :py:class:`Obj` :param stream_obj_to_update: - A low-level SDF stream object that will contain the new stream. Old stream inside that object will be discarded. :param compress: An optional flag indicating whether the content stream should be compressed. This may be useful for debugging content streams. Also some applications need to do a clear text search on strings in the PDF files. By default, all content streams are compressed. :param resources: the resource dictionary in which to store resources for the final page. By default, a new resource dictionary will be created. Notes: The content stream object is returned when writing operations are completed (i.e. after the call to ElementWriter::End()). """ return _PDFNetPython.ElementWriter_Begin(self, args)
[docs] def End(self): r""" Finish writing to a page :rtype: :py:class:`Obj` :return: A low-level stream object that was used to store Elements. """ return _PDFNetPython.ElementWriter_End(self)
[docs] def WriteElement(self, element): r""" Writes the Element to the content stream. :type element: :py:class:`Element` :param element: The element to write to the content stream. """ return _PDFNetPython.ElementWriter_WriteElement(self, element)
[docs] def WritePlacedElement(self, element): r""" A utility function that surrounds the given Element with a graphics state Save/Restore Element (i.e. in PDF content stream represented as 'q element Q'). The function is equivalent to calling WriteElement three times: WriteElement(eSave); WriteElement(element); WriteElement(eRestore); where eSave is 'e_group_begin' and eRestore is 'e_group_end' Element The function is useful when XObjects such as Images and Forms are drawn on the page. :type element: :py:class:`Element` :param element: Element object to enact function on. """ return _PDFNetPython.ElementWriter_WritePlacedElement(self, element)
[docs] def Flush(self): r""" The Flush method flushes all pending Element writing operations. This method is typically only required to be called when intermixing direct content writing (i.e. WriteBuffer/WriteString) with Element writing. """ return _PDFNetPython.ElementWriter_Flush(self)
[docs] def WriteBuffer(self, data): r""" Writes an arbitrary buffer to the content stream. This function can be used to insert comments, inline-image data, and chunks of arbitrary content to the output stream. """ return _PDFNetPython.ElementWriter_WriteBuffer(self, data)
[docs] def WriteString(self, str): r""" Writes an arbitrary string to the content stream. Serves the same purpose as WriteBuffer(). :type str: string :param str: String to write to the content stream. """ return _PDFNetPython.ElementWriter_WriteString(self, str)
[docs] def WriteGStateChanges(self, element): r""" Write only the graphics state changes applied to this element and skip writing the element itself. This is especially useful when rewriting page content, but with the intention to skip certain elements. :type element: :py:class:`Element` :param element: The element for which to write graphics state changes. """ return _PDFNetPython.ElementWriter_WriteGStateChanges(self, element)
[docs] def SetDefaultGState(self, reader): r""" This method is used to initialize ElementWriter state with the state of a given ElementReader. This can be used to avoid incorrectly writing inherited GState attributes. :type reader: :py:class:`ElementReader` :param reader: ElementReader. """ return _PDFNetPython.ElementWriter_SetDefaultGState(self, reader)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.ElementWriter_Destroy(self)
mp_writer = property(_PDFNetPython.ElementWriter_mp_writer_get, _PDFNetPython.ElementWriter_mp_writer_set) def __init__(self, args): _PDFNetPython.ElementWriter_swiginit(self, _PDFNetPython.new_ElementWriter(args))
# Register ElementWriter in _PDFNetPython: _PDFNetPython.ElementWriter_swigregister(ElementWriter)
[docs] class Image2RGB(Filter): r""" Image2RGB is a filter that can decompress and normalize any PDF image stream (e.g. monochrome, CMYK, etc) into a raw RGB pixel stream. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): _PDFNetPython.Image2RGB_swiginit(self, _PDFNetPython.new_Image2RGB(args)) __swig_destroy__ = _PDFNetPython.delete_Image2RGB
# Register Image2RGB in _PDFNetPython: _PDFNetPython.Image2RGB_swigregister(Image2RGB)
[docs] class Image2RGBA(Filter): r""" Image2RGBA is a filter that can decompress and normalize any PDF image stream (e.g. monochrome, CMYK, etc) into a raw RGBA pixel stream. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): _PDFNetPython.Image2RGBA_swiginit(self, _PDFNetPython.new_Image2RGBA(args)) __swig_destroy__ = _PDFNetPython.delete_Image2RGBA
# Register Image2RGBA in _PDFNetPython: _PDFNetPython.Image2RGBA_swigregister(Image2RGBA)
[docs] class Highlight(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, args): _PDFNetPython.Highlight_swiginit(self, _PDFNetPython.new_Highlight(args)) page_num = property(_PDFNetPython.Highlight_page_num_get, _PDFNetPython.Highlight_page_num_set) position = property(_PDFNetPython.Highlight_position_get, _PDFNetPython.Highlight_position_set) length = property(_PDFNetPython.Highlight_length_get, _PDFNetPython.Highlight_length_set) __swig_destroy__ = _PDFNetPython.delete_Highlight
# Register Highlight in _PDFNetPython: _PDFNetPython.Highlight_swigregister(Highlight)
[docs] class Highlights(object): r""" Highlights is used to store the necessary information and perform certain tasks in accordance with Adobe's Highlight standard, whose details can be found at: http://partners.adobe.com/public/developer/en/pdf/HighlightFileFormat.pdf In a nutshell, the Highlights class maintains a set of highlights. Each highlight contains three pieces of information: page: the number of the page this Highlight is on; position: the start position (text offset) of this Highlight; length: the length of this Highlight. Possible use case scenarios for Highlights include: - Load a Highlight file (in XML format) and highlight the corresponding texts in the viewer (e.g., if the viewer is implemented using PDFViewCtrl, it can be achieved simply by calling PDFViewCtrl::SelectByHighlights() method); - Save the Highlight information (e.g.,ructed by the TextSearch class) to an XML file for external uses. Note: - The Highlights class does not maintain the corresponding PDF document for its highlights. It is the user's responsibility to match them up. - The Highlights class ensures that each highlight it maintains is unique (no two highlights have the same page, position and length values). - The current implementation of Highlights only supports the 'characters' encoding for 'units' as described in the format; the 'words' encoding is not supported at this point. For a sample code, please take a look at the TextSearchTest sample project. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_Highlights
[docs] def Load(self, file_name): r""" Load the Highlight information from a file. Note that the pre-existing Highlight information is discarded. :type file_name: string :param file_name: the name of the file to load from. """ return _PDFNetPython.Highlights_Load(self, file_name)
[docs] def Save(self, file_name): r""" Save the current Highlight information in the class to a file. :type file_name: string :param file_name: the name of the file to save to. """ return _PDFNetPython.Highlights_Save(self, file_name)
[docs] def SaveToString(self): r""" Save the current Highlight information in the class to an XML string. :rtype: string :return: the highlight XML file contents as a string """ return _PDFNetPython.Highlights_SaveToString(self)
[docs] def Add(self, hlts): r""" Add highlights. :type hlts: :py:class:`Highlights` :param hlts: the Highlights instance containing the highlights to be added. """ return _PDFNetPython.Highlights_Add(self, hlts)
[docs] def Clear(self): r"""Clear the current Highlight information in the class.""" return _PDFNetPython.Highlights_Clear(self)
[docs] def Begin(self, doc): r""" Rewind the internal pointer to the first highlight. :type doc: :py:class:`PDFDoc` :param doc: the PDF document to which the highlights correspond. Notes: the PDF document can be a dummy document unless GetCurrentQuads() is to be called. """ return _PDFNetPython.Highlights_Begin(self, doc)
[docs] def HasNext(self): r"""Query if there is any subsequent highlight after the current highlight.""" return _PDFNetPython.Highlights_HasNext(self)
[docs] def Next(self): r"""Move the current highlight to the next highlight.""" return _PDFNetPython.Highlights_Next(self)
[docs] def GetCurrentPageNumber(self): r"""Get the page number of the current highlight.""" return _PDFNetPython.Highlights_GetCurrentPageNumber(self)
[docs] def GetCurrentQuads(self): r""" Get the corresponding quadrangles of the current highlight. :param quads: the output pointer to the resulting quadrangles. :rtype: std::vector< PDF::QuadPoint,std::allocator< PDF::QuadPoint > > :return: the number of the resulting quadrangles. Each quadrangle has eight doubles (x1, y1), (x2, y2), (x3, y3), (x4, y4) denoting the four vertices in counter-clockwise order. Notes: the 'quads' array is owned by the current Highlights and does not need to be explicitly released. Since a highlight may correspond to multiple quadrangles, e.g., when it crosses a line, the number of resulting quadrangles may be larger than 1. """ return _PDFNetPython.Highlights_GetCurrentQuads(self)
[docs] def GetCurrentTextRange(self): r"""Get a TextRange object that represents the current highlight.""" return _PDFNetPython.Highlights_GetCurrentTextRange(self)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.Highlights_Destroy(self)
[docs] @staticmethod def CreateInternal(impl): return _PDFNetPython.Highlights_CreateInternal(impl)
[docs] def GetHandleInternal(self): return _PDFNetPython.Highlights_GetHandleInternal(self)
mp_highlights = property(_PDFNetPython.Highlights_mp_highlights_get, _PDFNetPython.Highlights_mp_highlights_set) def __init__(self, args): _PDFNetPython.Highlights_swiginit(self, _PDFNetPython.new_Highlights(args))
# Register Highlights in _PDFNetPython: _PDFNetPython.Highlights_swigregister(Highlights)
[docs] def Highlights_CreateInternal(impl): return _PDFNetPython.Highlights_CreateInternal(impl)
[docs] class TextRange(object): r""" The TextRange class represents a contiguous range of text on a PDF page. It may be the result of a text search, or simply a couple of highlighted or underlined words. Each text range contains a few pieces of information: page: the number of the page this piece of text is on; position: the start position (text offset); length: the length. You are able to retrieve further information about the text range, such as its coordinates, the text itself, as well as characters before and after. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_TextRange
[docs] def GetPageNumber(self): r"""Get the page number of the text range.""" return _PDFNetPython.TextRange_GetPageNumber(self)
[docs] def GetQuads(self): r""" Get the corresponding quadrangles of the text range. :rtype: std::vector< PDF::QuadPoint,std::allocator< PDF::QuadPoint > > :return: the number of the resulting quadrangles. Each quadrangle has eight doubles (x1, y1), (x2, y2), (x3, y3), (x4, y4) denoting the four vertices in counter-clockwise order. Notes: the 'quads' array is owned by the current TextRange and does not need to be explicitly released. Since a highlight may correspond to multiple quadrangles, e.g., when it crosses a line, the number of resulting quadrangles may be larger than 1. """ return _PDFNetPython.TextRange_GetQuads(self)
[docs] def GetText(self): r""" Get the Unicode string content of the text range. :rtype: string :return: the text within the range """ return _PDFNetPython.TextRange_GetText(self)
[docs] def GetTextBefore(self, count): r""" Get the Unicode string content immediately before the text range. :type count: int :param count: the number of characters to retrieve before the text range :rtype: string :return: the text before the range """ return _PDFNetPython.TextRange_GetTextBefore(self, count)
[docs] def GetTextAfter(self, count): r""" Get the Unicode string content immediately after the text range. :type count: int :param count: the number of characters to retrieve before the text range :rtype: string :return: the text after the range """ return _PDFNetPython.TextRange_GetTextAfter(self, count)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.TextRange_Destroy(self)
[docs] @staticmethod def CreateInternal(impl): return _PDFNetPython.TextRange_CreateInternal(impl)
[docs] def GetHandleInternal(self): return _PDFNetPython.TextRange_GetHandleInternal(self)
mp_textrange = property(_PDFNetPython.TextRange_mp_textrange_get, _PDFNetPython.TextRange_mp_textrange_set) def __init__(self, args): _PDFNetPython.TextRange_swiginit(self, _PDFNetPython.new_TextRange(args))
# Register TextRange in _PDFNetPython: _PDFNetPython.TextRange_swigregister(TextRange)
[docs] def TextRange_CreateInternal(impl): return _PDFNetPython.TextRange_CreateInternal(impl)
[docs] class OCROptions(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): _PDFNetPython.OCROptions_swiginit(self, _PDFNetPython.new_OCROptions()) __swig_destroy__ = _PDFNetPython.delete_OCROptions
[docs] def AddIgnoreZonesForPage(self, regions, page_num): r""" Adds a collection of ignorable regions for the given page, an optional list of page areas not to be included in analysis :type regions: :py:class:`RectCollection` :param regions:: the zones to be added to the ignore list :type page_num: int :param page_num:: the page number the added regions belong to :rtype: :py:class:`OCROptions` :return: this object, for call chaining """ return _PDFNetPython.OCROptions_AddIgnoreZonesForPage(self, regions, page_num)
[docs] def AddLang(self, lang): r""" Adds a language to the list of to be considered when processing this document :type lang: string :param lang:: the new language to be added to the language list :rtype: :py:class:`OCROptions` :return: this object, for call chaining """ return _PDFNetPython.OCROptions_AddLang(self, lang)
[docs] def AddTextZonesForPage(self, regions, page_num): r""" Adds a collection of text regions of interest for the given page, an optional list of known text zones that will be used to improve OCR quality :type regions: :py:class:`RectCollection` :param regions:: the zones to be added to the text region list :type page_num: int :param page_num:: the page number the added regions belong to :rtype: :py:class:`OCROptions` :return: this object, for call chaining """ return _PDFNetPython.OCROptions_AddTextZonesForPage(self, regions, page_num)
[docs] def AddDPI(self, dpi): r""" Knowing proper image resolution is important, as it enables the OCR engine to translate pixel heights of characters to their respective font sizes. We do our best to retrieve resolution information from the input's metadata, however it occasionally can be corrupt or missing. Hence we allow manual override of source's resolution, which supersedes any metadata found (both explicit as in image metadata and implicit as in PDF). :type dpi: int :param dpi:: image resolution :rtype: :py:class:`OCROptions` :return: this object, for call chaining """ return _PDFNetPython.OCROptions_AddDPI(self, dpi)
[docs] def SetUsePDFPageCoords(self, value): r""" Sets the value for UsePDFPageCoords in the options object Sets origin of the coordinate system for input/output :type value: boolean :param value:: If true, sets origin of the coordinate system for input/output to the bottom left corner and reverses the direction of y-coordinate axis from downward to upward, otherwise top left corner is used as the origin and the y-coordinate axis direction is downward :rtype: :py:class:`OCROptions` :return: this object, for call chaining """ return _PDFNetPython.OCROptions_SetUsePDFPageCoords(self, value)
[docs] def SetIgnoreExistingText(self, value): r""" Sets the value for IgnoreExistingText in the options object Default value is false, so that areas with existing text will be automatically skipped during OCR. Setting to true probably only makes sense when used with GetOCRJson/XML, as pre-existing text might end up being duplicated in the document when used with ImageToPDF and ProcessPDF. :type value: boolean :param value:: the new value for IgnoreExistingText :rtype: :py:class:`OCROptions` :return: this object, for call chaining """ return _PDFNetPython.OCROptions_SetIgnoreExistingText(self, value)
[docs] def GetAutoRotate(self): r""" Gets the value AutoRotate from the options object Default value is false. Setting to true will deskew the image before conducting OCR. :rtype: boolean :return: a bool, the current value for AutoRotate. """ return _PDFNetPython.OCROptions_GetAutoRotate(self)
[docs] def SetAutoRotate(self, value): r""" Sets the value for AutoRotate in the options object Default value is false. Setting to true will deskew the image before conducting OCR. :type value: boolean :param value:: the new value for AutoRotate :rtype: :py:class:`OCROptions` :return: this object, for call chaining """ return _PDFNetPython.OCROptions_SetAutoRotate(self, value)
[docs] def GetOCREngine(self): r""" Gets the value OCREngine from the options object Backend engine to use for OCR processing. Options include 'default', 'any', or 'iris'. Chosen module must be present and correctly licensed. :rtype: string :return: a string, the current value for OCREngine. """ return _PDFNetPython.OCROptions_GetOCREngine(self)
[docs] def SetOCREngine(self, value): r""" Sets the value for OCREngine in the options object Backend engine to use for OCR processing. Options include 'default', 'any', or 'iris'. Chosen module must be present and correctly licensed. :type value: string :param value:: the new value for OCREngine :rtype: :py:class:`OCROptions` :return: this object, for call chaining """ return _PDFNetPython.OCROptions_SetOCREngine(self, value)
[docs] def GetInternalObj(self): return _PDFNetPython.OCROptions_GetInternalObj(self)
# Register OCROptions in _PDFNetPython: _PDFNetPython.OCROptions_swigregister(OCROptions)
[docs] class OCRModule(object): r""" The class OCRModule. static interface to PDFTron SDKs OCR functionality """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def IsModuleAvailable(): r""" Find out whether the OCR module is available (and licensed). :rtype: boolean :return: returns true if OCR operations can be performed. """ return _PDFNetPython.OCRModule_IsModuleAvailable()
[docs] @staticmethod def IsIRISModuleAvailable(): r""" Find out whether the IRIS OCR module is available. :rtype: boolean :return: returns true if the IRIS ocr module has been located. """ return _PDFNetPython.OCRModule_IsIRISModuleAvailable()
[docs] @staticmethod def ImageToPDF(dst, src, options): r""" Convert an image to a PDF with searchable text. :type dst: :py:class:`PDFDoc` :param dst: -- The destination document. :type src: string :param src: -- The path to the input image. :type options: :py:class:`OCROptions` :param options: -- OCR options (optional). """ return _PDFNetPython.OCRModule_ImageToPDF(dst, src, options)
[docs] @staticmethod def ProcessPDF(dst, options): r""" Add searchable and selectable text to raster images within a PDF. :type dst: :py:class:`PDFDoc` :param dst: -- The source and destination document. :type options: :py:class:`OCROptions` :param options: -- OCR options (optional). """ return _PDFNetPython.OCRModule_ProcessPDF(dst, options)
[docs] @staticmethod def GetOCRJsonFromImage(dst, src, options): r""" Perform OCR on an image and return resulting JSON string. Side effect: source image is converted to PDF and stored in the destination document. The box is a summary for a text fragment bounding box (leftmost x, bottommost y, width, height) The box coordinates are in units of points (1/72 of an inch), with the origin at the top left, and larger x and y coordinates representing further right and down, respectively :type dst: :py:class:`PDFDoc` :param dst: -- The destination document. :type src: string :param src: -- The path to the input image. :type options: :py:class:`OCROptions` :param options: -- OCR options (optional). :rtype: string :return: JSON string representing OCR results. """ return _PDFNetPython.OCRModule_GetOCRJsonFromImage(dst, src, options)
[docs] @staticmethod def GetOCRJsonFromPDF(src, options): r""" Perform OCR on raster images within a PDF and return resulting JSON string. The box is a summary for a text fragment bounding box (leftmost x, bottommost y, width, height) The box coordinates are in units of points (1/72 of an inch), with the origin at the top left, and larger x and y coordinates representing further right and down, respectively :type src: :py:class:`PDFDoc` :param src: -- The source document. :type options: :py:class:`OCROptions` :param options: -- OCR options (optional). :rtype: string :return: JSON string representing OCR results. """ return _PDFNetPython.OCRModule_GetOCRJsonFromPDF(src, options)
[docs] @staticmethod def ApplyOCRJsonToPDF(dst, json): r""" Add hidden text layer to a PDF consisting of raster image(s). :type dst: :py:class:`PDFDoc` :param dst: -- The source and destination document. :type json: string :param json: -- JSON representing OCR results. """ return _PDFNetPython.OCRModule_ApplyOCRJsonToPDF(dst, json)
[docs] @staticmethod def GetOCRXmlFromImage(dst, src, options): r""" Perform OCR on an image and return resulting XML string. Side effect: source image is converted to PDF and stored in the destination document. The box is a summary for a text fragment bounding box (leftmost x, bottommost y, width, height) The box coordinates are in units of points (1/72 of an inch), with the origin at the top left, and larger x and y coordinates representing further right and down, respectively :type dst: :py:class:`PDFDoc` :param dst: -- The destination document. :type src: string :param src: -- The path to the input image. :type options: :py:class:`OCROptions` :param options: -- OCR options (optional). :rtype: string :return: XML string representing OCR results. """ return _PDFNetPython.OCRModule_GetOCRXmlFromImage(dst, src, options)
[docs] @staticmethod def GetOCRXmlFromPDF(src, options): r""" Perform OCR on raster images within a PDF and return resulting XML string. The box is a summary for a text fragment bounding box (leftmost x, bottommost y, width, height) The box coordinates are in units of points (1/72 of an inch), with the origin at the top left, and larger x and y coordinates representing further right and down, respectively :type src: :py:class:`PDFDoc` :param src: -- The source document. :type options: :py:class:`OCROptions` :param options: -- OCR options (optional). :rtype: string :return: XML string representing OCR results. """ return _PDFNetPython.OCRModule_GetOCRXmlFromPDF(src, options)
[docs] @staticmethod def ApplyOCRXmlToPDF(dst, xml): r""" Add hidden text layer to a PDF consisting of raster image(s). :type dst: :py:class:`PDFDoc` :param dst: -- The source and destination document. :type xml: string :param xml: -- XML representing OCR results. """ return _PDFNetPython.OCRModule_ApplyOCRXmlToPDF(dst, xml)
def __init__(self): _PDFNetPython.OCRModule_swiginit(self, _PDFNetPython.new_OCRModule()) __swig_destroy__ = _PDFNetPython.delete_OCRModule
# Register OCRModule in _PDFNetPython: _PDFNetPython.OCRModule_swigregister(OCRModule)
[docs] def OCRModule_IsModuleAvailable(): r""" Find out whether the OCR module is available (and licensed). :rtype: boolean :return: returns true if OCR operations can be performed. """ return _PDFNetPython.OCRModule_IsModuleAvailable()
[docs] def OCRModule_IsIRISModuleAvailable(): r""" Find out whether the IRIS OCR module is available. :rtype: boolean :return: returns true if the IRIS ocr module has been located. """ return _PDFNetPython.OCRModule_IsIRISModuleAvailable()
[docs] def OCRModule_ImageToPDF(dst, src, options): r""" Convert an image to a PDF with searchable text. :type dst: :py:class:`PDFDoc` :param dst: -- The destination document. :type src: string :param src: -- The path to the input image. :type options: :py:class:`OCROptions` :param options: -- OCR options (optional). """ return _PDFNetPython.OCRModule_ImageToPDF(dst, src, options)
[docs] def OCRModule_ProcessPDF(dst, options): r""" Add searchable and selectable text to raster images within a PDF. :type dst: :py:class:`PDFDoc` :param dst: -- The source and destination document. :type options: :py:class:`OCROptions` :param options: -- OCR options (optional). """ return _PDFNetPython.OCRModule_ProcessPDF(dst, options)
[docs] def OCRModule_GetOCRJsonFromImage(dst, src, options): r""" Perform OCR on an image and return resulting JSON string. Side effect: source image is converted to PDF and stored in the destination document. The box is a summary for a text fragment bounding box (leftmost x, bottommost y, width, height) The box coordinates are in units of points (1/72 of an inch), with the origin at the top left, and larger x and y coordinates representing further right and down, respectively :type dst: :py:class:`PDFDoc` :param dst: -- The destination document. :type src: string :param src: -- The path to the input image. :type options: :py:class:`OCROptions` :param options: -- OCR options (optional). :rtype: string :return: JSON string representing OCR results. """ return _PDFNetPython.OCRModule_GetOCRJsonFromImage(dst, src, options)
[docs] def OCRModule_GetOCRJsonFromPDF(src, options): r""" Perform OCR on raster images within a PDF and return resulting JSON string. The box is a summary for a text fragment bounding box (leftmost x, bottommost y, width, height) The box coordinates are in units of points (1/72 of an inch), with the origin at the top left, and larger x and y coordinates representing further right and down, respectively :type src: :py:class:`PDFDoc` :param src: -- The source document. :type options: :py:class:`OCROptions` :param options: -- OCR options (optional). :rtype: string :return: JSON string representing OCR results. """ return _PDFNetPython.OCRModule_GetOCRJsonFromPDF(src, options)
[docs] def OCRModule_ApplyOCRJsonToPDF(dst, json): r""" Add hidden text layer to a PDF consisting of raster image(s). :type dst: :py:class:`PDFDoc` :param dst: -- The source and destination document. :type json: string :param json: -- JSON representing OCR results. """ return _PDFNetPython.OCRModule_ApplyOCRJsonToPDF(dst, json)
[docs] def OCRModule_GetOCRXmlFromImage(dst, src, options): r""" Perform OCR on an image and return resulting XML string. Side effect: source image is converted to PDF and stored in the destination document. The box is a summary for a text fragment bounding box (leftmost x, bottommost y, width, height) The box coordinates are in units of points (1/72 of an inch), with the origin at the top left, and larger x and y coordinates representing further right and down, respectively :type dst: :py:class:`PDFDoc` :param dst: -- The destination document. :type src: string :param src: -- The path to the input image. :type options: :py:class:`OCROptions` :param options: -- OCR options (optional). :rtype: string :return: XML string representing OCR results. """ return _PDFNetPython.OCRModule_GetOCRXmlFromImage(dst, src, options)
[docs] def OCRModule_GetOCRXmlFromPDF(src, options): r""" Perform OCR on raster images within a PDF and return resulting XML string. The box is a summary for a text fragment bounding box (leftmost x, bottommost y, width, height) The box coordinates are in units of points (1/72 of an inch), with the origin at the top left, and larger x and y coordinates representing further right and down, respectively :type src: :py:class:`PDFDoc` :param src: -- The source document. :type options: :py:class:`OCROptions` :param options: -- OCR options (optional). :rtype: string :return: XML string representing OCR results. """ return _PDFNetPython.OCRModule_GetOCRXmlFromPDF(src, options)
[docs] def OCRModule_ApplyOCRXmlToPDF(dst, xml): r""" Add hidden text layer to a PDF consisting of raster image(s). :type dst: :py:class:`PDFDoc` :param dst: -- The source and destination document. :type xml: string :param xml: -- XML representing OCR results. """ return _PDFNetPython.OCRModule_ApplyOCRXmlToPDF(dst, xml)
[docs] class CADModule(object): r""" The class CADModule. static interface to PDFTron SDKs CAD functionality """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def IsModuleAvailable(): r""" Find out whether the CAD module is available (and licensed). :rtype: boolean :return: returns true if CAD operations can be performed. """ return _PDFNetPython.CADModule_IsModuleAvailable()
def __init__(self): _PDFNetPython.CADModule_swiginit(self, _PDFNetPython.new_CADModule()) __swig_destroy__ = _PDFNetPython.delete_CADModule
# Register CADModule in _PDFNetPython: _PDFNetPython.CADModule_swigregister(CADModule)
[docs] def CADModule_IsModuleAvailable(): r""" Find out whether the CAD module is available (and licensed). :rtype: boolean :return: returns true if CAD operations can be performed. """ return _PDFNetPython.CADModule_IsModuleAvailable()
[docs] class AdvancedImagingModule(object): r""" The class AdvancedImagingModule. static interface to PDFTron SDKs AdvancedImaging functionality """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def IsModuleAvailable(): r""" Find out whether the AdvancedImaging module is available (and licensed). :rtype: boolean :return: returns true if AdvancedImaging operations can be performed. """ return _PDFNetPython.AdvancedImagingModule_IsModuleAvailable()
def __init__(self): _PDFNetPython.AdvancedImagingModule_swiginit(self, _PDFNetPython.new_AdvancedImagingModule()) __swig_destroy__ = _PDFNetPython.delete_AdvancedImagingModule
# Register AdvancedImagingModule in _PDFNetPython: _PDFNetPython.AdvancedImagingModule_swigregister(AdvancedImagingModule)
[docs] def AdvancedImagingModule_IsModuleAvailable(): r""" Find out whether the AdvancedImaging module is available (and licensed). :rtype: boolean :return: returns true if AdvancedImaging operations can be performed. """ return _PDFNetPython.AdvancedImagingModule_IsModuleAvailable()
[docs] class PDF2HtmlReflowParagraphsModule(object): r""" The class PDF2HtmlReflowParagraphsModule. static interface to PDFTron SDKs PDF to HTML functionality """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def IsModuleAvailable(): r""" Find out whether the pdf2html module is available (and licensed). :rtype: boolean :return: returns true if pdf2html operations can be performed. """ return _PDFNetPython.PDF2HtmlReflowParagraphsModule_IsModuleAvailable()
def __init__(self): _PDFNetPython.PDF2HtmlReflowParagraphsModule_swiginit(self, _PDFNetPython.new_PDF2HtmlReflowParagraphsModule()) __swig_destroy__ = _PDFNetPython.delete_PDF2HtmlReflowParagraphsModule
# Register PDF2HtmlReflowParagraphsModule in _PDFNetPython: _PDFNetPython.PDF2HtmlReflowParagraphsModule_swigregister(PDF2HtmlReflowParagraphsModule)
[docs] def PDF2HtmlReflowParagraphsModule_IsModuleAvailable(): r""" Find out whether the pdf2html module is available (and licensed). :rtype: boolean :return: returns true if pdf2html operations can be performed. """ return _PDFNetPython.PDF2HtmlReflowParagraphsModule_IsModuleAvailable()
[docs] class PDF2WordModule(object): r""" The class PDF2WordModule. static interface to PDFTron SDKs PDF to Word functionality """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def IsModuleAvailable(): r""" Find out whether the pdf2word module is available (and licensed). :rtype: boolean :return: returns true if pdf2word operations can be performed. """ return _PDFNetPython.PDF2WordModule_IsModuleAvailable()
def __init__(self): _PDFNetPython.PDF2WordModule_swiginit(self, _PDFNetPython.new_PDF2WordModule()) __swig_destroy__ = _PDFNetPython.delete_PDF2WordModule
# Register PDF2WordModule in _PDFNetPython: _PDFNetPython.PDF2WordModule_swigregister(PDF2WordModule)
[docs] def PDF2WordModule_IsModuleAvailable(): r""" Find out whether the pdf2word module is available (and licensed). :rtype: boolean :return: returns true if pdf2word operations can be performed. """ return _PDFNetPython.PDF2WordModule_IsModuleAvailable()
[docs] class StructuredOutputModule(object): r""" The class StructuredOutputModule. static interface to PDFTron SDKs PDF to Word, Excel, PowerPoint, HTML functionality """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def IsModuleAvailable(): r""" Find out whether the StructuredOutput add-on module is available (and licensed). :rtype: boolean :return: returns true if StructuredOutput operations can be performed. """ return _PDFNetPython.StructuredOutputModule_IsModuleAvailable()
def __init__(self): _PDFNetPython.StructuredOutputModule_swiginit(self, _PDFNetPython.new_StructuredOutputModule()) __swig_destroy__ = _PDFNetPython.delete_StructuredOutputModule
# Register StructuredOutputModule in _PDFNetPython: _PDFNetPython.StructuredOutputModule_swigregister(StructuredOutputModule)
[docs] def StructuredOutputModule_IsModuleAvailable(): r""" Find out whether the StructuredOutput add-on module is available (and licensed). :rtype: boolean :return: returns true if StructuredOutput operations can be performed. """ return _PDFNetPython.StructuredOutputModule_IsModuleAvailable()
[docs] class Optimizer(object): r""" The Optimizer class provides functionality for optimizing/shrinking output PDF files. 'pdftron.PDF.Optimizer' is an optional PDFNet Add-On utility class that can be used to optimize PDF documents by reducing the file size, removing redundant information, and compressing data streams using the latest in image compression technology. PDF Optimizer can compress and shrink PDF file size with the following operations: - Remove duplicated fonts, images, ICC profiles, and any other data stream. - Optionally convert high-quality or print-ready PDF files to small, efficient and web-ready PDF. - Optionally down-sample large images to a given resolution. - Optionally compress or recompress PDF images using JBIG2 and JPEG2000 compression formats. - Compress uncompressed streams and remove unused PDF objects. Notes: 'Optimizer' is available as a separately licensable add-on to PDFNet core license. See 'pdftron.PDF.Flattener' for alternate approach to optimize PDFs for fast viewing on mobile devices and the Web. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") def __init__(self, args, kwargs): raise AttributeError("Noructor defined") __repr__ = _swig_repr
[docs] @staticmethod def Optimize(args): return _PDFNetPython.Optimizer_Optimize(args)
__swig_destroy__ = _PDFNetPython.delete_Optimizer
# Register Optimizer in _PDFNetPython: _PDFNetPython.Optimizer_swigregister(Optimizer)
[docs] def Optimizer_Optimize(args): return _PDFNetPython.Optimizer_Optimize(args)
[docs] class ImageSettings(object): r""" A class that stores downsampling/recompression settings for color and grayscale images. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_retain = _PDFNetPython.ImageSettings_e_retain e_flate = _PDFNetPython.ImageSettings_e_flate e_jpeg = _PDFNetPython.ImageSettings_e_jpeg e_jpeg2000 = _PDFNetPython.ImageSettings_e_jpeg2000 e_none = _PDFNetPython.ImageSettings_e_none e_off = _PDFNetPython.ImageSettings_e_off e_default = _PDFNetPython.ImageSettings_e_default def __init__(self): r""" create an ImageSettings object with default options""" _PDFNetPython.ImageSettings_swiginit(self, _PDFNetPython.new_ImageSettings())
[docs] def SetImageDPI(self, maximum, resampling): r""" Sets the maximum and resampling dpi for images. By default these are set to 144 and 96 respectively. :type maximum: double :param maximum: the highest dpi of an image before it will be resampled :type resampling: double :param resampling: the image dpi to resample to if an image is encountered over the maximum dpi """ return _PDFNetPython.ImageSettings_SetImageDPI(self, maximum, resampling)
[docs] def SetCompressionMode(self, mode): r""" Sets the output compression mode for this type of image The default value is e_retain :type mode: int :param mode: the compression mode to set """ return _PDFNetPython.ImageSettings_SetCompressionMode(self, mode)
[docs] def SetDownsampleMode(self, mode): r""" Sets the downsample mode for this type of image The default value is e_default which will allow downsampling of images :type mode: int :param mode: the downsample mode to set """ return _PDFNetPython.ImageSettings_SetDownsampleMode(self, mode)
[docs] def SetQuality(self, quality): r""" Sets the quality for lossy compression modes from 1 to 10 where 10 is lossless (if possible) the default value is 5 """ return _PDFNetPython.ImageSettings_SetQuality(self, quality)
[docs] def ForceRecompression(self, force): r""" Sets whether recompression to the specified compression method should be forced when the image is not downsampled. By default the compression method for these images will not be changed. :type force: boolean :param force: if true the compression method for all images will be changed to the specified compression mode """ return _PDFNetPython.ImageSettings_ForceRecompression(self, force)
[docs] def ForceChanges(self, force): r""" Sets whether image changes that grow the PDF file should be kept. This is off by default. :type force: boolean :param force: if true all image changes will be kept. """ return _PDFNetPython.ImageSettings_ForceChanges(self, force)
__swig_destroy__ = _PDFNetPython.delete_ImageSettings
# Register ImageSettings in _PDFNetPython: _PDFNetPython.ImageSettings_swigregister(ImageSettings)
[docs] class MonoImageSettings(object): r""" A class that stores image downsampling/recompression settings for monochrome images. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_jbig2 = _PDFNetPython.MonoImageSettings_e_jbig2 e_flate = _PDFNetPython.MonoImageSettings_e_flate e_none = _PDFNetPython.MonoImageSettings_e_none e_ccitt = _PDFNetPython.MonoImageSettings_e_ccitt e_off = _PDFNetPython.MonoImageSettings_e_off e_default = _PDFNetPython.MonoImageSettings_e_default def __init__(self): r""" create an MonoImageSettings object with default options""" _PDFNetPython.MonoImageSettings_swiginit(self, _PDFNetPython.new_MonoImageSettings())
[docs] def SetImageDPI(self, maximum, resampling): r""" Sets the maximum and resampling dpi for monochrome images. By default these are set to 144 and 96 respectively. :type maximum: double :param maximum: the highest dpi of an image before it will be resampled :type resampling: double :param resampling: the image dpi to resample to if an image is encountered over the maximum dpi """ return _PDFNetPython.MonoImageSettings_SetImageDPI(self, maximum, resampling)
[docs] def SetCompressionMode(self, mode): r""" Sets the output compression mode for monochrome images The default value is e_ccitt (CCITT group 4 compression) :type mode: int :param mode: the compression mode to set """ return _PDFNetPython.MonoImageSettings_SetCompressionMode(self, mode)
[docs] def SetDownsampleMode(self, mode): r""" Sets the downsample mode for monochrome images The default value is e_default :type mode: int :param mode: the compression mode to set """ return _PDFNetPython.MonoImageSettings_SetDownsampleMode(self, mode)
[docs] def ForceRecompression(self, force): r""" Sets whether recompression to the specified compression method should be forced when the image is not downsampled. By default the compression method for these images will not be changed. :type force: boolean :param force: if true the compression method for all images will be changed to the specified compression mode """ return _PDFNetPython.MonoImageSettings_ForceRecompression(self, force)
[docs] def ForceChanges(self, force): r""" Sets whether image changes that grow the PDF file should be kept. This is off by default. :type force: boolean :param force: if true all image changes will be kept. """ return _PDFNetPython.MonoImageSettings_ForceChanges(self, force)
[docs] def SetJBIG2Threshold(self, jbig2_threshold): r""" Sets the quality for lossy compression modes from 1 to 10 where 10 is lossless (if possible). The default value for JBIG2 is 8.5. The setting is ignored for FLATE. """ return _PDFNetPython.MonoImageSettings_SetJBIG2Threshold(self, jbig2_threshold)
__swig_destroy__ = _PDFNetPython.delete_MonoImageSettings
# Register MonoImageSettings in _PDFNetPython: _PDFNetPython.MonoImageSettings_swigregister(MonoImageSettings)
[docs] class TextSettings(object): r"""A class that stores image text optimization settings.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r""" create an TextSettings object with default options""" _PDFNetPython.TextSettings_swiginit(self, _PDFNetPython.new_TextSettings())
[docs] def SubsetFonts(self, subset): r""" Sets whether embedded fonts will be subset. This will generally reduce the size of fonts, but will strip font hinting. Subsetting is off by default. :type subset: boolean :param subset: if true all embedded fonts will be subsetted. """ return _PDFNetPython.TextSettings_SubsetFonts(self, subset)
[docs] def EmbedFonts(self, embed): r""" Sets whether fonts should be embedded. This will generally increase the size of the file, but will make the file appear the same on different machines. Font embedding is off by default. :type embed: boolean :param embed: if true all fonts will be embedded. """ return _PDFNetPython.TextSettings_EmbedFonts(self, embed)
__swig_destroy__ = _PDFNetPython.delete_TextSettings
# Register TextSettings in _PDFNetPython: _PDFNetPython.TextSettings_swigregister(TextSettings)
[docs] class OptimizerSettings(object): r"""A class that stores settings for the optimizer""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r""" create an OptimizerSettings object with default options""" _PDFNetPython.OptimizerSettings_swiginit(self, _PDFNetPython.new_OptimizerSettings())
[docs] def SetColorImageSettings(self, settings): r"""updates the settings for color image processing""" return _PDFNetPython.OptimizerSettings_SetColorImageSettings(self, settings)
[docs] def SetGrayscaleImageSettings(self, settings): r"""updates the settings for grayscale image processing""" return _PDFNetPython.OptimizerSettings_SetGrayscaleImageSettings(self, settings)
[docs] def SetMonoImageSettings(self, settings): r"""updates the settings for monochrome image processing""" return _PDFNetPython.OptimizerSettings_SetMonoImageSettings(self, settings)
[docs] def SetTextSettings(self, settings): r"""updates the settings for text processing""" return _PDFNetPython.OptimizerSettings_SetTextSettings(self, settings)
[docs] def RemoveCustomEntries(self, should_remove): r""" Enable or disable removal of custom entries in the PDF. By default custom entries are removed.<summary> :type should_remove: boolean :param should_remove: if true custom entries will be removed. """ return _PDFNetPython.OptimizerSettings_RemoveCustomEntries(self, should_remove)
m_color_image_settings = property(_PDFNetPython.OptimizerSettings_m_color_image_settings_get, _PDFNetPython.OptimizerSettings_m_color_image_settings_set) m_grayscale_image_settings = property(_PDFNetPython.OptimizerSettings_m_grayscale_image_settings_get, _PDFNetPython.OptimizerSettings_m_grayscale_image_settings_set) m_mono_image_settings = property(_PDFNetPython.OptimizerSettings_m_mono_image_settings_get, _PDFNetPython.OptimizerSettings_m_mono_image_settings_set) m_text_settings = property(_PDFNetPython.OptimizerSettings_m_text_settings_get, _PDFNetPython.OptimizerSettings_m_text_settings_set) m_remove_custom = property(_PDFNetPython.OptimizerSettings_m_remove_custom_get, _PDFNetPython.OptimizerSettings_m_remove_custom_set) __swig_destroy__ = _PDFNetPython.delete_OptimizerSettings
# Register OptimizerSettings in _PDFNetPython: _PDFNetPython.OptimizerSettings_swigregister(OptimizerSettings)
[docs] class BitmapInfo(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr width = property(_PDFNetPython.BitmapInfo_width_get, _PDFNetPython.BitmapInfo_width_set) height = property(_PDFNetPython.BitmapInfo_height_get, _PDFNetPython.BitmapInfo_height_set) stride = property(_PDFNetPython.BitmapInfo_stride_get, _PDFNetPython.BitmapInfo_stride_set) dpi = property(_PDFNetPython.BitmapInfo_dpi_get, _PDFNetPython.BitmapInfo_dpi_set) def __init__(self, args): _PDFNetPython.BitmapInfo_swiginit(self, _PDFNetPython.new_BitmapInfo(args))
[docs] def GetBuffer(self): return _PDFNetPython.BitmapInfo_GetBuffer(self)
__swig_destroy__ = _PDFNetPython.delete_BitmapInfo
# Register BitmapInfo in _PDFNetPython: _PDFNetPython.BitmapInfo_swigregister(BitmapInfo)
[docs] class PDFDraw(object): r""" PDFDraw contains methods for converting PDF pages to images and to Bitmap objects. Utility methods are provided to export PDF pages to various raster formats as well as to convert pages to GDI+ bitmaps for further manipulation or drawing. Notes: This class is available on all platforms supported by PDFNet. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self, dpi=92): r""" PDFDrawructor and destructor :type dpi: double :param dpi: - Default resolution used to rasterize pages. If the parameter is not specified, the initial resolution is 92 dots per inch. DPI parameter can be modified at any time using PDFDraw::SetDPI() method. """ _PDFNetPython.PDFDraw_swiginit(self, _PDFNetPython.new_PDFDraw(dpi)) __swig_destroy__ = _PDFNetPython.delete_PDFDraw
[docs] def SetRasterizerType(self, type): r""" Sets the core graphics library used for rasterization and rendering. Using this method it is possible to quickly switch between different implementations. By default, PDFDraw uses the built-in, platform independent rasterizer. :type type: int :param type: Rasterizer type. Notes: This method is deprecated, since the GDI+ rasterizer itself is deprecated and will be removed in a future version of PDFNet. It is strongly recommended to use the built-in rasterizer and to use the XPS print path where vector conversion is needed. """ return _PDFNetPython.PDFDraw_SetRasterizerType(self, type)
[docs] def SetDPI(self, dpi): r""" Sets the output image resolution. DPI stands for Dots Per Inch. This parameter is used to specify the output image size and quality. A typical screen resolution for monitors these days is 92 DPI, but printers could use 200 DPI or more. :type dpi: double :param dpi: value to set the image resolution to. Higher value = higher resolution. Notes: The size of resulting image is a function of DPI and the dimensions of the source PDF page. For example, if DPI is 92 and page is 8 inches wide, the output bitmap will have 928 = 736 pixels per line. If you know the dimensions of the destination bitmap, but don't care about DPI of the image you can use pdfdraw.SetImageSize() instead. if you would like to rasterize extremely large bitmaps (e.g. with resolutions of 2000 DPI or more) it is not practical to use PDFDraw directly because of the memory required to store the entire image. In this case, you can use PDFRasterizer directly to generate the rasterized image in stripes or tiles. """ return _PDFNetPython.PDFDraw_SetDPI(self, dpi)
[docs] def SetImageSize(self, width, height, preserve_aspect_ratio=True): r""" SetImageSize can be used instead of SetDPI() to adjust page scaling so that image fits into a buffer of given dimensions. If this function is used, DPI will be calculated dynamically for each page so that every page fits into the buffer of given dimensions. :type width: int :param width: - The width of the image, in pixels/samples. :type height: int :param height: - The height of the image, in pixels/samples. :type preserve_aspect_ratio: boolean :param preserve_aspect_ratio: - True to preserve the aspect ratio, false otherwise. By default, preserve_aspect_ratio is true. """ return _PDFNetPython.PDFDraw_SetImageSize(self, width, height, preserve_aspect_ratio)
[docs] def SetPageBox(self, region): r""" Selects the page box/region to rasterize. :type region: int :param region: Page box to rasterize. By default, PDFDraw will rasterize page crop box. """ return _PDFNetPython.PDFDraw_SetPageBox(self, region)
[docs] def SetClipRect(self, clip_rect): r""" clip the render region to the provided rect (in page space) :type clip_rect: :py:class:`Rect` :param clip_rect: clipping rect. By default, PDFDraw will rasterize the entire page box. """ return _PDFNetPython.PDFDraw_SetClipRect(self, clip_rect)
[docs] def SetFlipYAxis(self, flip_y): r""" Flips the vertical (i.e. Y) axis of the image. :type flip_y: boolean :param flip_y: true to flip the Y axis, false otherwise. For compatibility with most raster formats 'flip_y' is true by default. """ return _PDFNetPython.PDFDraw_SetFlipYAxis(self, flip_y)
[docs] def SetRotate(self, r): r""" Sets the rotation value for this page. Notes: This method is used only for drawing purposes and it does not modify the document (unlike Page::SetRotate()). :type r: int :param r: Rotation value to be set for a given page. Must be one of the Page::Rotate values. """ return _PDFNetPython.PDFDraw_SetRotate(self, r)
[docs] def SetDrawAnnotations(self, render_annots): r""" Enable or disable annotation and forms rendering. By default, all annotations and form fields are rendered. :type render_annots: boolean :param render_annots: True to draw annotations, false otherwise. """ return _PDFNetPython.PDFDraw_SetDrawAnnotations(self, render_annots)
[docs] def SetHighlightFields(self, highlight_fields): r""" Enable or disable highlighting form fields. Default is disabled. :type highlight_fields: boolean :param highlight_fields: true to highlight, false otherwise. """ return _PDFNetPython.PDFDraw_SetHighlightFields(self, highlight_fields)
[docs] def SetDrawUIElements(self, draw_ui_elements): r""" Enable or disable drawing ui elements. Default is disabled. :type draw_ui_elements: boolean :param draw_ui_elements: true to draw ui elements, false otherwise. """ return _PDFNetPython.PDFDraw_SetDrawUIElements(self, draw_ui_elements)
[docs] def SetAntiAliasing(self, enable_aa): r""" Enable or disable anti-aliasing. Anti-Aliasing is a technique used to improve the visual quality of images when displaying them on low resolution devices (for example, low DPI computer monitors). :type enable_aa: boolean :param enable_aa: if true anti-aliasing will be enabled. Anti-aliasing is enabled by default. """ return _PDFNetPython.PDFDraw_SetAntiAliasing(self, enable_aa)
[docs] def SetPathHinting(self, enable_hinting): r""" Enable or disable path hinting. :type enable_hinting: boolean :param enable_hinting: if true path hinting will be enabled. Path hinting is used to slightly adjust paths in order to avoid or alleviate artifacts of hair line cracks between certain graphical elements. This option is turned on by default. """ return _PDFNetPython.PDFDraw_SetPathHinting(self, enable_hinting)
[docs] def SetThinLineAdjustment(self, pixel_grid_fit, stroke_adjust): r""" Set thin line adjustment parameters. :type pixel_grid_fit: boolean :param pixel_grid_fit: if true (horizontal/vertical) thin lines will be snapped to integer pixel positions. This helps make thin lines look sharper and clearer. This option is turned off by default and it only works if path hinting is enabled. :type stroke_adjust: boolean :param stroke_adjust: if true auto stroke adjustment is enabled. Currently, this would make lines with sub-pixel width to be one-pixel wide. This option is turned on by default. """ return _PDFNetPython.PDFDraw_SetThinLineAdjustment(self, pixel_grid_fit, stroke_adjust)
[docs] def SetThinLineScaling(self, scaling): r""" This setting controls the thickness of zero-width lines when rendered. In a PDF, a line width of zero denotes the thinnest line that can be rendered at device resolution: 1 device pixel wide. However, on high-resolution devices, a single pixel can be nearly invisible. :type scaling: double :param scaling: use this setting to increase the apparent thickness of these zero-width lines. 1.0 (1 pixel wide) """ return _PDFNetPython.PDFDraw_SetThinLineScaling(self, scaling)
[docs] def SetImageSmoothing(self, smoothing_enabled=True, hq_image_resampling=False): r""" Enable or disable image smoothing. The rasterizer allows a tradeoff between rendering quality and rendering speed. This function can be used to indicate the preference between rendering speed and quality. Notes: image smoothing option has effect only if the source image has higher resolution that the output resolution of the image on the rasterized page. PDFNet automatically controls at what resolution/zoom factor, 'image smoothing' needs to take effect. :type smoothing_enabled: boolean :param smoothing_enabled: True to enable image smoothing, false otherwise. :type hq_image_resampling: boolean :param hq_image_resampling: True to use a higher quality (but slower) smoothing algorithm image smoothing is enabled and hq_image_resampling is false. """ return _PDFNetPython.PDFDraw_SetImageSmoothing(self, smoothing_enabled, hq_image_resampling)
[docs] def SetCaching(self, enabled=True): r""" Enables or disables caching. Caching can improve the rendering performance in cases where the same page will be drawn multiple times. :type enabled: boolean :param enabled: - if true PDFRasterizer will cache frequently used graphics objects. """ return _PDFNetPython.PDFDraw_SetCaching(self, enabled)
[docs] def SetGamma(self, exp): r""" Sets the gamma factor used for anti-aliased rendering. :type exp: double :param exp: is the exponent value of gamma function. Typical values are in the range from 0.1 to 3. Gamma correction can be used to improve the quality of anti-aliased image output and can (to some extent) decrease the appearance common anti-aliasing artifacts (such as pixel width lines between polygons). Notes: Gamma correction is used only in the built-in rasterizer. """ return _PDFNetPython.PDFDraw_SetGamma(self, exp)
[docs] def SetOCGContext(self, ctx): r""" Sets the Optional Content Group (OCG) context that should be used when rendering the page. This function can be used to selectively render optional content (such as PDF layers) based on the states of optional content groups in the given context. :type ctx: :py:class:`Context` :param ctx: Optional Content Group (OCG) context, or NULL if the rasterizer should render all content on the page. """ return _PDFNetPython.PDFDraw_SetOCGContext(self, ctx)
[docs] def SetPrintMode(self, is_printing): r""" Tells the rasterizer to render the page 'print' mode. Certain page elements (such as annotations or OCG-s) are meant to be visible either on the screen or on the printed paper but not both. A common example, is the "Submit" button on electronic forms. :type is_printing: boolean :param is_printing: set to true if the page should be rendered in print mode. By default, print mode flag is set to false. """ return _PDFNetPython.PDFDraw_SetPrintMode(self, is_printing)
[docs] def SetDefaultPageColor(self, r, g, b): r""" Sets the default color of the page backdrop. By default, the page color is white. :type r: int :param r: the red component of the page backdrop color. :type g: int :param g: the green component of the page backdrop color. :type b: int :param b: the blue component of the page backdrop color. Notes: Only when the page backdrop is not set to transparent (SetPageTransparent), default page color is used. """ return _PDFNetPython.PDFDraw_SetDefaultPageColor(self, r, g, b)
[docs] def SetPageTransparent(self, is_transparent): r""" Sets the page color to transparent. By default, PDFDraw assumes that the page is imposed directly on an opaque white surface. Some applications may need to impose the page on a different backdrop. In this case any pixels that are not covered during rendering will be transparent. :type is_transparent: boolean :param is_transparent: If true, page's backdrop color will be transparent. If false, the page's backdrop will be a opaque white. Notes: If page transparency is enabled, the alpha channel will be preserved when the image is exported as PNG, TIFF(when in RGB space), or RAW. """ return _PDFNetPython.PDFDraw_SetPageTransparent(self, is_transparent)
[docs] def SetOverprint(self, op): r""" Enable or disable support for overprint and overprint simulation. Overprint is a device dependent feature and the results will vary depending on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc). By default overprint is only enabled for PDF/X files. :type op: int :param op: e_op_on: always enabled; e_op_off: always disabled; e_op_pdfx_on: enabled for PDF/X files only. """ return _PDFNetPython.PDFDraw_SetOverprint(self, op)
[docs] def Export(self, args): r""" Overload 1: A utility method to export the given PDF page to an image file. :type page: :py:class:`Page` :param page: The source PDF page. :type filename: string :param filename: - The name of the output image file. The filename should include the extension suffix (e.g. 'c:/output/myimage.png'). format - The file format of the output image. Currently supported formats are: - "RAW" : RAW format. There are four possibilities: e_rgba - if transparent and color page; e_gray_alpha - if transparent and gray page; e_rgb - if opaque and color page; e_gray - if opaque and gray page. NOTE that if page is set to be transparent (SetPageTransparent), the output color channels are already multiplied by the alpha channel. - "BMP" : Bitmap image format (BMP) - "JPEG" : Joint Photographic Experts Group (JPEG) image format - "PNG" : 24-bit W3C Portable Network Graphics (PNG) image format - "PNG8" : 8-bit, palettized PNG format. The exported file size should be smaller than the one generated using "PNG", possibly at the expense of some image quality. - "TIFF" : Tag Image File Format (TIFF) image format. - "TIFF8" : Tag Image File Format (TIFF) image format (with 8-bit palete). By default, the function exports to PNG. :type encoder_params: :py:class:`Obj` :param encoder_params: - An optional SDF dictionary object containing key/value pairs representing optional encoder parameters. The following table list possible parameters for corresponding export filters: |Parameter/Key |Output Format |Description/Value |Example | |Quality |JPEG |The value for compression 'Quality' must be a number between 0 and 100 specifying the tradeoff between compression ratio and loss in image quality. 100 stands for best quality. | style="Z-INDEX: 0"hint.PutNumber("Quality", 60); See the Example 2 in PDFDraw sample project. | |Dither | PNG, PNG8, TIFF or TIFF8. |A boolean used to enable or disable dithering. Relevent only for when the image is exported in palettized or monochrome mode. |hint.PutBool("Dither", true); | |ColorSpace |PNG or TIFF for grayscale; TIFF for CMYK; PNG, BMP, JPEG, or TIFF for Separation. |A name object used to select the rendering and export color space. Currently supported values are "Gray", "RGB, "CMYK", and "Separation". The output image format must support specified color space, otherwise the parameter will be ignored. An example of image format that supports CMYK is TIFF. Image formats that support grayscale are PNG and TIFF. Separation output is supported in either a single N-Channel TIFF, or in separate single-channel files (either PNG, BMP, or JPEG). Output in "Separation" space implies that overprint simulation is on. By default, the image is rendered and exported in RGB color space.</td> <td>hint.PutName("ColorSpace", "CMYK");</td> </tr> <tr> <td>BPC</td> <td>PNG or TIFF.</td> <td>A number used to specify 'bits per pixel' in the output file. Currently supported values are 1 and 8 (default is 8). To export monochrome (1 bit per pixel) image, use 1 as the value of BPC parameter and use TIFF or PNG as the export format for the image. By default, the image is not dithered when BPC is 1. To enable dithering add 'Dither' option in the export hint.</td> <td>hint.PutNumber("BPC", 1);</td> </tr> </table> | Overload 2: Export the given PDF page to an image stream. :type page: :py:class:`Page` :param page: The source PDF page. :type stream: :py:class:`Filter` :param stream: - The output stream. format - The output image format. See the overloaded method for details. :type encoder_params: :py:class:`Obj` :param encoder_params: - Optional encoder parameters. See the overloaded method for details. | Overload 3: Export the given PDF page to an image stream. :type page: :py:class:`Page` :param page: The source PDF page. :type stream: :py:class:`Filter` :param stream: - The output stream. format - The output image format. See the overloaded method for details. :param encoder_params: - Optional encoder parameters. See the overloaded method for details. | Overload 4: Export the given PDF page to an image stream. :type page: :py:class:`Page` :param page: The source PDF page. :type stream: :py:class:`Filter` :param stream: - The output stream. format - The output image format. See the overloaded method for details. :param encoder_params: - Optional encoder parameters. See the overloaded method for details. """ return _PDFNetPython.PDFDraw_Export(self, args)
e_rgba = _PDFNetPython.PDFDraw_e_rgba e_bgra = _PDFNetPython.PDFDraw_e_bgra e_rgb = _PDFNetPython.PDFDraw_e_rgb e_bgr = _PDFNetPython.PDFDraw_e_bgr e_gray = _PDFNetPython.PDFDraw_e_gray e_gray_alpha = _PDFNetPython.PDFDraw_e_gray_alpha e_cmyk = _PDFNetPython.PDFDraw_e_cmyk
[docs] def GetBitmap(self, args): r""" Returns the raw rasterized image data for the given image. Notes: This method is relatively low-level and is only available in PDFNet for C++. If you are using PDFNet for .NET, you can use the function with the same name that directly returns GDI+ Bitmap. :rtype: :py:class:`BitmapInfo` :return: a pointer to the internal memory buffer containing the rasterized image of the given page. The buffer size is at least 'out_heightout_stride' bytes. The pixel data is stored in 8 bit per component, BGRA format by default. :type page: :py:class:`Page` :param page: The source PDF page. :type pix_fmt: int :param pix_fmt: - Optional parameter used to specify the desired pixel format. The default pixel format is e_bgra. :type demult: boolean :param demult: - Specifies if the alpha is de-multiplied from the resulting color components. This parameter is only used for e_rgba, e_bgra, e_gray_alpha formats. """ return _PDFNetPython.PDFDraw_GetBitmap(self, args)
[docs] def GetSeparationBitmaps(self, page): r""" Returns a vector of rasterized separations for the given image. Notes: This method is relatively low-level and is only available in PDFNet for C++. If you are using PDFNet for .NET, you can use the function with the same name that directly returns GDI+ Bitmap. :rtype: std::vector< PDF::Separation,std::allocator< PDF::Separation > > :return: Separation has a pointer to the internal memory buffer containing the rasterized image of the given page. The buffer size is at least 'out_heightout_stride' bytes. The pixel data is stored in 8 bit per component, BGRA format. :type page: :py:class:`Page` :param page: The source PDF page. """ return _PDFNetPython.PDFDraw_GetSeparationBitmaps(self, page)
[docs] def SetErrorReportProc(self, instance): r""" Sets the error handling function to be called in case an error is encountered during page rendering. :param error_proc: Error handling callback function (or delegate in .NET) :param data: Custom data to be passed as a second parameter to 'error_proc'. """ return _PDFNetPython.PDFDraw_SetErrorReportProc(self, instance)
[docs] def SetColorPostProcessMode(self, mode): r""" Set the color post processing transformation. This transform is applied to the rasterized bitmap as the final step in the rasterization process, and is applied directly to the resulting bitmap (disregarding any color space information). Color post processing only supported for RGBA output. :type mode: int :param mode: is the specific transform to be applied """ return _PDFNetPython.PDFDraw_SetColorPostProcessMode(self, mode)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.PDFDraw_Destroy(self)
mp_draw = property(_PDFNetPython.PDFDraw_mp_draw_get, _PDFNetPython.PDFDraw_mp_draw_set)
# Register PDFDraw in _PDFNetPython: _PDFNetPython.PDFDraw_swigregister(PDFDraw)
[docs] class WebFontDownloader(object): r""" The class WebFontDownloader. static interface to control the behaviour of PDFNet web font downloading """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def IsAvailable(): r""" Find out whether the web font downloader is available in version of PDFNet. :rtype: boolean :return: returns true if web font downloading can be done. """ return _PDFNetPython.WebFontDownloader_IsAvailable()
[docs] @staticmethod def EnableDownloads(): r"""Allow PDFNet to access the network to download missing fonts when possible.""" return _PDFNetPython.WebFontDownloader_EnableDownloads()
[docs] @staticmethod def DisableDownloads(): r"""Prevent PDFNet from accessing the network to download missing fonts. It may still use previously downloaded fonts (which are cached on disk).""" return _PDFNetPython.WebFontDownloader_DisableDownloads()
[docs] @staticmethod def PreCacheAsync(): r"""download and cache a base collection of fonts in a background thread. Will not do anything if downloading is currently disabled.""" return _PDFNetPython.WebFontDownloader_PreCacheAsync()
[docs] @staticmethod def ClearCache(): r"""clear any pre-cached font files residing in persistent storage.""" return _PDFNetPython.WebFontDownloader_ClearCache()
[docs] @staticmethod def SetCustomWebFontURL(url): r""" Set the root path into which the web font downloader will make requests. :type url: string :param url: -- The root path into which the web font downloader will make requests. """ return _PDFNetPython.WebFontDownloader_SetCustomWebFontURL(url)
def __init__(self): _PDFNetPython.WebFontDownloader_swiginit(self, _PDFNetPython.new_WebFontDownloader()) __swig_destroy__ = _PDFNetPython.delete_WebFontDownloader
# Register WebFontDownloader in _PDFNetPython: _PDFNetPython.WebFontDownloader_swigregister(WebFontDownloader)
[docs] def WebFontDownloader_IsAvailable(): r""" Find out whether the web font downloader is available in version of PDFNet. :rtype: boolean :return: returns true if web font downloading can be done. """ return _PDFNetPython.WebFontDownloader_IsAvailable()
[docs] def WebFontDownloader_EnableDownloads(): r"""Allow PDFNet to access the network to download missing fonts when possible.""" return _PDFNetPython.WebFontDownloader_EnableDownloads()
[docs] def WebFontDownloader_DisableDownloads(): r"""Prevent PDFNet from accessing the network to download missing fonts. It may still use previously downloaded fonts (which are cached on disk).""" return _PDFNetPython.WebFontDownloader_DisableDownloads()
[docs] def WebFontDownloader_PreCacheAsync(): r"""download and cache a base collection of fonts in a background thread. Will not do anything if downloading is currently disabled.""" return _PDFNetPython.WebFontDownloader_PreCacheAsync()
[docs] def WebFontDownloader_ClearCache(): r"""clear any pre-cached font files residing in persistent storage.""" return _PDFNetPython.WebFontDownloader_ClearCache()
[docs] def WebFontDownloader_SetCustomWebFontURL(url): r""" Set the root path into which the web font downloader will make requests. :type url: string :param url: -- The root path into which the web font downloader will make requests. """ return _PDFNetPython.WebFontDownloader_SetCustomWebFontURL(url)
[docs] class TextStyledElement(object): r""" A TextStyledElement provides access to the text style properties of a ContentElement. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") def __init__(self, args, kwargs): raise AttributeError("Noructor defined") __repr__ = _swig_repr
[docs] def SetFontFace(self, font_name): r""" Set the font face name to be used for the style :type font_name: string :param font_name: The font face name to use for the style """ return _PDFNetPython.TextStyledElement_SetFontFace(self, font_name)
[docs] def GetFontFace(self): r""" Get the font face name used for the style :rtype: string :return: the font face name used for the style """ return _PDFNetPython.TextStyledElement_GetFontFace(self)
[docs] def SetFontSize(self, font_size): r""" Set font size of the style :type font_size: double :param font_size: The font size to use for the style """ return _PDFNetPython.TextStyledElement_SetFontSize(self, font_size)
[docs] def GetFontSize(self): r""" Get the font size of the style :rtype: double :return: The font size of the style """ return _PDFNetPython.TextStyledElement_GetFontSize(self)
[docs] def SetItalic(self, val): r""" Set or unset the style as 'italic' :type val: boolean :param val: use true to set the style as 'Italic' """ return _PDFNetPython.TextStyledElement_SetItalic(self, val)
[docs] def IsItalic(self): r""" Get the italic setting of the style :rtype: boolean :return: true if the style is set as 'Italic' """ return _PDFNetPython.TextStyledElement_IsItalic(self)
[docs] def SetBold(self, val): r""" Set or unset the style as 'Bold' :type val: boolean :param val: use true to set the style as 'Bold' """ return _PDFNetPython.TextStyledElement_SetBold(self, val)
[docs] def IsBold(self): r""" Get the bold setting of the style :rtype: boolean :return: true if the style is set as 'Bold' """ return _PDFNetPython.TextStyledElement_IsBold(self)
[docs] def SetTextColor(self, red, green, blue): r""" Set text color for the style :type red: int :param red: The red component of the text color :type green: int :param green: The green component of the text color :type blue: int :param blue: The blue component of the text color """ return _PDFNetPython.TextStyledElement_SetTextColor(self, red, green, blue)
[docs] def SetBackgroundColor(self, red, green, blue): r""" Set the background color for the style :type red: int :param red: The red component of the text color :type green: int :param green: The green component of the text color :type blue: int :param blue: The blue component of the text color """ return _PDFNetPython.TextStyledElement_SetBackgroundColor(self, red, green, blue)
m_impl = property(_PDFNetPython.TextStyledElement_m_impl_get, _PDFNetPython.TextStyledElement_m_impl_set) __swig_destroy__ = _PDFNetPython.delete_TextStyledElement
# Register TextStyledElement in _PDFNetPython: _PDFNetPython.TextStyledElement_swigregister(TextStyledElement)
[docs] class ContentElement(object): r""" Base class for all content elements in the document content tree. It contains methods to retrieve instances of derived classes via the AsDerivedClass() methods. The pattern is to retrieve a ElementRef<DerivedClass> object and then check if it is valid via the IsValid() method or casting to void. If it is valid, the actual derived instance can be accessed through the ElementRef<DerivedClass> object. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") def __init__(self, args, kwargs): raise AttributeError("Noructor defined") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_ContentElement
[docs] def Destroy(self): return _PDFNetPython.ContentElement_Destroy(self)
[docs] def AsList(self): r""" Retrieve the ElementRef<List> object for this content element which can be used to validate if this element is a list and, if so, to retrieve an associated List object. :rtype: Layout::ElementRef< Layout::List > :return: The ElementRef<List> object """ return _PDFNetPython.ContentElement_AsList(self)
[docs] def AsListItem(self): r""" Retrieve the ElementRef<List> object for this content element which can be used to validate if this element is a list item and, if so, to retrieve an associated ListItem object. :rtype: Layout::ElementRef< Layout::ListItem > :return: The ElementRef<ListItem> object """ return _PDFNetPython.ContentElement_AsListItem(self)
[docs] def AsContentNode(self): r""" Retrieve the ElementRef<ContentNode> object for this content element which can be used to validate if this element is a content node and, if so, to retrieve an associated ContentNode object. :rtype: Layout::ElementRef< Layout::ContentNode > :return: The ElementRef<ContentNode> object """ return _PDFNetPython.ContentElement_AsContentNode(self)
[docs] def AsTextRun(self): r""" Retrieve the ElementRef<TextRun> object for this content element. This can be used to check if this element is a text run and, if so, to access the associated TextRun object. :rtype: Layout::ElementRef< Layout::TextRun > :return: The ElementRef<TextRun> object """ return _PDFNetPython.ContentElement_AsTextRun(self)
[docs] def AsParagraph(self): r""" Retrieve the ElementRef<Paragraph> object for this content element. This can be used to check if this element is a paragraph and, if so, to access the associated Paragraph object. :rtype: Layout::ElementRef< Layout::Paragraph > :return: The ElementRef<Paragraph> object """ return _PDFNetPython.ContentElement_AsParagraph(self)
[docs] def AsTable(self): r""" Retrieve the ElementRef object for this content element. This can be used to check if this element is a table and, if so, to access the associated Table object. :rtype: Layout::ElementRef< Layout::Table > :return: The ElementRef object """ return _PDFNetPython.ContentElement_AsTable(self)
[docs] def AsTableRow(self): r""" Retrieve the ElementRef<TableRow> object for this content element. This can be used to check if this element is a table row and, if so, to access the associated TableRow object. :rtype: Layout::ElementRef< Layout::TableRow > :return: The ElementRef<TableRow> object """ return _PDFNetPython.ContentElement_AsTableRow(self)
[docs] def AsTableCell(self): r""" Retrieve the ElementRef<TableCell> object for this content element. This can be used to check if this element is a table cell and, if so, to access the associated TableCell object. :rtype: Layout::ElementRef< Layout::TableCell > :return: The ElementRef<TableCell> object """ return _PDFNetPython.ContentElement_AsTableCell(self)
[docs] def GetTextStyledElement(self): r""" Retrieve the TextStyledElement object for manipulating the text style of this content element. :rtype: :py:class:`TextStyledElement` :return: The TextStyledElement object """ return _PDFNetPython.ContentElement_GetTextStyledElement(self)
m_impl = property(_PDFNetPython.ContentElement_m_impl_get, _PDFNetPython.ContentElement_m_impl_set)
# Register ContentElement in _PDFNetPython: _PDFNetPython.ContentElement_swigregister(ContentElement)
[docs] class TextRun(ContentElement): r""" A TextRun is a content element that represents a single run of text. A paragraph can contain multiple TextRun objects. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") def __init__(self, args, kwargs): raise AttributeError("Noructor defined") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_TextRun
[docs] def Destroy(self): return _PDFNetPython.TextRun_Destroy(self)
[docs] def SetText(self, text): r""" Set the text content of the TextRun object :type text: string :param text: The text content to set """ return _PDFNetPython.TextRun_SetText(self, text)
[docs] def GetText(self): r""" Get the text content of the TextRun object :rtype: string :return: The text content """ return _PDFNetPython.TextRun_GetText(self)
# Register TextRun in _PDFNetPython: _PDFNetPython.TextRun_swigregister(TextRun)
[docs] class ContentNode(ContentElement): r""" Base class for all elements in the document content tree that can contain other content elements. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") def __init__(self, args, kwargs): raise AttributeError("Noructor defined") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_ContentNode
[docs] def Destroy(self): return _PDFNetPython.ContentNode_Destroy(self)
[docs] def GetContentNodeIterator(self): r""" Retrieve a ContentNodeIterator object from the content node The ContentNodeIterator object can be used to traverse the children of the content node. :rtype: :py:class:`ContentNodeIterator` :return: The ContentNodeIterator object """ return _PDFNetPython.ContentNode_GetContentNodeIterator(self)
# Register ContentNode in _PDFNetPython: _PDFNetPython.ContentNode_swigregister(ContentNode)
[docs] class Paragraph(ContentNode): r"""A Paragraph is a content node that contains a list of TextRun objects.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") def __init__(self, args, kwargs): raise AttributeError("Noructor defined") __repr__ = _swig_repr e_text_justification_invalid = _PDFNetPython.Paragraph_e_text_justification_invalid r"""Text justification is invalid""" e_text_justify_left = _PDFNetPython.Paragraph_e_text_justify_left r"""Text is left justified""" e_text_justify_right = _PDFNetPython.Paragraph_e_text_justify_right r"""Text is right justified""" e_text_justify_center = _PDFNetPython.Paragraph_e_text_justify_center r"""Text is justified centered""" __swig_destroy__ = _PDFNetPython.delete_Paragraph
[docs] def Destroy(self): return _PDFNetPython.Paragraph_Destroy(self)
[docs] def AddText(self, text): r""" Add another text run to the paragraph :type text: string :param text: The text to add :rtype: :py:class:`TextRun` :return: The newly created TextRun object """ return _PDFNetPython.Paragraph_AddText(self, text)
[docs] def SetSpaceBefore(self, val): r""" Set the "space before" value for the paragraph style :type val: double :param val: The "space before" value to set """ return _PDFNetPython.Paragraph_SetSpaceBefore(self, val)
[docs] def GetSpaceBefore(self): r""" Get the "space before" value for the paragraph style :rtype: double :return: "space before" value for paragraph style """ return _PDFNetPython.Paragraph_GetSpaceBefore(self)
[docs] def SetSpaceAfter(self, val): r""" Set the "space after" value for paragraph style :type val: double :param val: The "space after" value to set """ return _PDFNetPython.Paragraph_SetSpaceAfter(self, val)
[docs] def GetSpaceAfter(self): r""" Get the "space after" value for the paragraph style :rtype: double :return: "space after" value for paragraph style """ return _PDFNetPython.Paragraph_GetSpaceAfter(self)
[docs] def SetJustificationMode(self, val): r""" Set justification mode for paragraph style :type val: int :param val: The justification mode to set """ return _PDFNetPython.Paragraph_SetJustificationMode(self, val)
[docs] def GetJustificationMode(self): r""" Get justification mode for the paragraph :rtype: int :return: Justification mode for paragraph style """ return _PDFNetPython.Paragraph_GetJustificationMode(self)
[docs] def SetStartIndent(self, val): r""" Sets the start indent for the paragraph style. :type val: double :param val: The start indent value to set. """ return _PDFNetPython.Paragraph_SetStartIndent(self, val)
[docs] def GetStartIndent(self): r""" Gets the start indent for the paragraph style. :rtype: double :return: The start indent value for the paragraph style. """ return _PDFNetPython.Paragraph_GetStartIndent(self)
[docs] def SetEndIndent(self, val): r""" Sets the end indent for the paragraph style. :type val: double :param val: The end indent value to set. """ return _PDFNetPython.Paragraph_SetEndIndent(self, val)
[docs] def GetEndIndent(self): r""" Gets the end indent for the paragraph style. :rtype: double :return: The end indent value for the paragraph style. """ return _PDFNetPython.Paragraph_GetEndIndent(self)
[docs] def SetTextIndent(self, val): r""" Sets the text indent for the paragraph style. :type val: double :param val: The text indent value to set. """ return _PDFNetPython.Paragraph_SetTextIndent(self, val)
[docs] def GetTextIndent(self): r""" Gets the text indent for the paragraph style. :rtype: double :return: The text indent value for the paragraph style. """ return _PDFNetPython.Paragraph_GetTextIndent(self)
[docs] def SetBorder(self, thickness, red, green, blue): r""" Sets the border for the paragraph style. :type thickness: double :param thickness: The border thickness. :type red: int :param red: The red component of the border color. :type green: int :param green: The green component of the border color. :type blue: int :param blue: The blue component of the border color. """ return _PDFNetPython.Paragraph_SetBorder(self, thickness, red, green, blue)
[docs] def GetBorderThickness(self): r""" Gets the border thickness for the paragraph style. :rtype: double :return: The border thickness for the paragraph style. """ return _PDFNetPython.Paragraph_GetBorderThickness(self)
[docs] def AddTabStop(self, val): r""" Adds a tab stop to the paragraph style. :type val: double :param val: The position of the tab stop to add. """ return _PDFNetPython.Paragraph_AddTabStop(self, val)
[docs] def GetNextTabStop(self, val): r""" Gets the next tab stop position for the paragraph style, given a starting position. :type val: double :param val: The starting position. :rtype: double :return: The position of the next tab stop. """ return _PDFNetPython.Paragraph_GetNextTabStop(self, val)
[docs] def SetDefaultTabStop(self, val): r""" Sets the default tab stop position for the paragraph style. :type val: double :param val: The default tab stop position to set. """ return _PDFNetPython.Paragraph_SetDefaultTabStop(self, val)
[docs] def GetDefaultTabStop(self): r""" Gets the default tab stop position for the paragraph style. :rtype: double :return: The default tab stop position for the paragraph style. """ return _PDFNetPython.Paragraph_GetDefaultTabStop(self)
[docs] def SetSpacesPerTab(self, val): r""" Sets the number of spaces per tab for the paragraph style. :type val: int :param val: The number of spaces per tab to set. """ return _PDFNetPython.Paragraph_SetSpacesPerTab(self, val)
[docs] def GetSpacesPerTab(self): r""" Gets the number of spaces per tab for the paragraph style. :rtype: int :return: The number of spaces per tab for the paragraph style. """ return _PDFNetPython.Paragraph_GetSpacesPerTab(self)
[docs] def SetDisplayRtl(self, val): r""" Sets the right-to-left (RTL) property for the paragraph style. :type val: boolean :param val: The value to set. True if RTL, false if not. """ return _PDFNetPython.Paragraph_SetDisplayRtl(self, val)
[docs] def IsDisplayRtl(self): r""" Checks if the paragraph style has the right-to-left (RTL) property set. :rtype: boolean :return: True if the display is RTL, false otherwise. """ return _PDFNetPython.Paragraph_IsDisplayRtl(self)
# Register Paragraph in _PDFNetPython: _PDFNetPython.Paragraph_swigregister(Paragraph)
[docs] class TableCell(ContentNode): r"""A class representing a table cell, which can be used during document creation.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") def __init__(self, args, kwargs): raise AttributeError("Noructor defined") __repr__ = _swig_repr e_alignment_top = _PDFNetPython.TableCell_e_alignment_top r"""Cell content is top-aligned""" e_alignment_center = _PDFNetPython.TableCell_e_alignment_center r"""Cell content is vertically centered""" e_alignment_bottom = _PDFNetPython.TableCell_e_alignment_bottom r"""Cell content is bottom-aligned""" e_alignment_left = _PDFNetPython.TableCell_e_alignment_left r"""Cell content is left-aligned""" e_alignment_middle = _PDFNetPython.TableCell_e_alignment_middle r"""Cell content is horizontally centered""" e_alignment_right = _PDFNetPython.TableCell_e_alignment_right r"""Cell content is right-aligned""" __swig_destroy__ = _PDFNetPython.delete_TableCell
[docs] def Destroy(self): return _PDFNetPython.TableCell_Destroy(self)
[docs] def AddParagraph(self, args): r""" Overload 1: Add an empty paragraph to the cell :rtype: :py:class:`Paragraph` :return: The paragraph that was added | Overload 2: Add a paragraph with text to the cell :rtype: :py:class:`Paragraph` :return: The paragraph that was added """ return _PDFNetPython.TableCell_AddParagraph(self, args)
[docs] def AddTable(self): r""" Add a nested table to the cell :rtype: :py:class:`Table` :return: The table that was added """ return _PDFNetPython.TableCell_AddTable(self)
[docs] def MergeCellsRight(self, num): r""" Merge the cell with the specified number of cells to the right :rtype: :py:class:`TableCell` :return: The merged cell """ return _PDFNetPython.TableCell_MergeCellsRight(self, num)
[docs] def MergeCellsDown(self, num): r""" Merge the cell with the specified number of cells downwards :rtype: :py:class:`TableCell` :return: The merged cell """ return _PDFNetPython.TableCell_MergeCellsDown(self, num)
[docs] def SetBackgroundColor(self, red, green, blue): r""" Set the background color of the cell :type red: int :param red: The red component of the border color :type green: int :param green: The green component of the border color :type blue: int :param blue: The blue component of the border color """ return _PDFNetPython.TableCell_SetBackgroundColor(self, red, green, blue)
[docs] def SetBorder(self, thickness, red, green, blue): r""" Set the cell's border thickness and color :type thickness: double :param thickness: The thickness of the border :type red: int :param red: The red component of the border color :type green: int :param green: The green component of the border color :type blue: int :param blue: The blue component of the border color """ return _PDFNetPython.TableCell_SetBorder(self, thickness, red, green, blue)
[docs] def GetBorderThickness(self): r""" Get the border thickness of the table cell :rtype: double :return: border thickness """ return _PDFNetPython.TableCell_GetBorderThickness(self)
[docs] def SetVerticalAlignment(self, val): r""" Set the vertical alignment of the cell :type val: int :param val: The vertical alignment of the cell """ return _PDFNetPython.TableCell_SetVerticalAlignment(self, val)
[docs] def GetVerticalAlignment(self): r""" Get the vertical alignment of the cell :rtype: int :return: the vertical alignment of the cell """ return _PDFNetPython.TableCell_GetVerticalAlignment(self)
[docs] def SetHorizontalAlignment(self, val): r""" Set horizontal alignment of the cell :type val: int :param val: The horizontal alignment of the cell """ return _PDFNetPython.TableCell_SetHorizontalAlignment(self, val)
[docs] def GetHorizontalAlignment(self): r""" Get the horizontal alignment of the cell :rtype: int :return: the horizontal Alignment of the cell """ return _PDFNetPython.TableCell_GetHorizontalAlignment(self)
[docs] def SetHeight(self, val): r""" Set the height of the cell :type val: double :param val: The height of the cell """ return _PDFNetPython.TableCell_SetHeight(self, val)
[docs] def GetHeight(self): r""" Get the height of the cell :rtype: double :return: the height of the cell """ return _PDFNetPython.TableCell_GetHeight(self)
[docs] def SetWidth(self, val): r""" Set the width of the cell :type val: double :param val: The width of the cell """ return _PDFNetPython.TableCell_SetWidth(self, val)
[docs] def GetWidth(self): r""" Get the width of the cell :rtype: double :return: the width of the cell """ return _PDFNetPython.TableCell_GetWidth(self)
# Register TableCell in _PDFNetPython: _PDFNetPython.TableCell_swigregister(TableCell)
[docs] class TableRow(ContentNode): r"""A class representing a table row, which can be used during document creation.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") def __init__(self, args, kwargs): raise AttributeError("Noructor defined") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_TableRow
[docs] def Destroy(self): return _PDFNetPython.TableRow_Destroy(self)
[docs] def AddTableCell(self): r""" Add a new cell to the row :rtype: :py:class:`TableCell` :return: The newly created cell """ return _PDFNetPython.TableRow_AddTableCell(self)
[docs] def SetRowHeight(self, val): r""" Set row height :type val: double :param val: The row height """ return _PDFNetPython.TableRow_SetRowHeight(self, val)
[docs] def GetNumColumns(self): r""" Get number of columns in the row Because of cell merging different rows may have different numbers of columns. :rtype: int :return: number of columns in the row """ return _PDFNetPython.TableRow_GetNumColumns(self)
# Register TableRow in _PDFNetPython: _PDFNetPython.TableRow_swigregister(TableRow)
[docs] class Table(ContentNode): r"""A Table is a content node that contains a grid of cells.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") def __init__(self, args, kwargs): raise AttributeError("Noructor defined") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_Table
[docs] def Destroy(self): return _PDFNetPython.Table_Destroy(self)
[docs] def AddTableRow(self): r""" Add a new row to the table :rtype: :py:class:`TableRow` :return: The newly created row """ return _PDFNetPython.Table_AddTableRow(self)
[docs] def GetTableCell(self, column, row): r""" Get a cell from the table :type column: int :param column: The column index of the cell to retrieve :type row: int :param row: The row index of the cell to retrieve :rtype: :py:class:`TableCell` :return: the TableCell at the specified column and row """ return _PDFNetPython.Table_GetTableCell(self, column, row)
[docs] def SetDefaultColumnWidth(self, val): r""" Set default column weight of the table :type val: double :param val: The default column weight """ return _PDFNetPython.Table_SetDefaultColumnWidth(self, val)
[docs] def GetDefaultRowHeight(self): r""" Get default row height of the table :rtype: double :return: Default row height of the table """ return _PDFNetPython.Table_GetDefaultRowHeight(self)
[docs] def SetDefaultRowHeight(self, val): r""" Set default row height of the table :type val: double :param val: The default row height """ return _PDFNetPython.Table_SetDefaultRowHeight(self, val)
[docs] def SetBorder(self, thickness, red, green, blue): r""" Set the cell's border thickness and color :type thickness: double :param thickness: The thickness of the border in points :type red: int :param red: The red component of the border color :type green: int :param green: The green component of the border color :type blue: int :param blue: The blue component of the border color """ return _PDFNetPython.Table_SetBorder(self, thickness, red, green, blue)
[docs] def GetBorderThickness(self): r""" Get the border thickness of the table :rtype: double :return: border thickness in points """ return _PDFNetPython.Table_GetBorderThickness(self)
[docs] def GetNumRows(self): r""" Get the number of rows in the table :rtype: int :return: number of rows in the table """ return _PDFNetPython.Table_GetNumRows(self)
[docs] def GetNumColumns(self): r""" Get the number of rows in the table :rtype: int :return: number of rows in the table """ return _PDFNetPython.Table_GetNumColumns(self)
# Register Table in _PDFNetPython: _PDFNetPython.Table_swigregister(Table)
[docs] class List(ContentNode): r"""A class representing a list in the document content tree.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") def __init__(self, args, kwargs): raise AttributeError("Noructor defined") __repr__ = _swig_repr e_none = _PDFNetPython.List_e_none e_decimal = _PDFNetPython.List_e_decimal e_lower_roman = _PDFNetPython.List_e_lower_roman e_upper_roman = _PDFNetPython.List_e_upper_roman e_lower_letter = _PDFNetPython.List_e_lower_letter e_upper_letter = _PDFNetPython.List_e_upper_letter e_ordinal = _PDFNetPython.List_e_ordinal e_ordinal_text = _PDFNetPython.List_e_ordinal_text e_chinese_counting = _PDFNetPython.List_e_chinese_counting e_chinese_counting_thousand = _PDFNetPython.List_e_chinese_counting_thousand e_cardinal_text = _PDFNetPython.List_e_cardinal_text e_decimal_zero = _PDFNetPython.List_e_decimal_zero __swig_destroy__ = _PDFNetPython.delete_List
[docs] def SetNumberFormat(self, args): r""" Overload 1: Set the number format of the list. :type format: int :param format: The number format to set for the list. | Overload 2: Set the number format of the list with a custom suffix and cascade flag. :type format: int :param format: The number format to set for the list. :type suffix: string :param suffix: The suffix to append to the list item number. :type cascade: boolean :param cascade: If true, the number format will be applied to nested lists as well. """ return _PDFNetPython.List_SetNumberFormat(self, args)
[docs] def GetLabelStyle(self): r""" Get the text style element for the list item labels. :rtype: :py:class:`TextStyledElement` :return: The TextStyledElement representing the label style. """ return _PDFNetPython.List_GetLabelStyle(self)
[docs] def SetStartIndex(self, idx): r""" Set the start index for the list items. :type idx: int :param idx: The start index value. """ return _PDFNetPython.List_SetStartIndex(self, idx)
[docs] def AddItem(self): r""" Add a new list item to the list. :rtype: :py:class:`ListItem` :return: The ListItem object representing the newly added item. """ return _PDFNetPython.List_AddItem(self)
[docs] def ContinueList(self): r""" Continues the logical continuation of a particular list, even if other non-list content items have been created since the last call to AddItem(). This method is useful when splitting a sublist and wanting to continue the new items as part of the original sublist hierarchy. Note: Without calling ContinueList(), new list items created after a split (e.g., a split paragraph) would be added to the main list structure (above the split) based on their natural positions in the list/sublist hierarchy. Example usage: To continue a root-level list after a split, call ContinueList() on the root-level list. """ return _PDFNetPython.List_ContinueList(self)
[docs] def GetIndentationLevel(self): r""" Get the indentation level of the list. :rtype: int :return: The indentation level. """ return _PDFNetPython.List_GetIndentationLevel(self)
[docs] def GetListIdentifier(self): r""" Get the identifier of the list. :rtype: int :return: The list identifier. """ return _PDFNetPython.List_GetListIdentifier(self)
m_impl = property(_PDFNetPython.List_m_impl_get, _PDFNetPython.List_m_impl_set)
# Register List in _PDFNetPython: _PDFNetPython.List_swigregister(List)
[docs] class ListItem(ContentNode): r"""A class representing an item in a list in the document content tree.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") def __init__(self, args, kwargs): raise AttributeError("Noructor defined") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_ListItem
[docs] def AddParagraph(self, args): r""" Overload 1: Add a new paragraph to the list item. :rtype: :py:class:`Paragraph` :return: The Paragraph object representing the newly added paragraph. | Overload 2: Add a new paragraph with the specified text to the list item. :type text: string :param text: The text content of the paragraph. :rtype: :py:class:`Paragraph` :return: The Paragraph object representing the newly added paragraph. """ return _PDFNetPython.ListItem_AddParagraph(self, args)
[docs] def AddList(self): r""" Add a nested list to the list item. :rtype: :py:class:`List` :return: The List object representing the nested list. """ return _PDFNetPython.ListItem_AddList(self)
[docs] def GetIndentationLevel(self): r""" Get the indentation level of the list item. :rtype: int :return: The indentation level. """ return _PDFNetPython.ListItem_GetIndentationLevel(self)
[docs] def GetListIdentifier(self): r""" Get the identifier of the list. :rtype: int :return: The list identifier. """ return _PDFNetPython.ListItem_GetListIdentifier(self)
[docs] def GetItemIndex(self): r""" Get the index of the list item within the parent list. :rtype: int :return: The index of the list item. """ return _PDFNetPython.ListItem_GetItemIndex(self)
m_impl = property(_PDFNetPython.ListItem_m_impl_get, _PDFNetPython.ListItem_m_impl_set)
# Register ListItem in _PDFNetPython: _PDFNetPython.ListItem_swigregister(ListItem)
[docs] class FlowDocument(object): r""" The class FlowDocument. Encapsulates document creation API. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Aructor. Creates an empty document.""" _PDFNetPython.FlowDocument_swiginit(self, _PDFNetPython.new_FlowDocument()) __swig_destroy__ = _PDFNetPython.delete_FlowDocument
[docs] def AddParagraph(self, args): r""" Overload 1: Adds a paragraph to the document. :rtype: :py:class:`Paragraph` :return: The paragraph object | Overload 2: Adds a paragraph to the document and sets the text. :rtype: :py:class:`Paragraph` :return: The paragraph object """ return _PDFNetPython.FlowDocument_AddParagraph(self, args)
[docs] def AddList(self): r""" Adds a list to the document. :rtype: :py:class:`List` :return: The list object """ return _PDFNetPython.FlowDocument_AddList(self)
[docs] def AddTable(self): r""" Adds a table to the document. :rtype: :py:class:`Table` :return: The table object """ return _PDFNetPython.FlowDocument_AddTable(self)
[docs] def SetDefaultMargins(self, left, top, right, bottom): r""" Set the default margins for the document. :type left: double :param left: The left margin in points :type top: double :param top: The top margin in points :type right: double :param right: The right margin in points :type bottom: double :param bottom: The bottom margin in points """ return _PDFNetPython.FlowDocument_SetDefaultMargins(self, left, top, right, bottom)
[docs] def SetDefaultPageSize(self, width, height): r""" Set the default page size for the document. :type width: double :param width: The width in points :type height: double :param height: The height in points """ return _PDFNetPython.FlowDocument_SetDefaultPageSize(self, width, height)
[docs] def GetBody(self): r""" Gets the body of the document. The body is the root of the content tree. It can be used to traverse the content tree via the ContentNodeIterator object. :rtype: :py:class:`ContentNode` :return: The body of the document """ return _PDFNetPython.FlowDocument_GetBody(self)
[docs] def PaginateToPDF(self): r""" Paginates the content tree into a PDFDoc object. :rtype: :py:class:`PDFDoc` :return: The PDFDoc object """ return _PDFNetPython.FlowDocument_PaginateToPDF(self)
m_impl = property(_PDFNetPython.FlowDocument_m_impl_get, _PDFNetPython.FlowDocument_m_impl_set)
# Register FlowDocument in _PDFNetPython: _PDFNetPython.FlowDocument_swigregister(FlowDocument)
[docs] class PDFNet(object): r""" PDFNet contains global library initialization, registration, configuration, and termination methods. Notes: there is only a single, static instance of PDFNet class. Initialization and termination methods need to be called only once per application session. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def EnableJavaScript(enable): r""" A switch that can be used to turn on/off JavaScript engine :type enable: boolean :param enable: true to enable JavaScript engine, false to disable. """ return _PDFNetPython.PDFNet_EnableJavaScript(enable)
[docs] @staticmethod def IsJavaScriptEnabled(): r""" Test whether JavaScript is enabled :rtype: boolean :return: true if it is enabled, false otherwise """ return _PDFNetPython.PDFNet_IsJavaScriptEnabled()
[docs] @staticmethod def SetResourcesPath(path): r""" Sets the location of PDFNet resource file. Notes: Starting with v.4.5 PDFNet no longer requires a seperate resource file, and so this function is not required for proper PDFNet initialization. It remains available for backward compatibility. On mobile systems (iOS, Android, etc.) this method is required for proper initialization starting with version 6.0. (This helps reduce overall app size.) The function can be used on all platforms to specify a default search path for ICC profiles, fonts, and other user defined resources. :type path: string :param path: - The default resource directory path. :rtype: boolean :return: true if path is found, false otherwise. """ return _PDFNetPython.PDFNet_SetResourcesPath(path)
[docs] @staticmethod def GetResourcesPath(): r""" :rtype: string :return: the location of PDFNet resources folder. Empty string means that resources are located in your application folder. """ return _PDFNetPython.PDFNet_GetResourcesPath()
[docs] @staticmethod def AddResourceSearchPath(path): r""" Sets the location of PDFNet resource file. Notes: Starting with v.4.5 PDFNet no longer requires a seperate resource file, and so this function is not required for proper PDFNet initialization. The function can be used on all platforms to specify search paths for ICC profiles, fonts, and other user defined resources. :type path: string :param path: - The resource directory path to add to the search list. """ return _PDFNetPython.PDFNet_AddResourceSearchPath(path)
[docs] @staticmethod def GetVersion(): r""" :rtype: double :return: PDFNet version number. """ return _PDFNetPython.PDFNet_GetVersion()
e_lcms = _PDFNetPython.PDFNet_e_lcms r""" Use LittleCMS (available on all supported platforms).""" e_icm = _PDFNetPython.PDFNet_e_icm r""" Use Windows ICM2 (available only on Windows platforms).""" e_no_cms = _PDFNetPython.PDFNet_e_no_cms r""" No ICC color management."""
[docs] @staticmethod def SetColorManagement(args): r""" Used to set a specific Color Management System (CMS) for use during color conversion operators, image rendering, etc. :type t: int :param t: identifies the type of color management to use. """ return _PDFNetPython.PDFNet_SetColorManagement(args)
[docs] @staticmethod def SetDefaultDeviceCMYKProfile(args): r""" Overload 1: Sets the default ICC color profile for DeviceCMYK color space. Notes: You can use this method to override default PDFNet settings. For more information on default color spaces please refer to section 'Default Color Spaces' in Chapter 4.5.4 of PDF Reference Manual. :raises: the function will throw Exception if the ICC profile can't be found or if it fails to open. | Overload 2: Sets the default ICC color profile for DeviceCMYK color space. Notes: You can use this method to override default PDFNet settings. For more information on default color spaces please refer to section 'Default Color Spaces' in Chapter 4.5.4 of PDF Reference Manual. :raises: the function will throw Exception if the ICC profile fails to open. """ return _PDFNetPython.PDFNet_SetDefaultDeviceCMYKProfile(args)
[docs] @staticmethod def SetDefaultDeviceRGBProfile(args): r""" Overload 1: Sets the default ICC color profile for DeviceRGB color space. Notes: You can use this method to override default PDFNet settings. For more information on default color spaces please refer to section 'Default Color Spaces' in Chapter 4.5.4 of PDF Reference Manual. :raises: the function will throw Exception if the ICC profile can't be found or if it fails to open. | Overload 2: Sets the default ICC color profile for DeviceRGB color space. Notes: You can use this method to override default PDFNet settings. For more information on default color spaces please refer to section 'Default Color Spaces' in Chapter 4.5.4 of PDF Reference Manual. :raises: the function will throw Exception if the ICC profile fails to open. """ return _PDFNetPython.PDFNet_SetDefaultDeviceRGBProfile(args)
[docs] @staticmethod def SetDefaultDiskCachingEnabled(use_disk): r""" Sets the default policy on using temporary files. _disk if parameter is true then new documents are allowed to create temporary files; otherwise all document contents will be stored in memory. """ return _PDFNetPython.PDFNet_SetDefaultDiskCachingEnabled(use_disk)
e_Z_DEFAULT_COMPRESSION = _PDFNetPython.PDFNet_e_Z_DEFAULT_COMPRESSION e_Z_NO_COMPRESSION = _PDFNetPython.PDFNet_e_Z_NO_COMPRESSION e_Z_BEST_SPEED = _PDFNetPython.PDFNet_e_Z_BEST_SPEED e_Z_BEST_COMPRESSION = _PDFNetPython.PDFNet_e_Z_BEST_COMPRESSION
[docs] @staticmethod def SetDefaultFlateCompressionLevel(level): r""" Sets the default compression level for Flate (ZLib). :type level: int :param level: An integer in range 0-9 representing the compression value to use as a default for any Flate streams (e.g used to compress content streams, PNG images, etc). The library normally uses the default compression level (Z_DEFAULT_COMPRESSION). For most images, compression values in the range 3-6 compress nearly as well as higher levels, and do so much faster. For on-line applications it may be desirable to have maximum speed Z_BEST_SPEED = 1). You can also specify no compression (Z_NO_COMPRESSION = 0). Z_DEFAULT_COMPRESSION (-1). """ return _PDFNetPython.PDFNet_SetDefaultFlateCompressionLevel(level)
[docs] @staticmethod def SetViewerCache(max_cache_size, on_disk): r""" Sets the default parameters for the viewer cache. Any subsequently created documents will use these parameters. :type max_cache_size: int :param max_cache_size: - The maximum size, in bytes, of the entire document's page cache. Set to zero to disable the viewer cache. :type on_disk: boolean :param on_disk: - If set to 'true', cache will be stored on the local filesystem. If set to 'false', cache will be stored in heap memory. Desktop: max_cache_size = 512 MB, on_disk = true | Mobile: max_cache_size = 100 MB, on_disk = false """ return _PDFNetPython.PDFNet_SetViewerCache(max_cache_size, on_disk)
e_Identity = _PDFNetPython.PDFNet_e_Identity r""" Generic/Unicode""" e_Japan1 = _PDFNetPython.PDFNet_e_Japan1 r""" Japanese""" e_Japan2 = _PDFNetPython.PDFNet_e_Japan2 r""" Japanese""" e_GB1 = _PDFNetPython.PDFNet_e_GB1 r""" Chinese; Simplified""" e_CNS1 = _PDFNetPython.PDFNet_e_CNS1 r""" Chinese; Traditional""" e_Korea1 = _PDFNetPython.PDFNet_e_Korea1 r""" Korean"""
[docs] @staticmethod def AddFontSubst(args): r""" Overload 1: AddFontSubst functions can be used to create font substitutes that can override default PDFNet font selection algorithm. AddFontSubst functions are useful in situations where referenced fonts are not present in the document and PDFNet font substitution algorithm is not producing desired results. AddFontSubst(fontname, fontpath) maps the given font name (i.e. 'BaseFont' entry from the font dictionary) to a font file. The following is an example of using this function to provide user defined font substitutes: .. code-block:: c++ PDFNet::Initialize(); PDFNet::SetResourcesPath("c:/myapp/resources"); // Specify specific font mappings... PDFNet::AddFontSubst("MinionPro-Regular", "c:/myfonts/MinionPro-Regular.otf"); PDFNet::AddFontSubst("Times-Roman", "c:/windows/fonts/times.ttf"); PDFNet::AddFontSubst("Times-Italic", "c:/windows/fonts/timesi.ttf"); ... PDFDoc doc("c:/my.pdf"); ... | Overload 2: AddFontSubst functions can be used to create font substitutes that can override default PDFNet font selection algorithm. AddFontSubst functions are useful in situations where referenced fonts are not present in the document and PDFNet font substitution algorithm is not producing desired results. AddFontSubst(ordering, fontpath) maps the given character ordering (see Ordering entry in CIDSystemInfo dictionary; Section 5.6.2 in PDF Reference) to a font file. This method is less specific that the former variant of AddFontSubst, and can be used to override a range of missing fonts (or any missing font) with a predefined substitute. The following is an example of using this function to provide user defined font substitutes: .. code-block:: c++ PDFNet::Initialize(); PDFNet::SetResourcesPath("c:/myapp/resources"); // Specify more general font mappings... PDFNet::AddFontSubst(PDFNet::e_Identity, "c:/myfonts/arialuni.ttf"); // Arial Unicode MS PDFNet::AddFontSubst(PDFNet::e_Japan1, "c:/myfonts/KozMinProVI-Regular.otf"); PDFNet::AddFontSubst(PDFNet::e_Japan2, "c:/myfonts/KozMinProVI-Regular.otf"); PDFNet::AddFontSubst(PDFNet::e_Korea1, "c:/myfonts/AdobeSongStd-Light.otf"); PDFNet::AddFontSubst(PDFNet::e_CNS1, "c:/myfonts/AdobeMingStd-Light.otf"); PDFNet::AddFontSubst(PDFNet::e_GB1, "c:/myfonts/AdobeMyungjoStd-Medium.otf"); ... PDFDoc doc("c:/my.pdf"); ... """ return _PDFNetPython.PDFNet_AddFontSubst(args)
[docs] @staticmethod def SetTempPath(temp_path): r""" Set the location of temporary folder. This method is provided for applications that require tight control of the location where temporary files are created. """ return _PDFNetPython.PDFNet_SetTempPath(temp_path)
[docs] @staticmethod def SetPersistentCachePath(persistent_path): r""" Set the location of persistent cache files. This method is provided for applications that require tight control of the location where temporary files are created. """ return _PDFNetPython.PDFNet_SetPersistentCachePath(persistent_path)
[docs] @staticmethod def GetSystemFontList(): r""" Get available fonts on the system. :rtype: string :return: A JSON list of fonts accessible to PDFNet """ return _PDFNetPython.PDFNet_GetSystemFontList()
e_LogLevel_Off = _PDFNetPython.PDFNet_e_LogLevel_Off e_LogLevel_Fatal = _PDFNetPython.PDFNet_e_LogLevel_Fatal e_LogLevel_Error = _PDFNetPython.PDFNet_e_LogLevel_Error e_LogLevel_Warning = _PDFNetPython.PDFNet_e_LogLevel_Warning e_LogLevel_Info = _PDFNetPython.PDFNet_e_LogLevel_Info e_LogLevel_Trace = _PDFNetPython.PDFNet_e_LogLevel_Trace e_LogLevel_Debug = _PDFNetPython.PDFNet_e_LogLevel_Debug
[docs] @staticmethod def SetLogLevel(args): return _PDFNetPython.PDFNet_SetLogLevel(args)
[docs] @staticmethod def AddPDFTronCustomHandler(custom_id): r""" End of conditional comment. Add PDFTron Custom Security handler :type custom_id: int :param custom_id: The user's custom id. The id should match what was used to create PDFTronCustomSecurityHandler when encrypting the document. Notes: calling this function is a requirement to load files encrypted with PDFTronCustomSecurityHandler. """ return _PDFNetPython.PDFNet_AddPDFTronCustomHandler(custom_id)
[docs] @staticmethod def GetVersionString(): r""" :rtype: string :return: PDFNet version as a string. """ return _PDFNetPython.PDFNet_GetVersionString()
[docs] @staticmethod def SetWriteAPIUsageLocally(write_usage): r""" Enable writing API usage locally. :type write_usage: boolean :param write_usage: if parameter is true API usage will be written to local JSON files in the persistent cache path otherwise no API usage is saved. """ return _PDFNetPython.PDFNet_SetWriteAPIUsageLocally(write_usage)
e_continue = _PDFNetPython.PDFNet_e_continue e_continue_unless_switching_to_demo = _PDFNetPython.PDFNet_e_continue_unless_switching_to_demo e_stop = _PDFNetPython.PDFNet_e_stop
[docs] @staticmethod def SetConnectionErrorHandlingMode(mode): r""" Sets the connection error handling behaviour for Apryse SDK The default for this method is e_continue :type mode: int :param mode: Rules that Apryse SDK will follow after a connection error. """ return _PDFNetPython.PDFNet_SetConnectionErrorHandlingMode(mode)
[docs] @staticmethod def SetConnectionErrorProc(instance): r""" Sets the error handling function to be called when an error is encountered when connecting to PDFTron Web Services. :param error_proc: Connection error handling callback function (or delegate in .NET) :param data: Custom data to be passed as the fourth parameter to 'error_proc'. """ return _PDFNetPython.PDFNet_SetConnectionErrorProc(instance)
[docs] @staticmethod def Initialize(args): return _PDFNetPython.PDFNet_Initialize(args)
[docs] @staticmethod def Terminate(args): return _PDFNetPython.PDFNet_Terminate(args)
def __init__(self): _PDFNetPython.PDFNet_swiginit(self, _PDFNetPython.new_PDFNet()) __swig_destroy__ = _PDFNetPython.delete_PDFNet
# Register PDFNet in _PDFNetPython: _PDFNetPython.PDFNet_swigregister(PDFNet)
[docs] def PDFNet_EnableJavaScript(enable): r""" A switch that can be used to turn on/off JavaScript engine :type enable: boolean :param enable: true to enable JavaScript engine, false to disable. """ return _PDFNetPython.PDFNet_EnableJavaScript(enable)
[docs] def PDFNet_IsJavaScriptEnabled(): r""" Test whether JavaScript is enabled :rtype: boolean :return: true if it is enabled, false otherwise """ return _PDFNetPython.PDFNet_IsJavaScriptEnabled()
[docs] def PDFNet_SetResourcesPath(path): r""" Sets the location of PDFNet resource file. Notes: Starting with v.4.5 PDFNet no longer requires a seperate resource file, and so this function is not required for proper PDFNet initialization. It remains available for backward compatibility. On mobile systems (iOS, Android, etc.) this method is required for proper initialization starting with version 6.0. (This helps reduce overall app size.) The function can be used on all platforms to specify a default search path for ICC profiles, fonts, and other user defined resources. :type path: string :param path: - The default resource directory path. :rtype: boolean :return: true if path is found, false otherwise. """ return _PDFNetPython.PDFNet_SetResourcesPath(path)
[docs] def PDFNet_GetResourcesPath(): r""" :rtype: string :return: the location of PDFNet resources folder. Empty string means that resources are located in your application folder. """ return _PDFNetPython.PDFNet_GetResourcesPath()
[docs] def PDFNet_AddResourceSearchPath(path): r""" Sets the location of PDFNet resource file. Notes: Starting with v.4.5 PDFNet no longer requires a seperate resource file, and so this function is not required for proper PDFNet initialization. The function can be used on all platforms to specify search paths for ICC profiles, fonts, and other user defined resources. :type path: string :param path: - The resource directory path to add to the search list. """ return _PDFNetPython.PDFNet_AddResourceSearchPath(path)
[docs] def PDFNet_GetVersion(): r""" :rtype: double :return: PDFNet version number. """ return _PDFNetPython.PDFNet_GetVersion()
[docs] def PDFNet_SetColorManagement(args): r""" Used to set a specific Color Management System (CMS) for use during color conversion operators, image rendering, etc. :type t: int :param t: identifies the type of color management to use. """ return _PDFNetPython.PDFNet_SetColorManagement(args)
[docs] def PDFNet_SetDefaultDeviceCMYKProfile(args): r""" Overload 1: Sets the default ICC color profile for DeviceCMYK color space. Notes: You can use this method to override default PDFNet settings. For more information on default color spaces please refer to section 'Default Color Spaces' in Chapter 4.5.4 of PDF Reference Manual. :raises: the function will throw Exception if the ICC profile can't be found or if it fails to open. | Overload 2: Sets the default ICC color profile for DeviceCMYK color space. Notes: You can use this method to override default PDFNet settings. For more information on default color spaces please refer to section 'Default Color Spaces' in Chapter 4.5.4 of PDF Reference Manual. :raises: the function will throw Exception if the ICC profile fails to open. """ return _PDFNetPython.PDFNet_SetDefaultDeviceCMYKProfile(args)
[docs] def PDFNet_SetDefaultDeviceRGBProfile(args): r""" Overload 1: Sets the default ICC color profile for DeviceRGB color space. Notes: You can use this method to override default PDFNet settings. For more information on default color spaces please refer to section 'Default Color Spaces' in Chapter 4.5.4 of PDF Reference Manual. :raises: the function will throw Exception if the ICC profile can't be found or if it fails to open. | Overload 2: Sets the default ICC color profile for DeviceRGB color space. Notes: You can use this method to override default PDFNet settings. For more information on default color spaces please refer to section 'Default Color Spaces' in Chapter 4.5.4 of PDF Reference Manual. :raises: the function will throw Exception if the ICC profile fails to open. """ return _PDFNetPython.PDFNet_SetDefaultDeviceRGBProfile(args)
[docs] def PDFNet_SetDefaultDiskCachingEnabled(use_disk): r""" Sets the default policy on using temporary files. _disk if parameter is true then new documents are allowed to create temporary files; otherwise all document contents will be stored in memory. """ return _PDFNetPython.PDFNet_SetDefaultDiskCachingEnabled(use_disk)
[docs] def PDFNet_SetDefaultFlateCompressionLevel(level): r""" Sets the default compression level for Flate (ZLib). :type level: int :param level: An integer in range 0-9 representing the compression value to use as a default for any Flate streams (e.g used to compress content streams, PNG images, etc). The library normally uses the default compression level (Z_DEFAULT_COMPRESSION). For most images, compression values in the range 3-6 compress nearly as well as higher levels, and do so much faster. For on-line applications it may be desirable to have maximum speed Z_BEST_SPEED = 1). You can also specify no compression (Z_NO_COMPRESSION = 0). Z_DEFAULT_COMPRESSION (-1). """ return _PDFNetPython.PDFNet_SetDefaultFlateCompressionLevel(level)
[docs] def PDFNet_SetViewerCache(max_cache_size, on_disk): r""" Sets the default parameters for the viewer cache. Any subsequently created documents will use these parameters. :type max_cache_size: int :param max_cache_size: - The maximum size, in bytes, of the entire document's page cache. Set to zero to disable the viewer cache. :type on_disk: boolean :param on_disk: - If set to 'true', cache will be stored on the local filesystem. If set to 'false', cache will be stored in heap memory. Desktop: max_cache_size = 512 MB, on_disk = true | Mobile: max_cache_size = 100 MB, on_disk = false """ return _PDFNetPython.PDFNet_SetViewerCache(max_cache_size, on_disk)
[docs] def PDFNet_AddFontSubst(args): r""" Overload 1: AddFontSubst functions can be used to create font substitutes that can override default PDFNet font selection algorithm. AddFontSubst functions are useful in situations where referenced fonts are not present in the document and PDFNet font substitution algorithm is not producing desired results. AddFontSubst(fontname, fontpath) maps the given font name (i.e. 'BaseFont' entry from the font dictionary) to a font file. The following is an example of using this function to provide user defined font substitutes: .. code-block:: c++ PDFNet::Initialize(); PDFNet::SetResourcesPath("c:/myapp/resources"); // Specify specific font mappings... PDFNet::AddFontSubst("MinionPro-Regular", "c:/myfonts/MinionPro-Regular.otf"); PDFNet::AddFontSubst("Times-Roman", "c:/windows/fonts/times.ttf"); PDFNet::AddFontSubst("Times-Italic", "c:/windows/fonts/timesi.ttf"); ... PDFDoc doc("c:/my.pdf"); ... | Overload 2: AddFontSubst functions can be used to create font substitutes that can override default PDFNet font selection algorithm. AddFontSubst functions are useful in situations where referenced fonts are not present in the document and PDFNet font substitution algorithm is not producing desired results. AddFontSubst(ordering, fontpath) maps the given character ordering (see Ordering entry in CIDSystemInfo dictionary; Section 5.6.2 in PDF Reference) to a font file. This method is less specific that the former variant of AddFontSubst, and can be used to override a range of missing fonts (or any missing font) with a predefined substitute. The following is an example of using this function to provide user defined font substitutes: .. code-block:: c++ PDFNet::Initialize(); PDFNet::SetResourcesPath("c:/myapp/resources"); // Specify more general font mappings... PDFNet::AddFontSubst(PDFNet::e_Identity, "c:/myfonts/arialuni.ttf"); // Arial Unicode MS PDFNet::AddFontSubst(PDFNet::e_Japan1, "c:/myfonts/KozMinProVI-Regular.otf"); PDFNet::AddFontSubst(PDFNet::e_Japan2, "c:/myfonts/KozMinProVI-Regular.otf"); PDFNet::AddFontSubst(PDFNet::e_Korea1, "c:/myfonts/AdobeSongStd-Light.otf"); PDFNet::AddFontSubst(PDFNet::e_CNS1, "c:/myfonts/AdobeMingStd-Light.otf"); PDFNet::AddFontSubst(PDFNet::e_GB1, "c:/myfonts/AdobeMyungjoStd-Medium.otf"); ... PDFDoc doc("c:/my.pdf"); ... """ return _PDFNetPython.PDFNet_AddFontSubst(args)
[docs] def PDFNet_SetTempPath(temp_path): r""" Set the location of temporary folder. This method is provided for applications that require tight control of the location where temporary files are created. """ return _PDFNetPython.PDFNet_SetTempPath(temp_path)
[docs] def PDFNet_SetPersistentCachePath(persistent_path): r""" Set the location of persistent cache files. This method is provided for applications that require tight control of the location where temporary files are created. """ return _PDFNetPython.PDFNet_SetPersistentCachePath(persistent_path)
[docs] def PDFNet_GetSystemFontList(): r""" Get available fonts on the system. :rtype: string :return: A JSON list of fonts accessible to PDFNet """ return _PDFNetPython.PDFNet_GetSystemFontList()
[docs] def PDFNet_SetLogLevel(args): return _PDFNetPython.PDFNet_SetLogLevel(args)
[docs] def PDFNet_AddPDFTronCustomHandler(custom_id): r""" End of conditional comment. Add PDFTron Custom Security handler :type custom_id: int :param custom_id: The user's custom id. The id should match what was used to create PDFTronCustomSecurityHandler when encrypting the document. Notes: calling this function is a requirement to load files encrypted with PDFTronCustomSecurityHandler. """ return _PDFNetPython.PDFNet_AddPDFTronCustomHandler(custom_id)
[docs] def PDFNet_GetVersionString(): r""" :rtype: string :return: PDFNet version as a string. """ return _PDFNetPython.PDFNet_GetVersionString()
[docs] def PDFNet_SetWriteAPIUsageLocally(write_usage): r""" Enable writing API usage locally. :type write_usage: boolean :param write_usage: if parameter is true API usage will be written to local JSON files in the persistent cache path otherwise no API usage is saved. """ return _PDFNetPython.PDFNet_SetWriteAPIUsageLocally(write_usage)
[docs] def PDFNet_SetConnectionErrorHandlingMode(mode): r""" Sets the connection error handling behaviour for Apryse SDK The default for this method is e_continue :type mode: int :param mode: Rules that Apryse SDK will follow after a connection error. """ return _PDFNetPython.PDFNet_SetConnectionErrorHandlingMode(mode)
[docs] def PDFNet_SetConnectionErrorProc(instance): r""" Sets the error handling function to be called when an error is encountered when connecting to PDFTron Web Services. :param error_proc: Connection error handling callback function (or delegate in .NET) :param data: Custom data to be passed as the fourth parameter to 'error_proc'. """ return _PDFNetPython.PDFNet_SetConnectionErrorProc(instance)
[docs] def PDFNet_Initialize(args): return _PDFNetPython.PDFNet_Initialize(args)
[docs] def PDFNet_Terminate(args): return _PDFNetPython.PDFNet_Terminate(args)
[docs] class PDFView(object): r""" PDFView is a utility class that can be used for interactive rendering of PDF documents. In .NET environment PDFView is derived from System.Windows.Forms.Control and it can be used like a regular form (see PDFViewForm.cs in PDFView sample for C# for a concrete example). PDFView implements some essential features such as double-buffering, multi-threaded rendering, scrolling, zooming, and page navigation that are essential in interactive rendering applications (e.g. in client PDF viewing and editing applications). PDFView defines several coordinate spaces and it is important to understand their differences: - Page Space refers to the space in which a PDF page is defined. It is determined by a page itself and the origin is at the lower-left corner of the page. Note that Page Space is independent of how a page is viewed in PDFView and each page has its own Page space. - Canvas Space refers to the tightest axis-aligned bounding box of all the pages given the current page presentation mode in PDFView. For example, if the page presentation mode is e_single_continuous, all the pages are arranged vertically with one page in each row, and therefore the Canvas Space is rectangle with possibly large height value. For this reason, Canvas Space is also, like Page Space, independent of the zoom factor. Also note that since PDFView adds gaps between adjacent pages, the Canvas Space is larger than the space occupied by all the pages. The origin of the Canvas Space is located at the upper-left corner. - Screen Space (or Client Space) is the space occupied by PDFView and its origin is at the upper-left corner. Note that the virtual size of this space can extend beyond the visible region. - Scrollable Space is the virtual space within which PDFView can scroll. It is determined by the Canvas Space and the current zoom factor. Roughly speaking, the dimensions of the Scrollable Space is the dimensions of the Canvas Space timed by the zoom. Therefore, a large zoom factor will result in a larger Scrollable region given the same Canvas region. For this reason, Scrollable Space might also be referred to as Zoomed Canvas Space. Note that since PDFView adds gaps between pages in Canvas Space and these gaps are not scaled when rendered, the scrollable range is not exactly what the zoom factor times the Canvas range. For functions such as SetHScrollPos(), SetVScrollPos(), GetCanvasHeight(), and GetCanvasWidth(), it is the Scrollable Space that is involved. Notes: PDFView is available on all platforms supported by PDFNet. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r""" PDFViewructor and destructor. Create PDFView without associating it to any document. """ _PDFNetPython.PDFView_swiginit(self, _PDFNetPython.new_PDFView()) __swig_destroy__ = _PDFNetPython.delete_PDFView
[docs] def SetDoc(self, doc): r""" Associates this PDFView with a given PDF document. :type doc: :py:class:`PDFDoc` :param doc: - A document to be displayed in the view. """ return _PDFNetPython.PDFView_SetDoc(self, doc)
[docs] def OpenUniversalDoc(self, conversion): r""" Associates this PDFView with a given document conversion. The conversion will be performed page-by-page, asynchronously. The pdview object will be updated to display the conversion result :param doc: - A document to be displayed in the view. """ return _PDFNetPython.PDFView_OpenUniversalDoc(self, conversion)
[docs] def CloseDoc(self): r"""Close the associated PDF document.""" return _PDFNetPython.PDFView_CloseDoc(self)
[docs] def GetDoc(self): r""" :rtype: :py:class:`PDFDoc` :return: Currently associated document with this PDFView. """ return _PDFNetPython.PDFView_GetDoc(self)
[docs] def DocLock(self, cancel_threads): r""" Acquires a write lock on the currently open document, optionally canceling all threads accessing the document. """ return _PDFNetPython.PDFView_DocLock(self, cancel_threads)
[docs] def DocUnlock(self): r"""Releases the write lock from the currently open document.""" return _PDFNetPython.PDFView_DocUnlock(self)
[docs] def DocTryLock(self, milliseconds=0): r""" Try acquiring a write lock on the currently open document, waiting no longer than specified number of milliseconds. :rtype: boolean :return: true if the document is locked for multi-threaded access, false otherwise. """ return _PDFNetPython.PDFView_DocTryLock(self, milliseconds)
[docs] def DocLockRead(self): r""" Locks the currently open document to prevent competing write threads (using Lock()) from accessing the document at the same time. Other reader threads however, will be allowed to access the document. Threads attempting to obtain write access to the document will wait in suspended state until the thread that owns the lock calls doc.UnlockRead(). Note: To avoid deadlocks obtaining a write lock while holding a read lock is not permitted and will throw an exception. If this situation is encountered please either unlock the read lock before the write lock is obtained or acquire a write lock (rather than read lock) in the first place. """ return _PDFNetPython.PDFView_DocLockRead(self)
[docs] def DocUnlockRead(self): r"""Releases the read lock from the currently open document.""" return _PDFNetPython.PDFView_DocUnlockRead(self)
[docs] def DocTryLockRead(self, milliseconds=0): r""" Try acquiring a read lock on the current document, waiting no longer than specified number of milliseconds. :rtype: boolean :return: true if the document is locked for multi-threaded access, false otherwise. """ return _PDFNetPython.PDFView_DocTryLockRead(self, milliseconds)
e_single_page = _PDFNetPython.PDFView_e_single_page e_single_continuous = _PDFNetPython.PDFView_e_single_continuous e_facing = _PDFNetPython.PDFView_e_facing e_facing_continuous = _PDFNetPython.PDFView_e_facing_continuous e_facing_cover = _PDFNetPython.PDFView_e_facing_cover e_facing_continuous_cover = _PDFNetPython.PDFView_e_facing_continuous_cover
[docs] def SetPagePresentationMode(self, mode): r""" Sets the current page presentation mode. :type mode: int :param mode: - the new page presentation mode. The default PagePresentationMode is e_single_continuous. """ return _PDFNetPython.PDFView_SetPagePresentationMode(self, mode)
[docs] def GetPagePresentationMode(self): r""" :rtype: int :return: the current page presentation mode. """ return _PDFNetPython.PDFView_GetPagePresentationMode(self)
[docs] def SetColorPostProcessMode(self, mode): r""" Set the color post processing transformation. This transform is applied to the rasterized bitmap as the final step in the rasterization process, and is applied directly to the resulting bitmap (disregarding any color space information). Color post processing only supported for RGBA output. :type mode: int :param mode: is the specific transform to be applied """ return _PDFNetPython.PDFView_SetColorPostProcessMode(self, mode)
[docs] def SetColorPostProcessMapFile(self, image_file_contents): r""" Sets the color post processing transformation. This transform is applied to the rasterized bitmap as the final step in the rasterization process, and is applied directly to the resulting bitmap (disregarding any color space information). Color post processing only supported for RGBA output. This mode will map the brightness of the original rasterized bitmap to a gradient in image_file_contents from left to right. :type image_file_contents: :py:class:`Filter` :param image_file_contents: A filter with image file contents. """ return _PDFNetPython.PDFView_SetColorPostProcessMapFile(self, image_file_contents)
[docs] def GetPostProcessedColor(self, color): r""" Converts a color based on the view's color post processing transformation. :type color: :py:class:`ColorPt` :param color: the color to be converted :rtype: :py:class:`ColorPt` :return: the post-processed color """ return _PDFNetPython.PDFView_GetPostProcessedColor(self, color)
[docs] def SetColorPostProcessColors(self, white_color, black_color): r""" Sets the color post processing transformation. This transform is applied to the rasterized bitmap as the final step in the rasterization process, and is applied directly to the resulting bitmap (disregarding any color space information). Color post processing only supported for RGBA output. This mode will map the brightness of the original rasterized bitmap to a gradient between whiteColor and blackColor :type white_color: int :param white_color: The white color (ARGB) of the page. :type black_color: int :param black_color: The black color (ARGB) of the page. """ return _PDFNetPython.PDFView_SetColorPostProcessColors(self, white_color, black_color)
[docs] def GetColorPostProcessMode(self): r""" :rtype: int :return: the current color post processing mode. """ return _PDFNetPython.PDFView_GetColorPostProcessMode(self)
[docs] def GetCurrentPage(self): r""" :rtype: int :return: the current page displayed in the view. """ return _PDFNetPython.PDFView_GetCurrentPage(self)
[docs] def GetPageCount(self): r""" :rtype: int :return: the total number of pages in the document. """ return _PDFNetPython.PDFView_GetPageCount(self)
[docs] def GotoFirstPage(self): r""" Sets the current page to the first page in the document. :rtype: boolean :return: true if successful, false otherwise. """ return _PDFNetPython.PDFView_GotoFirstPage(self)
[docs] def GotoLastPage(self): r""" Sets the current page to the last page in the document. :rtype: boolean :return: true if successful, false otherwise. """ return _PDFNetPython.PDFView_GotoLastPage(self)
[docs] def GotoNextPage(self): r""" Sets the current page to the next page in the document. :rtype: boolean :return: true if successful, false otherwise. """ return _PDFNetPython.PDFView_GotoNextPage(self)
[docs] def GotoPreviousPage(self): r""" Sets the current page to the previous page in the document. :rtype: boolean :return: true if successful, false otherwise. """ return _PDFNetPython.PDFView_GotoPreviousPage(self)
[docs] def SetCurrentPage(self, page_num): r""" Sets the current page to the given page. :rtype: boolean :return: true if successful, false otherwise. """ return _PDFNetPython.PDFView_SetCurrentPage(self, page_num)
[docs] def ShowRect(self, page_num, rect): r""" Changes the viewing area to fit a rectangle rect on page page_num. Rectangle must be specified in page coordinates. This will adjust current page and zoom appropriately. :rtype: boolean :return: true if successful, false otherwise. """ return _PDFNetPython.PDFView_ShowRect(self, page_num, rect)
[docs] def GetVisiblePages(self): r""" Get a vector with the pages currently visible on the screen. :rtype: std::vector< int,std::allocator< int > > :return: a vector of the pages currently visible on the screen. """ return _PDFNetPython.PDFView_GetVisiblePages(self)
[docs] def GetZoom(self): r""" Returns the current zoom factor. :rtype: double :return: current zoom (or scaling) component used to display the page content. """ return _PDFNetPython.PDFView_GetZoom(self)
[docs] def SetZoom(self, args): r""" Overload 1: Sets the zoom factor to a new value. The function zooms to a point at the center of the rendering buffer. :type zoom: double :param zoom: - new scaling component used to display the page content. :rtype: boolean :return: true if successful, false otherwise. | Overload 2: Sets the zoom factor to a new value using the given pixel coordinate (x,y) as a zoom center, which will stay fixed on the screen. The zoom point (x,y) is represented in the screen space, which starts in the upper-left corner of the client window. Should you want to move (x, y) to the center of the client window, you can use the OnScroll() subsequently: int x, y; double zoom; ... view.SetZoom(x, y, zoom); int width = view.GetBufferWidth(); int height = view.GetBufferHeight(); int dx = (int)(x - (double)width/2 + 0.5); int dy = (int)(y - (double)height/2 + 0.5); view.OnScroll(dx, dy); :type x: int :param x: - the horizontal coordinate to zoom in. :type y: int :param y: - the vertical coordinate to zoom in. :type zoom: double :param zoom: - new scaling component used to display the page content. :rtype: boolean :return: true if successful, false otherwise. """ return _PDFNetPython.PDFView_SetZoom(self, args)
[docs] def SmartZoom(self, x, y): r""" Sets the zoom factor to a new value using the given pixel coordinate (x,y) to find an intersecting paragraph. The width of the paragraph helps to determine the zoom value, center of the paragraph is used as a zoom center. Paragraph has to contain more than one line and be wider than 1/5th of a page width. When called on a paragraph wider than current zoom level the new zoom level is set to fit the entire page(zoom out). The zoom point (x,y) is represented in the screen space, which starts in the upper-left corner of the client window. :type x: int :param x: - the horizontal coordinate to look for a text block. :type y: int :param y: - the vertical coordinate to look for a text block. :rtype: boolean :return: true if successful, false if no paragraph intersects the given point. """ return _PDFNetPython.PDFView_SmartZoom(self, x, y)
[docs] def RotateClockwise(self): r"""Rotates all pages in the document 90 degrees clockwise.""" return _PDFNetPython.PDFView_RotateClockwise(self)
[docs] def RotateCounterClockwise(self): r"""Rotates all pages in the document 90 degrees counter-clockwise.""" return _PDFNetPython.PDFView_RotateCounterClockwise(self)
[docs] def GetRotation(self): r""" :rtype: int :return: The current rotation of this PDFView. """ return _PDFNetPython.PDFView_GetRotation(self)
[docs] def GetPageNumberFromScreenPt(self, x, y): r""" :rtype: int :return: the number of the page located under the given screen coordinate. The positive number indicates a valid page, whereas number less than 1 means that no page was found. """ return _PDFNetPython.PDFView_GetPageNumberFromScreenPt(self, x, y)
[docs] def ConvScreenPtToCanvasPt(self, pt): r"""Converts a point expressed in screen space to a point in canvas space.""" return _PDFNetPython.PDFView_ConvScreenPtToCanvasPt(self, pt)
[docs] def ConvCanvasPtToScreenPt(self, pt): r"""Converts a point expressed in canvas space to a point in screen space.""" return _PDFNetPython.PDFView_ConvCanvasPtToScreenPt(self, pt)
[docs] def ConvCanvasPtToPagePt(self, pt, page_num=-1): r""" Converts a point expressed in canvas space to a point in a page space. :type page_num: int :param page_num: the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one. """ return _PDFNetPython.PDFView_ConvCanvasPtToPagePt(self, pt, page_num)
[docs] def ConvPagePtToCanvasPt(self, pt, page_num=-1): r""" Converts a point from a page space to point in canvas space. :type page_num: int :param page_num: the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one. """ return _PDFNetPython.PDFView_ConvPagePtToCanvasPt(self, pt, page_num)
[docs] def ConvScreenPtToPagePt(self, pt, page_num=-1): r""" Converts a point expressed in screen space to a point in a page space. :type page_num: int :param page_num: the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one. """ return _PDFNetPython.PDFView_ConvScreenPtToPagePt(self, pt, page_num)
[docs] def ConvPagePtToScreenPt(self, pt, page_num=-1): r""" Converts a point in a page space to a point in the screen space. If PDFView is in a non-continous page view mode, and the page is not visible, the result is undefined. :type page_num: int :param page_num: the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one. """ return _PDFNetPython.PDFView_ConvPagePtToScreenPt(self, pt, page_num)
[docs] def SnapToNearestInDoc(self, screen_pt): r""" Snaps an xy coordinate pair (in screen space) to the nearest piece of document geometry. """ return _PDFNetPython.PDFView_SnapToNearestInDoc(self, screen_pt)
[docs] def SetSnappingMode(self, mode_flags): r""" Set the point snapping mode for the SnapToNearestInDoc method. By default SnapToNearestInDoc will snap to line endpoints, midpoints, and intersections. :param mode_flag: a bitwise combination of the members of `GeometryCollection::SnappingMode` """ return _PDFNetPython.PDFView_SetSnappingMode(self, mode_flags)
[docs] def GetDeviceTransform(self, page_num=-1): r""" :rtype: :py:class:`Matrix2D` :return: the device transformation matrix. The device transformation matrix maps the page coordinate system to screen (or device) coordinate system. :type page_num: int :param page_num: same as for PDFView.Conv???() methods. Notes: to obtain a transformation matrix that maps screen coordinates to page coordinates, you can invert the device matrix. For example: .. code-block:: c++ Common::Matrix2D scr2page(pdfview.GetDeviceTransform()); scr2page.Inverse(); """ return _PDFNetPython.PDFView_GetDeviceTransform(self, page_num)
[docs] def SetErrorReportProc(self, instance): r""" Sets the error handling function to be called in case an error is encountered during page rendering. :param error_proc: Error handling callback function (or delegate in .NET) :param data: Custom data to be passed as a second parameter to 'error_proc'. """ return _PDFNetPython.PDFView_SetErrorReportProc(self, instance)
[docs] def SetCurrentPageProc(self, instance): r""" Sets the callback function (i.e. a delegate) that is called whenever current page number changes. This can be used to update the current page number within GUI applications etc. :param curr_pagenum_proc: Callback function (or a delegate in .NET). :param data: Custom data to be passed as a second parameter to 'curr_pagenum_proc'. """ return _PDFNetPython.PDFView_SetCurrentPageProc(self, instance)
[docs] def SetJavaScriptEventCallBack(self, instance): r""" Sets the callback function (i.e. a delegate) for JavaScript action. Can be used to handle alert event which pops up a window with alert message. :param js_proc: Callback function (or a delegate in .NET). :param data: user defined data """ return _PDFNetPython.PDFView_SetJavaScriptEventCallBack(self, instance)
[docs] def SetCurrentZoomProc(self, instance): r""" Sets the callback function (i.e. a delegate) that is called whenever current zoom (magnification) changes. This can be used to update the current zoom number within GUI applications etc. :param curr_zoom_proc: Callback function (or a delegate in .NET). :param data: Custom data to be passed as a second parameter to 'curr_zoom_proc'. """ return _PDFNetPython.PDFView_SetCurrentZoomProc(self, instance)
[docs] def ExecuteAction(self, args): return _PDFNetPython.PDFView_ExecuteAction(self, args)
[docs] def GetCanvasWidth(self): r"""Returns the width of the scrollable space.""" return _PDFNetPython.PDFView_GetCanvasWidth(self)
[docs] def GetCanvasHeight(self): r"""Returns the height of the scrollable space.""" return _PDFNetPython.PDFView_GetCanvasHeight(self)
[docs] def GetHScrollPos(self): r""" :rtype: double :return: the current horizontal scroll position in the scrollable space. """ return _PDFNetPython.PDFView_GetHScrollPos(self)
[docs] def GetVScrollPos(self): r""" :rtype: double :return: the current vertical scroll position in the scrollable space. """ return _PDFNetPython.PDFView_GetVScrollPos(self)
[docs] def OnScroll(self, pix_dx, pix_dy): r""" Scrolls the contents of the rendering buffer 'pix_dx' horizontally and 'pix_dy' vertically. :type pix_dx: int :param pix_dx: horizontal scroll offset, in pixels :type pix_dy: int :param pix_dy: vertical scroll offset, in pixels """ return _PDFNetPython.PDFView_OnScroll(self, pix_dx, pix_dy)
[docs] def SetHScrollPos(self, pos): r""" Sets the horizontal scroll position in scrollable space. :param the: new horizontal scroll position. The position should be in the range between 0 and GetCanvasWidth(). """ return _PDFNetPython.PDFView_SetHScrollPos(self, pos)
[docs] def SetVScrollPos(self, pos): r""" Sets the vertical scroll position in scrollable space. :param the: new vertical scroll position. The position should be in the range between 0 and GetCanvasheight(). Should you want to center to a location (px, py) expressed in a page space, you can use the following code: //focus view.SetCurrentPage(page_num); view.ConvPagePtToScreenPt(px, py, page_num); view.SetZoom((int)px, (int)py, view.GetZoom()); //center int width = view.GetBufferWidth(); int height = view.GetBufferHeight(); int dx = (int)(px - (double)width/2 + 0.5); int dy = (int)(py - (double)height/2 + 0.5); view.OnScroll(dx, dy); """ return _PDFNetPython.PDFView_SetVScrollPos(self, pos)
[docs] def OnSize(self, width, height): r""" Resize rendering buffer to new dimensions. :type width: int :param width: - The width of the target image in pixels. :type height: int :param height: - The height of the target image in pixels (the number of rows). Notes: this method is typically used only in PDFNet for C++ """ return _PDFNetPython.PDFView_OnSize(self, width, height)
[docs] def IsFinishedRendering(self, visible_region_only): r""" :type visible_region_only: boolean :param visible_region_only: - Specifies if the method refers only to currently visible content. :rtype: boolean :return: true is the rendering thread finished rendering the view, false if the rendering is still in progress. """ return _PDFNetPython.PDFView_IsFinishedRendering(self, visible_region_only)
[docs] def CancelRendering(self): r""" Cancels rendering in progress. If PDFView is not busy rendering the page, the function has no side effects. """ return _PDFNetPython.PDFView_CancelRendering(self)
[docs] def Update(self, args): r""" Overload 1: Redraws the contents of the buffer. | Overload 2: Redraws the given area in the buffer. :type update: :py:class:`Rect` :param update: The rectangle to update expressed in screen coordinates. | Overload 3: Redraws the area covered with a given annotation. :type annot: :py:class:`Annot` :param annot: The annotation to update. :type page_num: int :param page_num: The page number on which the annotation is located. | Overload 4: Redraws all instances (Widgets) of the field. :type field: :py:class:`Field` :param field: the field for which to update all occurances """ return _PDFNetPython.PDFView_Update(self, args)
[docs] def UpdatePageLayout(self): r""" Updates the page layout within the view. This function must be called after document page sequence is modified (such as when a page is being added to or removed from a document) or after changes to page dimensions (e.g. after a page is rotated or resized). """ return _PDFNetPython.PDFView_UpdatePageLayout(self)
[docs] def GetBuffer(self): r""" Returns the pointer to the internal memory buffer containing the rasterized image of the given page. The buffer size is at least 'GetBufferHeightGetBufferStride' bytes. The pixel data is stored in 8 bit per component, BGRA format. """ return _PDFNetPython.PDFView_GetBuffer(self)
[docs] def UpdateBuffer(self): r""" Update the internal memory buffer that can be returned by GetBuffer(). Since PDFView may not necessarily update the buffer until it finishes rendering the current viewing area, it is required to call UpdateBuffer() to force PDFView to write the current rasterized contents to the buffer. This is important for, say, calling GetBuffer() in a different thread to implement progressive rendering. Notes: UpdateBuffer() ensures thread safety internally. In addition, PDFView calls UpdateBuffer() internally before the user-defined finishing-rendering callback function (specified by SetRenderFinishProc) is called, if applicable. this method is typically used only in PDFNet for C++. """ return _PDFNetPython.PDFView_UpdateBuffer(self)
[docs] def GetBufferWidth(self): r""" Returns the width of the rendering buffer in pixels. Notes: this method is typically used only in PDFNet for C++ """ return _PDFNetPython.PDFView_GetBufferWidth(self)
[docs] def GetBufferHeight(self): r""" Returns the width of the rendering buffer in pixels. Notes: this method is typically used only in PDFNet for C++ """ return _PDFNetPython.PDFView_GetBufferHeight(self)
[docs] def GetBufferStride(self): r""" Returns the stride of the rendering buffer in pixels. Notes: this method is typically used only in PDFNet for C++ """ return _PDFNetPython.PDFView_GetBufferStride(self)
[docs] def HideAnnotation(self, annot): r""" Disable rendering of a particular annotation. This does not change the annotation itself, just how it is displayed in this viewer instance. :type annot: :py:class:`Annot` :param annot: The annotation object to cease drawing for. """ return _PDFNetPython.PDFView_HideAnnotation(self, annot)
[docs] def ShowAnnotation(self, annot): r""" Enable rendering of a particular annotation. Only has an effect if HideAnnotation() has previously been called on the same annot. :type annot: :py:class:`Annot` :param annot: The annotation object to resume rendering. """ return _PDFNetPython.PDFView_ShowAnnotation(self, annot)
[docs] def SetDrawAnnotations(self, render_annots): r""" Enable or disable annotation and forms rendering. By default, all annotations and form fields are rendered. :type render_annots: boolean :param render_annots: True to draw annotations, false otherwise. """ return _PDFNetPython.PDFView_SetDrawAnnotations(self, render_annots)
[docs] def SetUrlExtraction(self, enabled): r""" Enables or disables URL extraction. :type enabled: boolean :param enabled: if true URL extraction is enabled, if false URL extraction is disabled. by default URL extraction is disabled Notes: If set to enabled when the document is already opened, it may not find links on pages that were already rendered. It is suggested to set this flag before opening the document. """ return _PDFNetPython.PDFView_SetUrlExtraction(self, enabled)
[docs] def GetLinkAt(self, x, y): r""" Gets the link info at a given point, specified in client space. :type x: int :param x: the x position in client space :type y: int :param y: the y position in client space :rtype: LinkInfo :return: the LinkInfo object with the link information or null if no link is found in the queried location. Notes: To get valid links, SetUrlExtraction(boolean) must be set to true before opening the document. """ return _PDFNetPython.PDFView_GetLinkAt(self, x, y)
[docs] def SetFieldHighlightColor(self, new_field_highlight_color): r""" Set the highlight color for required fields This option only has an effect if field highlighting is turned on using `SetHighlightFields(true)`. Note that signature fields have their own highlight color, independent of this one (see `setSignatureHighlightColor`). :type new_field_highlight_color: :py:class:`ColorPt` :param new_field_highlight_color: the new highlight color, in rgba form. """ return _PDFNetPython.PDFView_SetFieldHighlightColor(self, new_field_highlight_color)
[docs] def SetHighlightFields(self, highlight_fields): r""" Enable or disable highlighting form fields. Default is disabled. :type highlight_fields: boolean :param highlight_fields: true to highlight, false otherwise. """ return _PDFNetPython.PDFView_SetHighlightFields(self, highlight_fields)
[docs] def SetRequiredFieldBorderColor(self, new_border_color): r""" Set the border color for required fields This option only has an effect if field highlighting is turned on using `SetHighlightFields(true)`. :type new_border_color: :py:class:`ColorPt` :param new_border_color: the new border color, in rgba form. """ return _PDFNetPython.PDFView_SetRequiredFieldBorderColor(self, new_border_color)
[docs] def SetSignatureHighlightColor(self, new_signature_highlight_color): r""" Set the highlight color for signature fields This option only has an effect if field highlighting is turned on using `SetHighlightFields(true)`. Note that non-signature fields have their own highlight color, independent of this one (see `setFieldHighlightColor`) :type new_signature_highlight_color: :py:class:`ColorPt` :param new_signature_highlight_color: the new signature highlight color, in rgba form. """ return _PDFNetPython.PDFView_SetSignatureHighlightColor(self, new_signature_highlight_color)
[docs] def SetAntiAliasing(self, enable_aa): r""" Enable or disable anti-aliasing. Anti-Aliasing is a technique used to improve the visual quality of images when displaying them on low resolution devices (for example, low DPI computer monitors). Anti-aliasing is enabled by default. """ return _PDFNetPython.PDFView_SetAntiAliasing(self, enable_aa)
[docs] def SetPathHinting(self, enable_hinting): r""" Enable or disable path hinting. :type enable_hinting: boolean :param enable_hinting: if true path hinting is enabled. Path hinting is used to slightly adjust paths in order to avoid or alleviate artifacts of hair line cracks between certain graphical elements. This option is turned on by default. """ return _PDFNetPython.PDFView_SetPathHinting(self, enable_hinting)
[docs] def SetThinLineAdjustment(self, pixel_grid_fit, stroke_adjust): r""" Set thin line adjustment parameters. :type pixel_grid_fit: boolean :param pixel_grid_fit: if true (horizontal/vertical) thin lines will be snapped to integer pixel positions. This helps make thin lines look sharper and clearer. This option is turned off by default and it only works if path hinting is enabled. :type stroke_adjust: boolean :param stroke_adjust: if true auto stroke adjustment is enabled. Currently, this would make lines with sub-pixel width to be one-pixel wide. This option is turned on by default. """ return _PDFNetPython.PDFView_SetThinLineAdjustment(self, pixel_grid_fit, stroke_adjust)
[docs] def SetImageSmoothing(self, smoothing_enabled=True): r""" Enable or disable image smoothing. The rasterizer allows a trade-off between rendering quality and rendering speed. This function can be used to indicate the preference between rendering speed and quality. Notes: image smoothing option has effect only if the source image has higher resolution that the output resolution of the image on the rasterized page. PDFNet automatically controls at what resolution/zoom factor, 'image smoothing' needs to take effect. :type smoothing_enabled: boolean :param smoothing_enabled: True to enable image smoothing, false otherwise. image smoothing is enabled. """ return _PDFNetPython.PDFView_SetImageSmoothing(self, smoothing_enabled)
[docs] def SetCaching(self, enabled): r""" Enables of disables caching of images, fonts, and other resources. Disabling caching can lower memory requirements at the expense of rendering speed. :type enabled: boolean :param enabled: if true caching is enabled, if false caching is disabled. by default caching is enabled """ return _PDFNetPython.PDFView_SetCaching(self, enabled)
[docs] def SetRasterizerType(self, type): r""" Sets the core graphics library used for rasterization and rendering. Using this method it is possible to quickly switch between different implementations. By default, PDFNet uses a built-in, high-quality, and platform independent rasterizer. :type type: int :param type: Rasterizer type. """ return _PDFNetPython.PDFView_SetRasterizerType(self, type)
[docs] def SetGamma(self, exp): r""" Sets the gamma factor used for anti-aliased rendering. :type exp: double :param exp: is the exponent value of gamma function. Typical values are in the range from 0.1 to 3. Gamma correction can be used to improve the quality of anti-aliased image output and can (to some extent) decrease the appearance common anti-aliasing artifacts (such as pixel width lines between polygons). Notes: Gamma correction is used only in the built-in rasterizer. """ return _PDFNetPython.PDFView_SetGamma(self, exp)
[docs] def SetOverprint(self, op): r""" Enable or disable support for overprint and overprint simulation. Overprint is a device dependent feature and the results will vary depending on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc). By default overprint is only enabled for PDF/X files. :type op: int :param op: e_op_on: always enabled; e_op_off: always disabled; e_op_pdfx_on: enabled for PDF/X files only. """ return _PDFNetPython.PDFView_SetOverprint(self, op)
[docs] def SetOCGContext(self, ctx): r""" Sets the Optional Content Group (OCG) context that should be used when viewing the document. This function can be used to change the current OCG context. Optional content (such as PDF layers) will be selectively rendered based on the states of optional content groups in the given context. :type ctx: :py:class:`Context` :param ctx: Optional Content Group (OCG) context, or NULL if the rasterizer should render all content on the page. Notes: Unlike PDFDraw.SetOCGContext() this method copies the given context. As a result, in order to modify the state of OCG groups in the current context use GetOCGContext() to obtain the currently selected content and then modify states. """ return _PDFNetPython.PDFView_SetOCGContext(self, ctx)
[docs] def GetOCGContext(self): r""" :rtype: :py:class:`Context` :return: the Optional Content Group (OCG) context associated with this PDFView, or NULL (i.e. context.IsValid()==false) if there is no OCG context associated with the view. If an OCG context associated with the view, optional content (such as PDF layers) will be selectively rendered based on the states of optional content groups in the given context. """ return _PDFNetPython.PDFView_GetOCGContext(self)
[docs] def UpdateOCGContext(self): r""" Prompts the PDFViewCtrl to update its list of optional content groups. Call this method if you modify the PDFDoc in a way that adds or removes a layer. For example, after using Stamper to create a stamp. """ return _PDFNetPython.PDFView_UpdateOCGContext(self)
[docs] def SetRenderBeginProc(self, instance): r""" Set a callback function that can be used to notify the client that PDFView is about to start rendering and modifying the contents of the rendering buffer. :param proc: A callback function that will be called just before PDFView starts rendering. :param data: Custom data to be passed as a parameter to 'proc'. Notes: this method is available only in the C++ SDK and not available in pre-packaged PDF viewing controls (.NET/Java/ActiveX). """ return _PDFNetPython.PDFView_SetRenderBeginProc(self, instance)
[docs] def SetRenderFinishProc(self, instance): r""" Set a callback function that can be used to notify the client that PDFView finished rendering and modifying the contents of the rendering buffer. :param proc: A callback function that will be called after PDFView is done with rendering. :param data: Custom data to be passed as a parameter to 'proc'. Notes: this method is available only in the C++ SDK and is not available in pre-packaged PDF viewing controls (.NET/Java/ActiveX). """ return _PDFNetPython.PDFView_SetRenderFinishProc(self, instance)
e_structural = _PDFNetPython.PDFView_e_structural e_rectangular = _PDFNetPython.PDFView_e_rectangular e_structural_algorithm_2 = _PDFNetPython.PDFView_e_structural_algorithm_2
[docs] def SetTextSelectionMode(self, tm): r""" Sets the selection mode used for text highlighting. :type tm: int :param tm: the text selection mode. """ return _PDFNetPython.PDFView_SetTextSelectionMode(self, tm)
[docs] def GetTextSelectionMode(self): r""" :rtype: int :return: the current selection mode used for text highlighting. """ return _PDFNetPython.PDFView_GetTextSelectionMode(self)
[docs] def SelectWithSnapping(self, args): r""" Overload 1: Selects text within the given region using the current text selection mode with defined snap-to-start and snap-to-end modes. :rtype: boolean :return: true if some text was selected, false otherwise. :type x1: double :param x1:, y1, x2, y2 - two points (screen coordinates, origin located at the upper-left corner of this view) defining the opposite corners of a selection rectangle. :type snap_to_start: boolean :param snap_to_start:, snap-to-end: if selected text should contain the whole word at start/end of selection points. | Overload 2: Selects texts using structural mode with defined snap-to-start and snap-to-end modes. :rtype: boolean :return: true if some texts were selected, false otherwise. :param (x1:, y1), page1 - the first selection point (in page coordinates space) on page page1 :param (x2:, y2), page2 - the second selection point (in page coordinates space) on page page2 :type snap_to_start: boolean :param snap_to_start:, snap-to-end: if selected text should contain the whole word at start/end of selection points """ return _PDFNetPython.PDFView_SelectWithSnapping(self, args)
[docs] def SelectWithSmartSnapping(self, args): r""" Overload 1: Selects text within the given region using the current text selection mode with smart snap-to-start and snap-to-end modes. :rtype: boolean :return: true if some text was selected, false otherwise. :type x1: double :param x1:, y1, x2, y2 - two points (screen coordinates, origin located at the upper-left corner of this view) defining the opposite corners of a selection rectangle. | Overload 2: Selects texts using structural mode with smart snap-to-start and snap-to-end modes. :rtype: boolean :return: true if some texts were selected, false otherwise. :param (x1:, y1), page1 - the first selection point (in page coordinates space) on page page1 :param (x2:, y2), page2 - the second selection point (in page coordinates space) on page page2 """ return _PDFNetPython.PDFView_SelectWithSmartSnapping(self, args)
[docs] def Select(self, args): r""" Overload 1: Selects text within the given region using the current text selection mode. :rtype: boolean :return: true if some text was selected, false otherwise. :type x1: double :param x1:, y1, x2, y2 - two points (screen coordinates, origin located at the upper-left corner of this view) defining the opposite corners of a selection rectangle. | Overload 2: Selects texts using structural mode. :rtype: boolean :return: true if some texts were selected, false otherwise. :param (x1:, y1), page1 - the first selection point (in page coordinates space) on page page1 :param (x2:, y2), page2 - the second selection point (in page coordinates space) on page page2 | Overload 3: Selects texts identified by Highlights. :rtype: boolean :return: true if some texts were selected, false otherwise. :type highlights: :py:class:`Highlights` :param highlights: - an instance of Highlights class. | Overload 4: Selects a region according to a Selection object :rtype: boolean :return: true if some texts were selected, false otherwise. :type select: :py:class:`Selection` :param select: - an instance of the Selection class """ return _PDFNetPython.PDFView_Select(self, args)
[docs] def CancelFindText(self): r""" Cancel the text search thread if FindText() is started in a different thread. Note that if the text search thread is currently being suspended by the render thread, it will only be canceled after it is awaken by the render thread. """ return _PDFNetPython.PDFView_CancelFindText(self)
[docs] def SelectAll(self): r"""Selects all text on the page.""" return _PDFNetPython.PDFView_SelectAll(self)
[docs] def HasSelection(self): r""" :rtype: boolean :return: return true if there is selection, false otherwise. """ return _PDFNetPython.PDFView_HasSelection(self)
[docs] def ClearSelection(self): r"""Remove any text selection.""" return _PDFNetPython.PDFView_ClearSelection(self)
[docs] def GetSelection(self, pagenum=-1): r""" :rtype: :py:class:`Selection` :return: Current text selection for a given page """ return _PDFNetPython.PDFView_GetSelection(self, pagenum)
[docs] def GetSelectionBeginPage(self): r""" :rtype: int :return: the first page number that has text selection on it. Useful when there are selections on multiple pages at the same time. """ return _PDFNetPython.PDFView_GetSelectionBeginPage(self)
[docs] def GetSelectionEndPage(self): r""" :rtype: int :return: the last page number that has text selection on it. Useful when there are selections on multiple pages at the same time. """ return _PDFNetPython.PDFView_GetSelectionEndPage(self)
[docs] def HasSelectionOnPage(self, ipage): r""" :rtype: boolean :return: returns true if given page number has any text selection on it. Useful when there are selections on multiple pages at the same time. """ return _PDFNetPython.PDFView_HasSelectionOnPage(self, ipage)
[docs] def PrepareWords(self, page_num): r""" Requests for preparing words of the given page. Note: Words are going to be prepared asynchronously :type page_num: int :param page_num: - page number """ return _PDFNetPython.PDFView_PrepareWords(self, page_num)
[docs] def WereWordsPrepared(self, page_num): r""" :rtype: boolean :return: true if words of the given page has been prepared, false otherwise :type page_num: int :param page_num: - page number """ return _PDFNetPython.PDFView_WereWordsPrepared(self, page_num)
[docs] def IsThereTextInRect(self, x1, y1, x2, y2): r""" :rtype: boolean :return: true if there is a text in the given rectangle, false otherwise and point (x2, y2) is the end selection point. The points are defined in screen space. """ return _PDFNetPython.PDFView_IsThereTextInRect(self, x1, y1, x2, y2)
[docs] def PrepareAnnotsForMouse(self, page_num, distance_threshold, minimum_line_weight): r""" Requests for preparing annotations of the given page. Note: Annotations are going to be prepared asynchronously :type page_num: int :param page_num: - page number :type distance_threshold: double :param distance_threshold: - Maximum distance from the point (x, y) to the annotation for the annot to be considered a hit. :type minimum_line_weight: double :param minimum_line_weight: - For very thin lines, it is almost impossible to hit the actual line. This specifies a minimum line thickness (in screen coordinates) for the purpose of calculating whether a point is inside the annotation or not """ return _PDFNetPython.PDFView_PrepareAnnotsForMouse(self, page_num, distance_threshold, minimum_line_weight)
[docs] def WereAnnotsForMousePrepared(self, page_num): r""" :rtype: boolean :return: true if annotations of the given page have been prepared, false otherwise :type page_num: int :param page_num: - page number """ return _PDFNetPython.PDFView_WereAnnotsForMousePrepared(self, page_num)
[docs] def GetAnnotTypeUnder(self, x, y): r""" :rtype: int :return: annotation type at the given point :type x: double :param x: - x coordinate of the input point :type y: double :param y: - y coordinate in the input point """ return _PDFNetPython.PDFView_GetAnnotTypeUnder(self, x, y)
[docs] def SetPageBorderVisibility(self, border_visible): r""" Enables or disables drawing of a thin border around each page. :type border_visible: boolean :param border_visible: - if true, the border will be visible. """ return _PDFNetPython.PDFView_SetPageBorderVisibility(self, border_visible)
[docs] def SetPageTransparencyGrid(self, trans_grid_visible): r""" Enables or disables the transparency grid (check board pattern) to reflect page transparency. :type trans_grid_visible: boolean :param trans_grid_visible: - if true, the grid is turned on. """ return _PDFNetPython.PDFView_SetPageTransparencyGrid(self, trans_grid_visible)
[docs] def SetDefaultPageColor(self, r, g, b): r""" Sets the default 'paper' color used to draw background of each page. :type r: int :param r:, g, b - RGB color specifying the default page color. """ return _PDFNetPython.PDFView_SetDefaultPageColor(self, r, g, b)
[docs] def SetBackgroundColor(self, r, g, b, a=255): r""" Sets the default background color used to paint the area surrounding each page. :type r: int :param r:, g, b - RGB color specifying the default background color. :type a: int :param a: - The alpha value of the background color. Default value is 255. """ return _PDFNetPython.PDFView_SetBackgroundColor(self, r, g, b, a)
[docs] def SetHorizontalAlign(self, align): r""" Sets the horizontal alignment used for rendering pages within the view. :type align: int :param align: an integer specifying the horizontal alignment. Depending of whether align is positive, negative, or zero - pages will be right, left or center aligned: align<0 -> pages are left aligned. align==0 -> pages are centered. align>0 -> pages are right aligned. """ return _PDFNetPython.PDFView_SetHorizontalAlign(self, align)
[docs] def SetVerticalAlign(self, align): r""" Sets the vertical alignment used for rendering pages within the view. :type align: int :param align: an integer specifying the vertical alignment. Depending of whether align is positive, negative, or zero - pages will be bottom, top or center aligned: align<0 -> pages are top aligned. align==0 -> pages are centered. align>0 -> pages are bottom aligned. """ return _PDFNetPython.PDFView_SetVerticalAlign(self, align)
[docs] def SetPageSpacing(self, horiz_col_space, vert_col_space, horiz_pad, vert_pad): r""" Sets the vertical and horizontal padding and column spacing between adjacent pages in the view. :type horiz_col_space: int :param horiz_col_space: horizontal column spacing (represented in pixels) between adjacent pages in the view. Default is 10. :type vert_col_space: int :param vert_col_space: vertical column spacing (represented in pixels) between adjacent pages in the view. Default is 10. :type horiz_pad: int :param horiz_pad: horizontal padding (represented in pixels) on the left and right side of the view. Default is 10. :type vert_pad: int :param vert_pad: vertical padding (represented in pixels) on the top and bottom side of the view. Default is 10. """ return _PDFNetPython.PDFView_SetPageSpacing(self, horiz_col_space, vert_col_space, horiz_pad, vert_pad)
[docs] @staticmethod def SetViewerCache(document, max_cache_size, on_disk): r""" Sets the cache parameters of the page cache on disk (which caches content streams and mipmapped images) for this specific document. These parameters will override the default cache parameters. Note that if this function is called after the document has been rasterized, it has no effect. :type document: :py:class:`SDFDoc` :param document: - The document whose settings will be modified. :type max_cache_size: int :param max_cache_size: - The maximum size, in bytes, of the entire document's page cache. Set to zero to disable the viewer cache. :type on_disk: boolean :param on_disk: - If set to 'true', cache will be stored on the local filesystem. If set to 'false', cache will be stored in heap memory. Desktop: max_cache_size = 512 MB, on_disk = true | Mobile: max_cache_size = 100 MB, on_disk = false """ return _PDFNetPython.PDFView_SetViewerCache(document, max_cache_size, on_disk)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.PDFView_Destroy(self)
[docs] def SetDevicePixelDensity(self, dpi, scale_factor): r"""Set device pixel density""" return _PDFNetPython.PDFView_SetDevicePixelDensity(self, dpi, scale_factor)
[docs] def GetScreenRectForAnnot(self, annot, page_num=-1): r""" Gets the annotation bounding box in screen points :type annot: :py:class:`Annot` :param annot: target annotation :type page_num: int :param page_num: the page number that the annotation is on S :rtype: :py:class:`Rect` :return: the annotation bounding box in screen points """ return _PDFNetPython.PDFView_GetScreenRectForAnnot(self, annot, page_num)
[docs] def GetAnnotationAt(self, x, y, distanceThreshold, minimumLineWeight): r""" Gets the annotation at the (x, y) position expressed in screen coordinates :type x: int :param x: x coordinate of the screen point :type y: int :param y: y coordinate of the screen point :type distanceThreshold: double :param distanceThreshold: Maximum distance from the point (x, y) to the annotation for the annot to be considered a hit. :type minimumLineWeight: double :param minimumLineWeight: For very thin lines, it is almost impossible to hit the actual line. This specifies a minimum line thickness (in screen coordinates) for the purpose of calculating whether a point is inside the annotation or not. :rtype: :py:class:`Annot` :return: the annotation at (x, y). If there is no annotation at (x, y), the returned annotation's IsValid method will return false. """ return _PDFNetPython.PDFView_GetAnnotationAt(self, x, y, distanceThreshold, minimumLineWeight)
e_fit_page = _PDFNetPython.PDFView_e_fit_page e_fit_width = _PDFNetPython.PDFView_e_fit_width e_fit_height = _PDFNetPython.PDFView_e_fit_height e_zoom = _PDFNetPython.PDFView_e_zoom PVM_SIZE = _PDFNetPython.PDFView_PVM_SIZE
[docs] def SetPageViewMode(self, mode): r""" Sets the page viewing mode :type mode: int :param mode: - the new page viewing mode. The default PageView mode is e_fit_width. """ return _PDFNetPython.PDFView_SetPageViewMode(self, mode)
[docs] def GetPageViewMode(self): r""" :rtype: int :return: the current page viewing mode """ return _PDFNetPython.PDFView_GetPageViewMode(self)
[docs] def RefreshAndUpdate(self, view_change): r""" Helper function that will refresh annotation and/or field appearances if needed, and then render modified page areas, all based on the contents of the view_change parameter. :type view_change: :py:class:`ViewChangeCollection` :param view_change: contains all the updated fields and rectangles. """ return _PDFNetPython.PDFView_RefreshAndUpdate(self, view_change)
[docs] def SetPageRefViewMode(self, mode): r""" Sets the reference page view mode. In a non-continous page presentation mode, the reference page view mode is used to determine the page view mode upon a page change event. For example, if the reference page view mode is set to e_fit_width, the new page coming in will be displayed with width-fit mode. :type mode: int :param mode: The reference page view mode to set. Valid values are e_fit_page, e_fit_width, and e_fit_height. """ return _PDFNetPython.PDFView_SetPageRefViewMode(self, mode)
[docs] def GetPageRefViewMode(self): r""" Gets the reference page view mode. See more details about reference page view mode in {#setPageRefViewMode(int)}. """ return _PDFNetPython.PDFView_GetPageRefViewMode(self)
[docs] def SetupThumbnails(self, use_embedded, generate_at_runtime, use_disk_cache, thumb_max_side_length, max_abs_cache_size, max_perc_cache_size): r""" Specify the different thumbnail settings for the viewer. It is recommended that this not be called after SetDoc in order to avoid clearing cached thumbnails. Calling this method with different parameters will also clear the persistent disk cache if it is in use. :type use_embedded: boolean :param use_embedded: Enables or disables using thumbnails embedded in the PDF document as a preview of the rendered page. (Currently ignored - future versions may take advantage of embedded thumbnails) :type generate_at_runtime: boolean :param generate_at_runtime: Enables or disables generating thumbnails at runtime. :type use_disk_cache: boolean :param use_disk_cache: Enables or disables caching thumbnails on disk. If possible thumbnails are cached in a persistent manner. :type thumb_max_side_length: int :param thumb_max_side_length: The maximum size, in pixels, of a dimension of generated thumbnails. :type max_abs_cache_size: int :param max_abs_cache_size: The absolute maximum size on disk, in bytes, for the temporary thumbnail cache. :type max_perc_cache_size: double :param max_perc_cache_size: The maximum percentage of free disk space, in the range 0 - 1.0, that the cache can take up. """ return _PDFNetPython.PDFView_SetupThumbnails(self, use_embedded, generate_at_runtime, use_disk_cache, thumb_max_side_length, max_abs_cache_size, max_perc_cache_size)
[docs] def ClearThumbCache(self): r"""Remove all thumbnails from the persistent disk cache.""" return _PDFNetPython.PDFView_ClearThumbCache(self)
[docs] def GetThumbAsync(self, page_num, instance): r""" Retrieves the specified thumbnail from the persistent thumbnail cache on disk, then calling proc on the resulting thumbnail. :type page_num: int :param page_num: The page number of the thumbnail. :param proc: A callback function that will be called after the thumbnail is retrieved, or if that retrieval fails. :param data: Custom data to be passed as a parameter to 'proc'. """ return _PDFNetPython.PDFView_GetThumbAsync(self, page_num, instance)
[docs] def GetThumbInCacheSize(self, page_num): r""" Gets the data size of a cached thumbnail. :type page_num: int :param page_num: The page number of the thumbnail. :rtype: int :return: if the thumbnail is available returns the size of the thumbnail in bytes otherwise returns 0 """ return _PDFNetPython.PDFView_GetThumbInCacheSize(self, page_num)
[docs] def GetThumbInCache(self, page_num, buf, out_width, out_height): r""" Retrieves the specified thumbnail from the persistent thumbnail cache on disk if it is available. :type page_num: int :param page_num: The page number of the thumbnail. :type buf: UChar :param buf: the buffer in which to store thumbnail data. This buffer should have space for GetThumbInCacheSize bytes. :type out_width: int :param out_width: the width of the thumbnail :type out_height: int :param out_height: the height of the thumbnail :rtype: boolean :return: true if the thumbnail is found in the cache and false otherwise. """ return _PDFNetPython.PDFView_GetThumbInCache(self, page_num, buf, out_width, out_height)
[docs] def CancelAllThumbRequests(self): return _PDFNetPython.PDFView_CancelAllThumbRequests(self)
[docs] def SetRequestRenderInWorkerThreadProc(self, instance): r""" Sets a callback for issuing a render request on the UI thread. The callback will be called from a secondary thread. The called code is responsible for dispatching an event to the UI thread using the relevant mechanism. :param proc: The callback. :param data: Custom data to be passed as a parameter to 'proc'. """ return _PDFNetPython.PDFView_SetRequestRenderInWorkerThreadProc(self, instance)
[docs] def SetFindTextHandler(self, instance): r""" Sets the FindText handling function to be called once FindTextAsync is done, whether it was interrupted, canceled, or completed. :type instance: :py:class:`Callback` :param instance: A pointer to the Callback object """ return _PDFNetPython.PDFView_SetFindTextHandler(self, instance)
[docs] def FindTextAsync(self, search_str, match_case, match_whole_word, search_up, reg_exp): r""" Searches for the provided search string in the documents in a secondary thread, and calls FindTextHandler with the resulting selection. :type search_str: string :param search_str: The string to search for in the document :type match_case: boolean :param match_case: Set to true for case-sensitive search :type match_whole_word: boolean :param match_whole_word: Set to true to match whole words only :type search_up: boolean :param search_up: Set to true to search up through the document :type reg_exp: boolean :param reg_exp: Set to true to interpret search_str as a regular expression """ return _PDFNetPython.PDFView_FindTextAsync(self, search_str, match_case, match_whole_word, search_up, reg_exp)
[docs] def GetAnnotationsOnPage(self, page_num): r""" Returns a vector of all of the annotations on the given page. :type page_num: int :param page_num: The page number for which to retrieve annotations. :rtype: std::vector< PDF::Annot,std::allocator< PDF::Annot > > :return: A vector of all of the annotations on the given page. """ return _PDFNetPython.PDFView_GetAnnotationsOnPage(self, page_num)
[docs] def GetAnnotationListAt(self, x1, y1, x2, y2): r""" Returns a vector of annotations under the line (x1, y1, x2, y2) expressed in screen coordinates. Does not include form field annotations. :type x1: int :param x1: The x-coordinate of the first point of the line. :type y1: int :param y1: The y-coordinate of the first point of the line. :type x2: int :param x2: The x-coordinate of the second point of the line. :type y2: int :param y2: The y-coordinate of the second point of the line. :rtype: std::vector< PDF::Annot,std::allocator< PDF::Annot > > :return: A vector of annotations under the line (x1, y1, x2, y2) expressed in screen coordinates. """ return _PDFNetPython.PDFView_GetAnnotationListAt(self, x1, y1, x2, y2)
[docs] def EnableUndoRedo(self): return _PDFNetPython.PDFView_EnableUndoRedo(self)
[docs] def Undo(self): return _PDFNetPython.PDFView_Undo(self)
[docs] def Redo(self): return _PDFNetPython.PDFView_Redo(self)
[docs] def TakeSnapshot(self, meta_info): return _PDFNetPython.PDFView_TakeSnapshot(self, meta_info)
[docs] def GetNextUndoInfo(self): return _PDFNetPython.PDFView_GetNextUndoInfo(self)
[docs] def GetNextRedoInfo(self): return _PDFNetPython.PDFView_GetNextRedoInfo(self)
[docs] def CanUndo(self): return _PDFNetPython.PDFView_CanUndo(self)
[docs] def CanRedo(self): return _PDFNetPython.PDFView_CanRedo(self)
[docs] def RevertAllChanges(self): return _PDFNetPython.PDFView_RevertAllChanges(self)
[docs] def GetExternalAnnotManager(self, args): return _PDFNetPython.PDFView_GetExternalAnnotManager(self, args)
# Register PDFView in _PDFNetPython: _PDFNetPython.PDFView_swigregister(PDFView)
[docs] def PDFView_SetViewerCache(document, max_cache_size, on_disk): r""" Sets the cache parameters of the page cache on disk (which caches content streams and mipmapped images) for this specific document. These parameters will override the default cache parameters. Note that if this function is called after the document has been rasterized, it has no effect. :type document: :py:class:`SDFDoc` :param document: - The document whose settings will be modified. :type max_cache_size: int :param max_cache_size: - The maximum size, in bytes, of the entire document's page cache. Set to zero to disable the viewer cache. :type on_disk: boolean :param on_disk: - If set to 'true', cache will be stored on the local filesystem. If set to 'false', cache will be stored in heap memory. Desktop: max_cache_size = 512 MB, on_disk = true | Mobile: max_cache_size = 100 MB, on_disk = false """ return _PDFNetPython.PDFView_SetViewerCache(document, max_cache_size, on_disk)
[docs] class Print(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def StartPrintJob(args): r""" Overload 1: (Windows Only) Print the PDFDoc to a printer. Depending on the OS and installed libraries, the PDFDoc will be sent using the GDI or the XPS print path. This function will block until the print job is done at the OS level. Notes: If the printer is grayscale, only grayscale data will be sent. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to be printed :type in_printerName: string :param in_printerName: the name of the printer to print to :type in_jobName: string :param in_jobName: the name of the job for print queue monitoring, can be empty. :type in_outputFileName: string :param in_outputFileName: if not empty, the name of the output file to save the printout into. This could be a PostScript, PCL, XPS or other file. :type in_pagesToPrint: :py:class:`PageSet` :param in_pagesToPrint: a PageSet specifying which pages to print. :param in_printMode: options for the printer, see the PrinterMode class below. :type in_cancel: boolean :param in_cancel: set this to true to cancel the print job. :type in_context: :py:class:`Context` :param in_context: (Optional) Optional Content Group setting, for example from PDFViewCtrl::GetOCGContext. :rtype: void :return: void. Throws a trn::Common::Exception on failure. | Overload 2: (Windows Only) Print the PDFDoc to a printer. Depending on the OS and installed libraries, the PDFDoc will be sent using the GDI or the XPS print path. This function will block until the print job is done at the OS level. Notes: Same functionality as other StartPrintJob but with char types for printer name, job name, output file name If the printer is grayscale, only grayscale data will be sent. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to be printed :type in_printerName: string :param in_printerName: the name of the printer to print to :type in_jobName: string :param in_jobName: the name of the job for print queue monitoring, can be empty. :type in_outputFileName: string :param in_outputFileName: if not empty, the name of the output file to save the printout into. This could be a PostScript, PCL, XPS or other file. :type in_pagesToPrint: :py:class:`PageSet` :param in_pagesToPrint: a PageSet specifying which pages to print. :param in_printMode: options for the printer, see the PrinterMode class below. :type in_cancel: boolean :param in_cancel: set this to true to cancel the print job. :type in_context: :py:class:`Context` :param in_context: (Optional) Optional Content Group setting, for example from PDFViewCtrl::GetOCGContext. :rtype: void :return: void. Throws a trn::Common::Exception on failure. | Overload 3: (Windows Only) Print the PDFDoc to a printer. Depending on the OS and installed libraries, the PDFDoc will be sent using the GDI or the XPS print path. This function will block until the print job is done at the OS level. Notes: Same functionality as other StartPrintJob but with char types for printer name, job name, output file name If the printer is grayscale, only grayscale data will be sent. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to be printed :type in_printerName: string :param in_printerName: the name of the printer to print to :type in_jobName: string :param in_jobName: the name of the job for print queue monitoring, can be empty. :type in_outputFileName: string :param in_outputFileName: if not empty, the name of the output file to save the printout into. This could be a PostScript, PCL, XPS or other file. :type in_pagesToPrint: :py:class:`PageSet` :param in_pagesToPrint: a PageSet specifying which pages to print. :param in_printMode: options for the printer, see the PrinterMode class below. :type in_cancel: boolean :param in_cancel: set this to true to cancel the print job. :param in_context: (Optional) Optional Content Group setting, for example from PDFViewCtrl::GetOCGContext. :rtype: void :return: void. Throws a trn::Common::Exception on failure. | Overload 4: (Windows Only) Print the PDFDoc to a printer. Depending on the OS and installed libraries, the PDFDoc will be sent using the GDI or the XPS print path. This function will block until the print job is done at the OS level. Notes: Same functionality as other StartPrintJob but with char types for printer name, job name, output file name If the printer is grayscale, only grayscale data will be sent. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to be printed :type in_printerName: string :param in_printerName: the name of the printer to print to :type in_jobName: string :param in_jobName: the name of the job for print queue monitoring, can be empty. :type in_outputFileName: string :param in_outputFileName: if not empty, the name of the output file to save the printout into. This could be a PostScript, PCL, XPS or other file. :type in_pagesToPrint: :py:class:`PageSet` :param in_pagesToPrint: a PageSet specifying which pages to print. :param in_printMode: options for the printer, see the PrinterMode class below. :param in_cancel: set this to true to cancel the print job. :param in_context: (Optional) Optional Content Group setting, for example from PDFViewCtrl::GetOCGContext. :rtype: void :return: void. Throws a trn::Common::Exception on failure. | Overload 5: (Windows Only) Print the PDFDoc to a printer. Depending on the OS and installed libraries, the PDFDoc will be sent using the GDI or the XPS print path. This function will block until the print job is done at the OS level. Notes: Same functionality as other StartPrintJob but with char types for printer name, job name, output file name If the printer is grayscale, only grayscale data will be sent. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to be printed :type in_printerName: string :param in_printerName: the name of the printer to print to :type in_jobName: string :param in_jobName: the name of the job for print queue monitoring, can be empty. :type in_outputFileName: string :param in_outputFileName: if not empty, the name of the output file to save the printout into. This could be a PostScript, PCL, XPS or other file. :type in_pagesToPrint: :py:class:`PageSet` :param in_pagesToPrint: a PageSet specifying which pages to print. :param in_printMode: options for the printer, see the PrinterMode class below. :param in_cancel: set this to true to cancel the print job. :param in_context: (Optional) Optional Content Group setting, for example from PDFViewCtrl::GetOCGContext. :rtype: void :return: void. Throws a trn::Common::Exception on failure. | Overload 6: (Windows Only) Print the PDFDoc to a printer. Depending on the OS and installed libraries, the PDFDoc will be sent using the GDI or the XPS print path. This function will block until the print job is done at the OS level. Notes: Same functionality as other StartPrintJob but with char types for printer name, job name, output file name If the printer is grayscale, only grayscale data will be sent. :type in_pdfdoc: :py:class:`PDFDoc` :param in_pdfdoc: the PDFDoc to be printed :type in_printerName: string :param in_printerName: the name of the printer to print to :type in_jobName: string :param in_jobName: the name of the job for print queue monitoring, can be empty. :type in_outputFileName: string :param in_outputFileName: if not empty, the name of the output file to save the printout into. This could be a PostScript, PCL, XPS or other file. :param in_pagesToPrint: a PageSet specifying which pages to print. :param in_printMode: options for the printer, see the PrinterMode class below. :param in_cancel: set this to true to cancel the print job. :param in_context: (Optional) Optional Content Group setting, for example from PDFViewCtrl::GetOCGContext. :rtype: void :return: void. Throws a trn::Common::Exception on failure. """ return _PDFNetPython.Print_StartPrintJob(args)
def __init__(self): _PDFNetPython.Print_swiginit(self, _PDFNetPython.new_Print()) __swig_destroy__ = _PDFNetPython.delete_Print
# Register Print in _PDFNetPython: _PDFNetPython.Print_swigregister(Print)
[docs] class PrinterMode(object): r"""PrinterMode is a utility class used to represent options for printing.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_custom = _PDFNetPython.PrinterMode_e_custom e_letter = _PDFNetPython.PrinterMode_e_letter e_letter_small = _PDFNetPython.PrinterMode_e_letter_small e_tabloid = _PDFNetPython.PrinterMode_e_tabloid e_ledger = _PDFNetPython.PrinterMode_e_ledger e_legal = _PDFNetPython.PrinterMode_e_legal e_statement = _PDFNetPython.PrinterMode_e_statement e_executive = _PDFNetPython.PrinterMode_e_executive e_a3 = _PDFNetPython.PrinterMode_e_a3 e_a4 = _PDFNetPython.PrinterMode_e_a4 e_a4_small = _PDFNetPython.PrinterMode_e_a4_small e_a5 = _PDFNetPython.PrinterMode_e_a5 e_b4_jis = _PDFNetPython.PrinterMode_e_b4_jis e_b5_jis = _PDFNetPython.PrinterMode_e_b5_jis e_folio = _PDFNetPython.PrinterMode_e_folio e_quarto = _PDFNetPython.PrinterMode_e_quarto e_10x14 = _PDFNetPython.PrinterMode_e_10x14 e_11x17 = _PDFNetPython.PrinterMode_e_11x17 e_note = _PDFNetPython.PrinterMode_e_note e_envelope_9 = _PDFNetPython.PrinterMode_e_envelope_9 e_envelope_10 = _PDFNetPython.PrinterMode_e_envelope_10 e_envelope_11 = _PDFNetPython.PrinterMode_e_envelope_11 e_envelope_12 = _PDFNetPython.PrinterMode_e_envelope_12 e_envelope_14 = _PDFNetPython.PrinterMode_e_envelope_14 e_c_size_sheet = _PDFNetPython.PrinterMode_e_c_size_sheet e_d_size_sheet = _PDFNetPython.PrinterMode_e_d_size_sheet e_e_size_sheet = _PDFNetPython.PrinterMode_e_e_size_sheet e_envelope_dl = _PDFNetPython.PrinterMode_e_envelope_dl e_envelope_c5 = _PDFNetPython.PrinterMode_e_envelope_c5 e_envelope_c3 = _PDFNetPython.PrinterMode_e_envelope_c3 e_envelope_c4 = _PDFNetPython.PrinterMode_e_envelope_c4 e_envelope_c6 = _PDFNetPython.PrinterMode_e_envelope_c6 e_envelope_c65 = _PDFNetPython.PrinterMode_e_envelope_c65 e_envelope_b4 = _PDFNetPython.PrinterMode_e_envelope_b4 e_envelope_b5 = _PDFNetPython.PrinterMode_e_envelope_b5 e_envelope_b6 = _PDFNetPython.PrinterMode_e_envelope_b6 e_envelope_italy = _PDFNetPython.PrinterMode_e_envelope_italy e_envelope_monarch = _PDFNetPython.PrinterMode_e_envelope_monarch e_6_3_quarters_envelope = _PDFNetPython.PrinterMode_e_6_3_quarters_envelope e_us_std_fanfold = _PDFNetPython.PrinterMode_e_us_std_fanfold e_german_std_fanfold = _PDFNetPython.PrinterMode_e_german_std_fanfold e_german_legal_fanfold = _PDFNetPython.PrinterMode_e_german_legal_fanfold e_b4_iso = _PDFNetPython.PrinterMode_e_b4_iso e_japanese_postcard = _PDFNetPython.PrinterMode_e_japanese_postcard e_9x11 = _PDFNetPython.PrinterMode_e_9x11 e_10x11 = _PDFNetPython.PrinterMode_e_10x11 e_15x11 = _PDFNetPython.PrinterMode_e_15x11 e_envelope_invite = _PDFNetPython.PrinterMode_e_envelope_invite e_reserved_48 = _PDFNetPython.PrinterMode_e_reserved_48 e_reserved_49 = _PDFNetPython.PrinterMode_e_reserved_49 e_letter_extra = _PDFNetPython.PrinterMode_e_letter_extra e_legal_extra = _PDFNetPython.PrinterMode_e_legal_extra e_tabloid_extra = _PDFNetPython.PrinterMode_e_tabloid_extra e_a4_extra = _PDFNetPython.PrinterMode_e_a4_extra e_letter_transverse = _PDFNetPython.PrinterMode_e_letter_transverse e_a4_transverse = _PDFNetPython.PrinterMode_e_a4_transverse e_letter_extra_transverse = _PDFNetPython.PrinterMode_e_letter_extra_transverse e_supera_supera_a4 = _PDFNetPython.PrinterMode_e_supera_supera_a4 e_Superb_Superb_a3 = _PDFNetPython.PrinterMode_e_Superb_Superb_a3 e_letter_plus = _PDFNetPython.PrinterMode_e_letter_plus e_a4_plus = _PDFNetPython.PrinterMode_e_a4_plus e_a5_transverse = _PDFNetPython.PrinterMode_e_a5_transverse e_b5_jis_transverse = _PDFNetPython.PrinterMode_e_b5_jis_transverse e_a3_extra = _PDFNetPython.PrinterMode_e_a3_extra e_a5_extra = _PDFNetPython.PrinterMode_e_a5_extra e_b5_iso_extra = _PDFNetPython.PrinterMode_e_b5_iso_extra e_a2 = _PDFNetPython.PrinterMode_e_a2 e_a3_transverse = _PDFNetPython.PrinterMode_e_a3_transverse e_a3_extra_transverse = _PDFNetPython.PrinterMode_e_a3_extra_transverse e_japanese_double_postcard = _PDFNetPython.PrinterMode_e_japanese_double_postcard e_a6 = _PDFNetPython.PrinterMode_e_a6 e_japanese_envelope_kaku_2 = _PDFNetPython.PrinterMode_e_japanese_envelope_kaku_2 e_japanese_envelope_kaku_3 = _PDFNetPython.PrinterMode_e_japanese_envelope_kaku_3 e_japanese_envelope_chou_3 = _PDFNetPython.PrinterMode_e_japanese_envelope_chou_3 e_japanese_envelope_chou_4 = _PDFNetPython.PrinterMode_e_japanese_envelope_chou_4 e_letter_rotated = _PDFNetPython.PrinterMode_e_letter_rotated e_a3_rotated = _PDFNetPython.PrinterMode_e_a3_rotated e_a4_rotated = _PDFNetPython.PrinterMode_e_a4_rotated e_a5_rotated = _PDFNetPython.PrinterMode_e_a5_rotated e_b4_jis_rotated = _PDFNetPython.PrinterMode_e_b4_jis_rotated e_b5_jis_rotated = _PDFNetPython.PrinterMode_e_b5_jis_rotated e_japanese_postcard_rotated = _PDFNetPython.PrinterMode_e_japanese_postcard_rotated e_double_japanese_postcard_rotated = _PDFNetPython.PrinterMode_e_double_japanese_postcard_rotated e_a6_rotated = _PDFNetPython.PrinterMode_e_a6_rotated e_japanese_envelope_kaku_2_rotated = _PDFNetPython.PrinterMode_e_japanese_envelope_kaku_2_rotated e_japanese_envelope_kaku_3_rotated = _PDFNetPython.PrinterMode_e_japanese_envelope_kaku_3_rotated e_japanese_envelope_chou_3_rotated = _PDFNetPython.PrinterMode_e_japanese_envelope_chou_3_rotated e_japanese_envelope_chou_4_rotated = _PDFNetPython.PrinterMode_e_japanese_envelope_chou_4_rotated e_b6_jis = _PDFNetPython.PrinterMode_e_b6_jis e_b6_jis_rotated = _PDFNetPython.PrinterMode_e_b6_jis_rotated e_12x11 = _PDFNetPython.PrinterMode_e_12x11 e_japanese_envelope_you_4 = _PDFNetPython.PrinterMode_e_japanese_envelope_you_4 e_japanese_envelope_you_4_rotated = _PDFNetPython.PrinterMode_e_japanese_envelope_you_4_rotated e_prc_16k = _PDFNetPython.PrinterMode_e_prc_16k e_prc_32k = _PDFNetPython.PrinterMode_e_prc_32k e_prc_32k_big = _PDFNetPython.PrinterMode_e_prc_32k_big e_prc_envelop_1 = _PDFNetPython.PrinterMode_e_prc_envelop_1 e_prc_envelop_2 = _PDFNetPython.PrinterMode_e_prc_envelop_2 e_prc_envelop_3 = _PDFNetPython.PrinterMode_e_prc_envelop_3 e_prc_envelop_4 = _PDFNetPython.PrinterMode_e_prc_envelop_4 e_prc_envelop_5 = _PDFNetPython.PrinterMode_e_prc_envelop_5 e_prc_envelop_6 = _PDFNetPython.PrinterMode_e_prc_envelop_6 e_prc_envelop_7 = _PDFNetPython.PrinterMode_e_prc_envelop_7 e_prc_envelop_8 = _PDFNetPython.PrinterMode_e_prc_envelop_8 e_prc_envelop_9 = _PDFNetPython.PrinterMode_e_prc_envelop_9 e_prc_envelop_10 = _PDFNetPython.PrinterMode_e_prc_envelop_10 e_prc_16k_rotated = _PDFNetPython.PrinterMode_e_prc_16k_rotated e_prc_32k_rotated = _PDFNetPython.PrinterMode_e_prc_32k_rotated e_prc_32k_big__rotated = _PDFNetPython.PrinterMode_e_prc_32k_big__rotated e_prc_envelop_1_rotated = _PDFNetPython.PrinterMode_e_prc_envelop_1_rotated e_prc_envelop_2_rotated = _PDFNetPython.PrinterMode_e_prc_envelop_2_rotated e_prc_envelop_3_rotated = _PDFNetPython.PrinterMode_e_prc_envelop_3_rotated e_prc_envelop_4_rotated = _PDFNetPython.PrinterMode_e_prc_envelop_4_rotated e_prc_envelop_5_rotated = _PDFNetPython.PrinterMode_e_prc_envelop_5_rotated e_prc_envelop_6_rotated = _PDFNetPython.PrinterMode_e_prc_envelop_6_rotated e_prc_envelop_7_rotated = _PDFNetPython.PrinterMode_e_prc_envelop_7_rotated e_prc_envelop_8_rotated = _PDFNetPython.PrinterMode_e_prc_envelop_8_rotated e_prc_envelop_9_rotated = _PDFNetPython.PrinterMode_e_prc_envelop_9_rotated e_prc_envelop_10_rotated = _PDFNetPython.PrinterMode_e_prc_envelop_10_rotated e_Duplex_Auto = _PDFNetPython.PrinterMode_e_Duplex_Auto r""" use the current printer setting""" e_Duplex_None = _PDFNetPython.PrinterMode_e_Duplex_None r""" single-sided printing""" e_Duplex_LongSide = _PDFNetPython.PrinterMode_e_Duplex_LongSide r""" flip the paper along the long side""" e_Duplex_ShortSide = _PDFNetPython.PrinterMode_e_Duplex_ShortSide r""" flip the paper along the short side""" e_OutputQuality_Draft = _PDFNetPython.PrinterMode_e_OutputQuality_Draft r""" printer draft mode""" e_OutputQuality_Low = _PDFNetPython.PrinterMode_e_OutputQuality_Low r""" printer low quality mode""" e_OutputQuality_Medium = _PDFNetPython.PrinterMode_e_OutputQuality_Medium r""" printer medium quality mode""" e_OutputQuality_High = _PDFNetPython.PrinterMode_e_OutputQuality_High r""" printer high quality mode""" e_OutputColor_Color = _PDFNetPython.PrinterMode_e_OutputColor_Color r""" 24bpp""" e_OutputColor_Grayscale = _PDFNetPython.PrinterMode_e_OutputColor_Grayscale r""" 8bpp""" e_OutputColor_Monochrome = _PDFNetPython.PrinterMode_e_OutputColor_Monochrome r""" single color (1bpp)""" e_Orientation_Portrait = _PDFNetPython.PrinterMode_e_Orientation_Portrait r""" taller than wide""" e_Orientation_Landscape = _PDFNetPython.PrinterMode_e_Orientation_Landscape r""" wider than tall""" e_ScaleType_None = _PDFNetPython.PrinterMode_e_ScaleType_None r""" no scaling""" e_ScaleType_FitToOutputPage = _PDFNetPython.PrinterMode_e_ScaleType_FitToOutputPage r""" fit to the output page""" e_ScaleType_ReduceToOutputPage = _PDFNetPython.PrinterMode_e_ScaleType_ReduceToOutputPage r""" shrink to fit the output page""" e_NUp_1_1 = _PDFNetPython.PrinterMode_e_NUp_1_1 r""" 1 document page to 1 output page""" e_NUp_2_1 = _PDFNetPython.PrinterMode_e_NUp_2_1 r""" 2 document pages to 1 output page""" e_NUp_2_2 = _PDFNetPython.PrinterMode_e_NUp_2_2 r""" 2 by 2 document pages to 1 output page""" e_NUp_3_2 = _PDFNetPython.PrinterMode_e_NUp_3_2 r""" 3 by 2 document pages to 1 output page""" e_NUp_3_3 = _PDFNetPython.PrinterMode_e_NUp_3_3 r""" 3 by 3 document pages to 1 output page""" e_NUp_4_4 = _PDFNetPython.PrinterMode_e_NUp_4_4 r""" 4 by 4 document pages to 1 output page""" e_PageOrder_LeftToRightThenTopToBottom = _PDFNetPython.PrinterMode_e_PageOrder_LeftToRightThenTopToBottom e_PageOrder_RightToLeftThenTopToBottom = _PDFNetPython.PrinterMode_e_PageOrder_RightToLeftThenTopToBottom e_PageOrder_TopToBottomThenLeftToRight = _PDFNetPython.PrinterMode_e_PageOrder_TopToBottomThenLeftToRight e_PageOrder_BottomToTopThenLeftToRight = _PDFNetPython.PrinterMode_e_PageOrder_BottomToTopThenLeftToRight e_PrintContent_DocumentOnly = _PDFNetPython.PrinterMode_e_PrintContent_DocumentOnly e_PrintContent_DocumentAndAnnotations = _PDFNetPython.PrinterMode_e_PrintContent_DocumentAndAnnotations e_PrintContent_DocumentAnnotationsAndComments = _PDFNetPython.PrinterMode_e_PrintContent_DocumentAnnotationsAndComments def __init__(self): _PDFNetPython.PrinterMode_swiginit(self, _PDFNetPython.new_PrinterMode()) __swig_destroy__ = _PDFNetPython.delete_PrinterMode
[docs] def SetAutoCenter(self, autoCenter): r""" Set automatic centering of document pages onto the output pages :type autoCenter: boolean :param autoCenter: if true will center document pages onto the output pages. Default is true. """ return _PDFNetPython.PrinterMode_SetAutoCenter(self, autoCenter)
[docs] def SetAutoRotate(self, autoRotate): r""" Set automatic rotation of document pages to best fit the output pages :type autoRotate: boolean :param autoRotate: if true will rotate document pages onto the output pages. Default is true. """ return _PDFNetPython.PrinterMode_SetAutoRotate(self, autoRotate)
[docs] def SetCollation(self, collation): r""" Set the collation of the printing, useful for multiple copies :type collation: boolean :param collation: if true, pages of copies will be printed 1, 2, 3. if false, then pages of copies will be printed 1, 1, 1, ..., 2, 2, 2, ... Default is true. """ return _PDFNetPython.PrinterMode_SetCollation(self, collation)
[docs] def SetCopyCount(self, copyCount): r""" Set the number of copies to be printed :type copyCount: int :param copyCount: the number of copies to be printed, must be greater than zero. Default is 1. """ return _PDFNetPython.PrinterMode_SetCopyCount(self, copyCount)
[docs] def SetDPI(self, dpi): r""" Set the DPI (dots per inch) of the printing :type dpi: int :param dpi:, 300 is typically laser printer output, 96 dpi is LCD screen the larger this value the larger the file sent to the printer and the finer the document features that can be resolved. Default is 300. """ return _PDFNetPython.PrinterMode_SetDPI(self, dpi)
[docs] def SetDuplexing(self, mode): r""" Set the duplexing mode :type mode: int :param mode: one of {e_Duplex_Auto, e_Duplex_None, e_Duplex_LongSide, e_Duplex_ShortSide}. Default is e_Duplex_Auto. """ return _PDFNetPython.PrinterMode_SetDuplexing(self, mode)
[docs] def SetNUp(self, args): r""" Overload 1: Set the number of document pages to place on the output pages across and vertically. Pages will be automatically rotated to best fit the page. :type nup: int :param nup: one of {e_NUp_1_1, e_NUp_2_1, e_NUp_2_2, e_NUp_3_2, e_NUp_3_3, e_NUp_4_4}. Default is e_NUp_1_1. :type pageOrder: int :param pageOrder: order of document pages across and down output page. Default is e_PageOrder_LeftToRightThenTopToBottom. | Overload 2: Set the number of document pages to place on the output pages across and vertically. Pages will be automatically rotated to best fit the page. Typical values: (2,1) 2-up; (2,2) 4 per page, etc :type x: int :param x: number of document pages across. Default is 1. :type y: int :param y: number of document pages down. Default is 1. :type pageOrder: int :param pageOrder: order of document pages across and down output page Default is e_PageOrder_LeftToRightThenTopToBottom. | Overload 3: Set the number of document pages to place on the output pages across and vertically. Pages will be automatically rotated to best fit the page. Typical values: (2,1) 2-up; (2,2) 4 per page, etc :type x: int :param x: number of document pages across. Default is 1. :type y: int :param y: number of document pages down. Default is 1. :param pageOrder: order of document pages across and down output page Default is e_PageOrder_LeftToRightThenTopToBottom. """ return _PDFNetPython.PrinterMode_SetNUp(self, args)
[docs] def SetOrientation(self, orientation): r""" Set the orientation of the output document :type orientation: int :param orientation: {e_Orientation_Portrait, e_Orientation_Landscape} Default is e_Orientation_Portrait. """ return _PDFNetPython.PrinterMode_SetOrientation(self, orientation)
[docs] def SetOutputAnnot(self, printContent): r""" Set the printing of annotations :type printContent: int :param printContent: one of {e_PrintContent_DocumentOnly, e_PrintContent_DocumentAndAnnotations}. Default is e_PrintContent_DocumentAndAnnotations. """ return _PDFNetPython.PrinterMode_SetOutputAnnot(self, printContent)
[docs] def SetOutputColor(self, color): r""" Set the color output of the printing :type color: int :param color: one of {e_OutputColor_Color, e_OutputColor_Grayscale, e_OutputColor_Monochrome}. Default is e_OutputColor_Color. Notes: If the XPS print path is being used, then the printer spooler file will ignore the grayscale option and be in full color. The printer driver will then perform any color conversions necessary. """ return _PDFNetPython.PrinterMode_SetOutputColor(self, color)
[docs] def SetOutputQuality(self, quality): r""" Set the quality of the printing. Overridden if SetDPI is called. :type quality: int :param quality: one of {e_OutputQuality_Draft, e_OutputQuality_Low, e_OutputQuality_Medium, e_OutputQuality_High}. Default is to use DPI of 300. """ return _PDFNetPython.PrinterMode_SetOutputQuality(self, quality)
[docs] def SetOutputPageBorder(self, printBorder): r""" Set the printing of page borders, helpful when printing multiple document pages per output page :type printBorder: boolean :param printBorder: if true will add a thin frame around each page border. Default is false. """ return _PDFNetPython.PrinterMode_SetOutputPageBorder(self, printBorder)
[docs] def SetPaperSize(self, args): r""" Overload 1: Set the output printer paper size (assumed to be correct) :type size: :py:class:`Rect` :param size: the size of the output paper size in points (72 points = 1 inch). Default is US Letter or Rect(0, 0, 612, 792) | Overload 2: Set the output printer paper size :type paperSize: int :param paperSize: standard paper size enumerator """ return _PDFNetPython.PrinterMode_SetPaperSize(self, args)
[docs] def SetScale(self, scale): r""" Set the scaling of the document pages to the output pages. Causes SetScaleType(e_ScaleType_CustomScale) to be set. :type scale: double :param scale: to apply to document pages. 1.0 is no scale, greater than 1.0 increases document page sizes, less than 1.0 reduces document pages sizes on output pages. Default is 1.0 """ return _PDFNetPython.PrinterMode_SetScale(self, scale)
[docs] def SetScaleType(self, scaleType): r""" Set the scaling of the document page to the output pages :type scaleType: int :param scaleType: one of {e_ScaleType_None, e_ScaleType_FitToOutputPage, e_ScaleType_ReduceToOutputPage}. Default is e_ScaleType_None. """ return _PDFNetPython.PrinterMode_SetScaleType(self, scaleType)
[docs] def SetUseRleImageCompression(self, useRleImageCompression): r""" Set whether RLE image compression is used for printing bitmaps :type useRleImageCompression: boolean :param useRleImageCompression: if true, printer spool file will be reduced. However, some printers do not support this type of image compression and will produce blank pages. Default is false """ return _PDFNetPython.PrinterMode_SetUseRleImageCompression(self, useRleImageCompression)
m_printerMode = property(_PDFNetPython.PrinterMode_m_printerMode_get, _PDFNetPython.PrinterMode_m_printerMode_set)
# Register PrinterMode in _PDFNetPython: _PDFNetPython.PrinterMode_swigregister(PrinterMode)
[docs] class HTML2PDF(object): r""" 'pdftron.PDF.HTML2PDF' is an optional PDFNet Add-On utility class that can be used to convert HTML web pages into PDF documents by using an external module (html2pdf). The html2pdf modules can be downloaded from http: www.pdftron.com/pdfnet/downloads.html. Users can convert HTML pages to PDF using the following operations: - Simple one line static method to convert a single web page to PDF. - Convert HTML pages from URL or string, plus optional table of contents, in user defined order. - Optionally configure settings for proxy, images, java script, and more for each HTML page. - Optionally configure the PDF output, including page size, margins, orientation, and more. - Optionally add table of contents, including setting the depth and appearance. The following code converts a single webpage to pdf .. code-block:: c++ using namespace pdftron; using namespace PDF; PDFDoc pdfdoc; if ( HTML2PDF::Convert(pdfdoc, "http://www.gutenberg.org/wiki/Main_Page") ) pdfdoc.Save(outputFile, SDF::SDFDoc::e_remove_unused, NULL); The following code demonstrates how to convert multiple web pages into one pdf, excluding the background, and with lowered image quality to save space. .. code-block:: c++ using namespace pdftron; using namespace PDF; HTML2PDF converter; converter.SetImageQuality(25); HTML2PDF::WebPageSettings settings; settings.SetPrintBackground(false); converter.InsertFromURL("http://www.gutenberg.org/wiki/Main_Page", settings); PDFDoc pdfdoc; if ( converter.Convert(pdfdoc) ) pdfdoc.Save(outputFile, SDF::SDFDoc::e_remove_unused, NULL); """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def InsertFromURL(self, args): r""" Overload 1: Add a web page to be converted. A single URL typically results in many PDF pages. :type url: string :param url: - HTML page, or relative path to local HTML page | Overload 2: Add a web page to be converted. A single URL typically results in many PDF pages. :type url: string :param url: - HTML page, or relative path to local HTML page :type settings: :py:class:`WebPageSettings` :param settings: - How the web page should be loaded and converted """ return _PDFNetPython.HTML2PDF_InsertFromURL(self, args)
[docs] def InsertFromHtmlString(self, args): r""" Overload 1: Convert HTML encoded in string. :type html: string :param html: - String containing HTML code. | Overload 2: Convert HTML encoded in string. :type html: string :param html: - String containing HTML code. :type settings: :py:class:`WebPageSettings` :param settings: - How the HTML content described in html is loaded. """ return _PDFNetPython.HTML2PDF_InsertFromHtmlString(self, args)
[docs] def InsertTOC(self, args): r""" Overload 1: Add a table of contents to the produced PDF. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. | Overload 2: Add a table of contents to the produced PDF. :type settings: :py:class:`TOCSettings` :param settings: - Settings for the table of contents. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.HTML2PDF_InsertTOC(self, args)
[docs] def Convert(self, doc): r""" Convert HTML documents and append the results to doc. :rtype: boolean :return: true if successful, otherwise false. Use 'GetHttpErrorCode' for possible HTTP errors. :type doc: :py:class:`PDFDoc` :param doc: - Target PDF to which converted HTML pages will be appended to. Notes: Use 'InsertFromURL' and 'InsertFromHtmlString' to add HTML documents to be converted. """ return _PDFNetPython.HTML2PDF_Convert(self, doc)
[docs] def GetHTTPErrorCode(self): r""" Return the largest HTTP error code encountered during conversion :rtype: int :return: the largest HTTP code greater then or equal to 300 encountered during loading of any of the supplied objects, if no such error code is found 0 is returned. Notes: This function will only return a useful result after 'Convert' has been called. """ return _PDFNetPython.HTML2PDF_GetHTTPErrorCode(self)
[docs] def SetQuiet(self, quiet): r""" Display HTML to PDF conversion progress, warnings, and errors, to stdout. :type quiet: boolean :param quiet: - If false, progress information is sent to stdout during conversion. Notes: You can get the final results using GetLog. """ return _PDFNetPython.HTML2PDF_SetQuiet(self, quiet)
[docs] def SetCompatibilityMode(self, compatibility): r""" Provides the ability to run HTML to PDF conversion to run in compatibility mode, which runs with altered graphics options and does not create a dedicated render process. This option may be somewhat slower than the default mode. However, it may be required on environments with limited platform dependencies, such as AWS Lambda. :type compatibility: boolean :param compatibility: - If true, compatibility mode is enabled. """ return _PDFNetPython.HTML2PDF_SetCompatibilityMode(self, compatibility)
[docs] def SetLogFilePath(self, path): r""" Sets the location of the log file to be used during conversion. :type path: string :param path: Full path and filename of file to log to. """ return _PDFNetPython.HTML2PDF_SetLogFilePath(self, path)
[docs] def GetLog(self): r""" Get results of conversion, including errors and warnings, in human readable form. :rtype: string :return: String containing results of conversion. """ return _PDFNetPython.HTML2PDF_GetLog(self)
[docs] @staticmethod def SetModulePath(path): r""" Set the only location that PDFNet will look for the html2pdf module. :type path: string :param path: - A folder or file path. If non-empty, PDFNet will only look in path for the html2pdf module, otherwise it will search in the default locations for the module. """ return _PDFNetPython.HTML2PDF_SetModulePath(path)
[docs] @staticmethod def IsModuleAvailable(): r""" Find out whether the HTLML2PDF module is available (and licensed). :rtype: boolean :return: returns true if HTLML2PDF operations can be performed. """ return _PDFNetPython.HTML2PDF_IsModuleAvailable()
def __init__(self): r"""Defaultructor.""" _PDFNetPython.HTML2PDF_swiginit(self, _PDFNetPython.new_HTML2PDF()) __swig_destroy__ = _PDFNetPython.delete_HTML2PDF
[docs] def SetPaperSize(self, args): r""" Overload 1: Set paper size of output PDF :type size: int :param size: - Paper size to use for produced PDF. | Overload 2: Manually set the paper dimensions of the produced PDF. :type width: string :param width: - Width of the page, e.g. "4cm". :type height: string :param height: - Height of the page, eg. "12in". Notes: Supported units are mm, cm, m, in, pc(pica), px(pixel) and pt(point). """ return _PDFNetPython.HTML2PDF_SetPaperSize(self, args)
[docs] def SetLandscape(self, enable): r""" Set page orientation for output PDF. :type enable: boolean :param enable: - If true generated PDF pages will be orientated to landscape, otherwise orientation will be portrait. """ return _PDFNetPython.HTML2PDF_SetLandscape(self, enable)
[docs] def SetDPI(self, dpi): r""" Change the DPI explicitly for the output PDF. :type dpi: int :param dpi: - Dots per inch, e.g. 80. This has no effect on X11 based systems. Notes: Results also depend on 'SetSmartShrinking'. """ return _PDFNetPython.HTML2PDF_SetDPI(self, dpi)
[docs] def SetOutline(self, enable, depth=4): r""" Add bookmarks to the PDF. :type enable: boolean :param enable: - If true bookmarks will be generated for the produced PDF. :type depth: int :param depth: - Maximum depth of the outline (e.g. 4). Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.HTML2PDF_SetOutline(self, enable, depth)
[docs] def DumpOutline(self, xml_file): r""" Save outline to a xml file. :type xml_file: string :param xml_file: - Path of where xml data representing outline of produced PDF should be saved to. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.HTML2PDF_DumpOutline(self, xml_file)
[docs] def SetPDFCompression(self, enable): r""" Use loss less compression to create PDF. :type enable: boolean :param enable: - If true loss less compression will be used to create PDF Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.HTML2PDF_SetPDFCompression(self, enable)
[docs] def SetMargins(self, top, bottom, left, right): r""" Set margins of generated PDF. :type top: string :param top: - Size of the top margin, e.g. "2cm". :type bottom: string :param bottom: - Size of the bottom margin, e.g. "2cm". :type left: string :param left: - Size of the left margin, e.g. "2cm". :type right: string :param right: - Size of the right margin, e.g. "2cm". Notes: Supported units are mm, cm, m, in, pc(pica), px(pixel) and pt(point). """ return _PDFNetPython.HTML2PDF_SetMargins(self, top, bottom, left, right)
[docs] def SetHeader(self, header): r""" Set header of generated PDF. :type header: string :param header: HTML string to be used as the header """ return _PDFNetPython.HTML2PDF_SetHeader(self, header)
[docs] def SetFooter(self, footer): r""" Set footer of generated PDF. :type footer: string :param footer: HTML string to be used as the footer """ return _PDFNetPython.HTML2PDF_SetFooter(self, footer)
[docs] def SetImageDPI(self, dpi): r""" Maximum DPI to use for images in the generated PDF. :type dpi: int :param dpi: - Maximum dpi of images in produced PDF, e.g. 80. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.HTML2PDF_SetImageDPI(self, dpi)
[docs] def SetImageQuality(self, quality): r""" JPEG compression factor to use when generating PDF. :type quality: int :param quality: - Compression factor, e.g. 92. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.HTML2PDF_SetImageQuality(self, quality)
[docs] def SetCookieJar(self, path): r""" Path of file used for loading and storing cookies. :type path: string :param path: - Path to file used for loading and storing cookies. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.HTML2PDF_SetCookieJar(self, path)
[docs] def AddCookie(self, name, value): r""" Add cookie to the HTTP Headers when converting via a URL. :type name: string :param name: - the name of the cookie. :type value: string :param value: - the value of the cookie. """ return _PDFNetPython.HTML2PDF_AddCookie(self, name, value)
[docs] def SetCustomHeader(self, name, value): r""" Add a custom HTTP header specified by name and value. :type name: string :param name: - the name of the custom header. :type value: string :param value: - the value of the custom header. """ return _PDFNetPython.HTML2PDF_SetCustomHeader(self, name, value)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.HTML2PDF_Destroy(self)
mp_html2pdf = property(_PDFNetPython.HTML2PDF_mp_html2pdf_get, _PDFNetPython.HTML2PDF_mp_html2pdf_set)
# Register HTML2PDF in _PDFNetPython: _PDFNetPython.HTML2PDF_swigregister(HTML2PDF)
[docs] def HTML2PDF_SetModulePath(path): r""" Set the only location that PDFNet will look for the html2pdf module. :type path: string :param path: - A folder or file path. If non-empty, PDFNet will only look in path for the html2pdf module, otherwise it will search in the default locations for the module. """ return _PDFNetPython.HTML2PDF_SetModulePath(path)
[docs] def HTML2PDF_IsModuleAvailable(): r""" Find out whether the HTLML2PDF module is available (and licensed). :rtype: boolean :return: returns true if HTLML2PDF operations can be performed. """ return _PDFNetPython.HTML2PDF_IsModuleAvailable()
[docs] class Proxy(object): r""" Proxy settings to be used when loading content from web pages. Notes: These Proxy settings will only be used if type is not e_default. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Defaultructor""" _PDFNetPython.Proxy_swiginit(self, _PDFNetPython.new_Proxy()) __swig_destroy__ = _PDFNetPython.delete_Proxy e_default = _PDFNetPython.Proxy_e_default e_none = _PDFNetPython.Proxy_e_none e_http = _PDFNetPython.Proxy_e_http e_socks5 = _PDFNetPython.Proxy_e_socks5
[docs] def SetType(self, type): return _PDFNetPython.Proxy_SetType(self, type)
[docs] def SetHost(self, host): r""" Set the proxy host to use. :type host: string :param host: - String defining the host name, e.g. "myserver" or "www.xxx.yyy.zzz" """ return _PDFNetPython.Proxy_SetHost(self, host)
[docs] def SetPort(self, port): r""" Set the port number to use :type port: int :param port: - A valid port number, e.g. 3128. """ return _PDFNetPython.Proxy_SetPort(self, port)
[docs] def SetUsername(self, username): r""" Set the username to use when logging into the proxy :type username: string :param username: - The login name, e.g. "elbarto". """ return _PDFNetPython.Proxy_SetUsername(self, username)
[docs] def SetPassword(self, password): r""" Set the password to use when logging into the proxy with username :type password: string :param password: - The password to use, e.g. "bart". """ return _PDFNetPython.Proxy_SetPassword(self, password)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.Proxy_Destroy(self)
mp_impl = property(_PDFNetPython.Proxy_mp_impl_get, _PDFNetPython.Proxy_mp_impl_set)
# Register Proxy in _PDFNetPython: _PDFNetPython.Proxy_swigregister(Proxy)
[docs] class WebPageSettings(object): r"""Settings that control how a web page is opened and converted to PDF.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Defaultructor""" _PDFNetPython.WebPageSettings_swiginit(self, _PDFNetPython.new_WebPageSettings()) __swig_destroy__ = _PDFNetPython.delete_WebPageSettings
[docs] def SetPrintBackground(self, background): r""" Print the background of this web page. :type background: boolean :param background: - If true background is printed. """ return _PDFNetPython.WebPageSettings_SetPrintBackground(self, background)
[docs] def SetLoadImages(self, load): r""" Print the images of this web page. :type load: boolean :param load: - If true images are printed. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.WebPageSettings_SetLoadImages(self, load)
[docs] def SetAllowJavaScript(self, enable): r""" Allow javascript from this web page to be run. :type enable: boolean :param enable: - If true javascript's are allowed. """ return _PDFNetPython.WebPageSettings_SetAllowJavaScript(self, enable)
[docs] def SetSmartShrinking(self, enable): r""" Allow intelligent shrinking to fit more content per page. :type enable: boolean :param enable: - If true intelligent shrinking is enabled and the pixel/dpi ratio is nonant. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.WebPageSettings_SetSmartShrinking(self, enable)
[docs] def SetMinimumFontSize(self, size): r""" Set the smallest font size allowed, e.g 9. :type size: int :param size: - No fonts will appear smaller than this. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.WebPageSettings_SetMinimumFontSize(self, size)
[docs] def SetDefaultEncoding(self, encoding): r""" Default encoding to be used when not specified by the web page. :type encoding: string :param encoding: - Default encoding, e.g. utf-8 or iso-8859-1. Notes: available encodings are Apple Roman, Big5, Big5-HKSCS, CP949, EUC-JP, EUC-KR, GB18030-0, IBM 850, IBM 866, IBM 874, ISO 2022-JP, ISO 8859-1 to 10, ISO 8859-13 to 16, Iscii-Bng, Dev, Gjr, Knd, Mlm, Ori, Pnj, Tlg, Tml, JIS X 0201, JIS X 0208, KOI8-R, KOI8-U, MuleLao-1, ROMAN8, Shift-JIS, TIS-620, TSCII, UTF-8, UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, Windows-1250 to 1258, WINSAMI2. This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.WebPageSettings_SetDefaultEncoding(self, encoding)
[docs] def SetUserStyleSheet(self, url): r""" Url or path to user specified style sheet. :type url: string :param url: - URL or file path to user style sheet to be used with this web page. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.WebPageSettings_SetUserStyleSheet(self, url)
[docs] def SetAllowPlugins(self, enable): r""" Allow Netscape and flash plugins from this web page to be run. Enabling will have limited success. :type enable: boolean :param enable: - If true Netscape flash plugins will be run. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.WebPageSettings_SetAllowPlugins(self, enable)
[docs] def SetPrintMediaType(self, _print): r""" Controls how content will be printed from this web page. :type print: boolean :param print: - If true the print media type will be used, otherwise the screen media type will be used to print content. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.WebPageSettings_SetPrintMediaType(self, _print)
[docs] def SetIncludeInOutline(self, include): r""" Add sections from this web page to the outline and table of contents. :type include: boolean :param include: - If true PDF pages created from this web page will show up in the outline, and table of contents, otherwise, produced PDF pages will be excluded. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.WebPageSettings_SetIncludeInOutline(self, include)
[docs] def SetUsername(self, username): r""" HTTP authentication username to use when logging into the website. :type username: string :param username: - The login name to use with the server, e.g. "bart". """ return _PDFNetPython.WebPageSettings_SetUsername(self, username)
[docs] def SetPassword(self, password): r""" HTTP authentication password to use when logging into the website. :type password: string :param password: - The login password to use with the server, e.g. "elbarto". """ return _PDFNetPython.WebPageSettings_SetPassword(self, password)
[docs] def SetJavaScriptDelay(self, msec): r""" Amount of time to wait for a web page to start printing after it's completed loading. Converter will wait a maximum of msec milliseconds for javascript to call window.print(). :type msec: int :param msec: - Maximum wait time in milliseconds, e.g. 1200. """ return _PDFNetPython.WebPageSettings_SetJavaScriptDelay(self, msec)
[docs] def SetConvertDelay(self, msec): r""" Amount of time to wait before starting to convert html to pdf. Converter will wait msec milliseconds before calling convert. :type msec: int :param msec: - Time to wait in milliseconds, e.g. 1200. """ return _PDFNetPython.WebPageSettings_SetConvertDelay(self, msec)
[docs] def SetTimeout(self, msec): r""" Amount of time to wait in milliseconds for the entire converting and printing process. If conversion doesn't finish before the timeout, it will be cancelled and no output is expected. Default 120,000 ms. :type msec: int :param msec: -- Maximum timeout in milliseconds. """ return _PDFNetPython.WebPageSettings_SetTimeout(self, msec)
[docs] def SetZoom(self, zoom): r""" Zoom factor to use when loading object. :type zoom: double :param zoom: - How much to magnify the web content by, e.g. 2.2. """ return _PDFNetPython.WebPageSettings_SetZoom(self, zoom)
[docs] def SetBlockLocalFileAccess(self, block): r""" Allow local and piped files access to other local files. By default local file access is blocked due to security concerns. :type block: boolean :param block: - If true local files will be inaccessible. If false they will be be accessible which should only be used if the html is trusted. """ return _PDFNetPython.WebPageSettings_SetBlockLocalFileAccess(self, block)
[docs] def SetStopSlowScripts(self, stop): r""" Stop slow running javascript's. :type stop: boolean :param stop: - If true, slow running javascript's will be stopped. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.WebPageSettings_SetStopSlowScripts(self, stop)
[docs] def SetDebugJavaScriptOutput(self, forward): r""" Forward javascript warnings and errors to output. :type forward: boolean :param forward: - If true javascript errors and warnings will be forwarded to stdout and the log. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.WebPageSettings_SetDebugJavaScriptOutput(self, forward)
e_abort = _PDFNetPython.WebPageSettings_e_abort e_skip = _PDFNetPython.WebPageSettings_e_skip e_ignore = _PDFNetPython.WebPageSettings_e_ignore
[docs] def SetLoadErrorHandling(self, type): return _PDFNetPython.WebPageSettings_SetLoadErrorHandling(self, type)
[docs] def SetProduceForms(self, forms): r""" Turn HTML forms into PDF forms. :type forms: boolean :param forms: - If true PDF pages produced from this web page will have PDF forms for any HTML forms the web page has. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.WebPageSettings_SetProduceForms(self, forms)
[docs] def SetProxy(self, proxy): r""" Use this proxy to load content from this web page. :type proxy: :py:class:`Proxy` :param proxy: - Contains settings for proxy """ return _PDFNetPython.WebPageSettings_SetProxy(self, proxy)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.WebPageSettings_Destroy(self)
mp_impl = property(_PDFNetPython.WebPageSettings_mp_impl_get, _PDFNetPython.WebPageSettings_mp_impl_set)
# Register WebPageSettings in _PDFNetPython: _PDFNetPython.WebPageSettings_swigregister(WebPageSettings)
[docs] class TOCSettings(object): r""" Settings for table of contents. This option is deprecated in the latest HTML2PDF module and may have no effect. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Default table of contents settings.""" _PDFNetPython.TOCSettings_swiginit(self, _PDFNetPython.new_TOCSettings()) __swig_destroy__ = _PDFNetPython.delete_TOCSettings
[docs] def SetDottedLines(self, enable): r""" Use a dotted line when creating TOC. :type enable: boolean :param enable: - Table of contents will use dotted lines. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.TOCSettings_SetDottedLines(self, enable)
[docs] def SetCaptionText(self, caption): r""" Caption text to be used with TOC. :type caption: string :param caption: - Text that will appear with the table of contents. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.TOCSettings_SetCaptionText(self, caption)
[docs] def SetLevelIndentation(self, indentation): r""" Indentation used for every TOC level... :type indentation: int :param indentation: - How much to indent each level, e.g. "2" Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.TOCSettings_SetLevelIndentation(self, indentation)
[docs] def SetTextSizeShrink(self, shrink): r""" How much to shrink font for every level, e.g. 0.8 :type shrink: double :param shrink: - Rate at which lower level entries will appear smaller Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.TOCSettings_SetTextSizeShrink(self, shrink)
[docs] def SetXsl(self, style_sheet): r""" xsl style sheet used to convert outline XML into a table of content. :type style_sheet: string :param style_sheet: - Path to xsl style sheet to be used to generate this table of contents. Notes: This option is deprecated in the latest HTML2PDF module and may have no effect. """ return _PDFNetPython.TOCSettings_SetXsl(self, style_sheet)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.TOCSettings_Destroy(self)
mp_impl = property(_PDFNetPython.TOCSettings_mp_impl_get, _PDFNetPython.TOCSettings_mp_impl_set)
# Register TOCSettings in _PDFNetPython: _PDFNetPython.TOCSettings_swigregister(TOCSettings)
[docs] class Stamper(object): r""" Stamper is a utility class that can be used to stamp PDF pages with text, images, or vector art (including another PDF page) in only a few lines of code. Although Stamper is very simple to use compared to ElementBuilder/ElementWriter it is not as powerful or flexible. In case you need full control over PDF creation use ElementBuilder/ElementWriter to add new content to existing PDF pages as shown in the ElementBuilder sample project. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr e_relative_scale = _PDFNetPython.Stamper_e_relative_scale e_absolute_size = _PDFNetPython.Stamper_e_absolute_size e_font_size = _PDFNetPython.Stamper_e_font_size e_horizontal_left = _PDFNetPython.Stamper_e_horizontal_left e_horizontal_center = _PDFNetPython.Stamper_e_horizontal_center e_horizontal_right = _PDFNetPython.Stamper_e_horizontal_right e_vertical_bottom = _PDFNetPython.Stamper_e_vertical_bottom e_vertical_center = _PDFNetPython.Stamper_e_vertical_center e_vertical_top = _PDFNetPython.Stamper_e_vertical_top e_align_left = _PDFNetPython.Stamper_e_align_left e_align_center = _PDFNetPython.Stamper_e_align_center e_align_right = _PDFNetPython.Stamper_e_align_right __swig_destroy__ = _PDFNetPython.delete_Stamper
[docs] def StampImage(self, dest_doc, src_img, dest_pages): r""" Stamps an image to the given destination document at the set of page numbers :type dest_doc: :py:class:`PDFDoc` :param dest_doc: The document being stamped :type src_img: :py:class:`Image` :param src_img: The image that is being stamped to the document :type dest_pages: :py:class:`PageSet` :param dest_pages: The set of pages in the document being stamped """ return _PDFNetPython.Stamper_StampImage(self, dest_doc, src_img, dest_pages)
[docs] def StampPage(self, dest_doc, src_page, dest_pages): r""" Stamps a PDF page to the given destination document at the set of page numbers :type dest_doc: :py:class:`PDFDoc` :param dest_doc: The document being stamped :type src_page: :py:class:`Page` :param src_page: The page that is being stamped to the document :type dest_pages: :py:class:`PageSet` :param dest_pages: The set of pages in the document being stamped """ return _PDFNetPython.Stamper_StampPage(self, dest_doc, src_page, dest_pages)
[docs] def StampText(self, dest_doc, src_txt, dest_pages): r""" Stamps text to the given destination document at the set of page numbers :type dest_doc: :py:class:`PDFDoc` :param dest_doc: The document being stamped :type src_txt: string :param src_txt: The image that is being stamped to the document :type dest_pages: :py:class:`PageSet` :param dest_pages: The set of pages in the document being stamped """ return _PDFNetPython.Stamper_StampText(self, dest_doc, src_txt, dest_pages)
[docs] def SetFont(self, font): r""" Defines the font of the stamp. (This only applies to text-based stamps) :type font: :py:class:`Font` :param font: The font of the text stamp """ return _PDFNetPython.Stamper_SetFont(self, font)
[docs] def SetFontColor(self, color): r""" Sets the font color (This only effects text-based stamps) :param font_color: The color of the font """ return _PDFNetPython.Stamper_SetFontColor(self, color)
[docs] def SetOpacity(self, opacity): r""" Sets the opacity value for the stamp :type opacity: double :param opacity: The opacity value of the stamp """ return _PDFNetPython.Stamper_SetOpacity(self, opacity)
[docs] def SetRotation(self, rotation): r""" Rotates the stamp by the given number of degrees :type rotation: double :param rotation: Rotation in degrees """ return _PDFNetPython.Stamper_SetRotation(self, rotation)
[docs] def SetAsBackground(self, background): r""" Specifies if the stamp is to be stamped in the background or the foreground. :type background: boolean :param background: A flag specifying if the stamp should be added as a background layer to the destination page """ return _PDFNetPython.Stamper_SetAsBackground(self, background)
[docs] def SetAsAnnotation(self, annotation): r""" Specifies if the stamp is to be stamped as an annotation. :type annotation: boolean :param annotation: A flag specifying if the stamp should be added as an annotation or not Notes: Stamps created with this setting do not work with SetAsBackground, HasStamps, and DeleteStamps, if annotation is true. """ return _PDFNetPython.Stamper_SetAsAnnotation(self, annotation)
[docs] def ShowsOnScreen(self, on_screen): r""" :type on_screen: boolean :param on_screen: Specifies if the watermark will be displayed on screen """ return _PDFNetPython.Stamper_ShowsOnScreen(self, on_screen)
[docs] def ShowsOnPrint(self, on_print): r""" :type on_print: boolean :param on_print: Specifies if the watermark will be displayed when printed """ return _PDFNetPython.Stamper_ShowsOnPrint(self, on_print)
[docs] def SetPosition(self, horizontal_distance, vertical_distance, use_percentage=False): r""" Sets the horizontal and vertical position of the stamp. See also: SetAlignment :type horizontal_distance: double :param horizontal_distance: Horizontal distance from left, right or center of crop box :type vertical_distance: double :param vertical_distance: Vertical distance from top, bottom or center of crop box :type use_percentage: boolean :param use_percentage: If true, horizontal_distance is a percentage of the crop box width (e.g.: 0.5 is 50% of the width of the crop box) and vertical_distance is a percentage of the crop box height. If false, horizontal_distance and vertical_distance is measured in points. """ return _PDFNetPython.Stamper_SetPosition(self, horizontal_distance, vertical_distance, use_percentage)
[docs] def SetAlignment(self, horizontal_alignment, vertical_alignment): r""" Sets the alignment for the x and y variables. See also: SetPosition :type horizontal_alignment: int :param horizontal_alignment: Can be set to e_left, e_center or e_right e_left: horizontal_distance measures the distance between the left edge of the stamp's bounding box and the left edge of the crop box e_center: horizontal_distance measures the distance between the horizontal bisector of the stamp's bounding box and the horizontal bisector of the crop box e_right: horizontal_distance measures the distance between the right edge of the stamp's bounding box and the right edge of the crop box :type vertical_alignment: int :param vertical_alignment: Can be set to e_top, e_center or e_bottom e_bottom: vertical_distance measures the distance between the bottom edge of the stamp's bounding box and the bottom edge of the crop box e_center: vertical_distance measures the distance between the vertical bisector of the stamp's bounding box and the vertical bisector of the crop box e_top: vertical_distance measures the distance between the top edge of the stamp's bounding box and the top edge of the crop box """ return _PDFNetPython.Stamper_SetAlignment(self, horizontal_alignment, vertical_alignment)
[docs] def SetTextAlignment(self, text_alignment): r""" Sets the text alignment (note: this only applies to text watermarks) :type text_alignment: int :param text_alignment: Enumerator for text alignment (e_left, e_center, e_right) """ return _PDFNetPython.Stamper_SetTextAlignment(self, text_alignment)
[docs] def SetSize(self, size_type, a, b): r""" Sets the size of the stamp :type size_type: int :param size_type: Specifies how the stamp will be sized -e_relative_scale: Stamp size is relative to the size of the crop box of the destination page. 'a' is a percentage of the width of the crop box (e.g.: 0.5 is 50% of the width of the crop box) 'b' is a percentage of the height of the crop box. If 'a' <= 0 then only b will be used. If 'b' <= 0 then only 'a' will be used. -e_absolute_scale: Stamp size is explicitly set. 'a' sets the width of of the stamp's bounding box. 'b' sets the height of the stamp's bounding box. The width and height areant, regardless of the size of the destination page's bounding box. -e_font_size: This type only applies to text stamps. 'a' sets the font size. 'b' is ignored. :type a: double :param a: Generally the horizontal component of the size. See size_type for more details. :type b: double :param b: Generally the vertical component of the size. See size_type for more details. """ return _PDFNetPython.Stamper_SetSize(self, size_type, a, b)
[docs] @staticmethod def DeleteStamps(doc, page_set): r""" Deletes PDFTron stamps from document at given page numbers :type doc: :py:class:`PDFDoc` :param doc: The document to delete stamps from :type page_set: :py:class:`PageSet` :param page_set: The set of pages to delete stamps from """ return _PDFNetPython.Stamper_DeleteStamps(doc, page_set)
[docs] @staticmethod def HasStamps(doc, page_set): r""" Returns true if the given set of pages has at least one stamp :type doc: :py:class:`PDFDoc` :param doc: The document that's being checked :type page_set: :py:class:`PageSet` :param page_set: The set of page that's being checked """ return _PDFNetPython.Stamper_HasStamps(doc, page_set)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.Stamper_Destroy(self)
def __init__(self, args): _PDFNetPython.Stamper_swiginit(self, _PDFNetPython.new_Stamper(args)) mp_impl = property(_PDFNetPython.Stamper_mp_impl_get, _PDFNetPython.Stamper_mp_impl_set)
# Register Stamper in _PDFNetPython: _PDFNetPython.Stamper_swigregister(Stamper)
[docs] def Stamper_DeleteStamps(doc, page_set): r""" Deletes PDFTron stamps from document at given page numbers :type doc: :py:class:`PDFDoc` :param doc: The document to delete stamps from :type page_set: :py:class:`PageSet` :param page_set: The set of pages to delete stamps from """ return _PDFNetPython.Stamper_DeleteStamps(doc, page_set)
[docs] def Stamper_HasStamps(doc, page_set): r""" Returns true if the given set of pages has at least one stamp :type doc: :py:class:`PDFDoc` :param doc: The document that's being checked :type page_set: :py:class:`PageSet` :param page_set: The set of page that's being checked """ return _PDFNetPython.Stamper_HasStamps(doc, page_set)
[docs] class CharRange(object): r"""Represents a range of characters based on start index and length""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr index = property(_PDFNetPython.CharRange_index_get, _PDFNetPython.CharRange_index_set) length = property(_PDFNetPython.CharRange_length_get, _PDFNetPython.CharRange_length_set) def __init__(self): _PDFNetPython.CharRange_swiginit(self, _PDFNetPython.new_CharRange()) __swig_destroy__ = _PDFNetPython.delete_CharRange
# Register CharRange in _PDFNetPython: _PDFNetPython.CharRange_swigregister(CharRange)
[docs] class TextExtractor(object): r""" TextExtractor is used to analyze a PDF page and extract words and logical structure within a given region. The resulting list of lines and words can be traversed element by element or accessed as a string buffer. The class also includes utility methods to extract PDF text as HTML or XML. Possible use case scenarios for TextExtractor include: - Converting PDF pages to text or XML for content repurposing. - Searching PDF pages for specific words or keywords. - Indexing large PDF repositories for indexing or content retrieval purposes (i.e. implementing a PDF search engine). - Classifying or summarizing PDF documents based on their text content. - Finding specific words for content editing purposes (such as splitting pages based on keywords etc). The main task of TextExtractor is to interpret PDF pages and offer a simple to use API to: - Normalize all text content to Unicode. - Extract inferred logical structure (word by word, line by line, or paragraph by paragraph). - Extract positioning information for every line, word, or a glyph. - Extract style information (such as information about the font, font size, font styles, etc) for every line, word, or a glyph. - Control the content analysis process. A number of options (such as removal of text obscured by images) is available to let the user direct the flow of content recognition algorithms that will meet their requirements. - Offer utility methods to convert PDF page content to text, XML, or HTML. Note: TextExtractor is analyzing only textual content of the page. This means that the rasterized (e.g. in scanned pages) or vectorized text (where glyphs are converted to path outlines) will not be recognized as text. Please note that it is still possible to extract this content using pdftron.PDF.ElementReader interface. In some cases TextExtractor may extract text that does not appear to be on the visible page (e.g. when text is obscured by an image or a rectangle). In these situations it is possible to use processing flags such as 'e_remove_hidden_text' and 'e_no_invisible_text' to remove hidden text. A sample use case (in C++): .. code-block:: c++ ... Initialize PDFNet ... PDFDoc doc(filein); doc.InitSecurityHandler(); Page page = doc.PageBegin(); TextExtractor txt; txt.Begin(page, 0, TextExtractor::e_remove_hidden_text); UString text; txt.GetAsText(text); // or traverse words one by one... TextExtractor::Line line = txt.GetFirstLine(), lend; TextExtractor::Word word, wend; for (; line!=lend; line=line.GetNextLine()) { for (word=line.GetFirstWord(); word!=wend; word=word.GetNextWord()) { text.Assign(word.GetString(), word.GetStringLen()); cout < text < ''; } } A sample use case (in C#): .. code-block:: c++ ... Initialize PDFNet ... PDFDoc doc = new PDFDoc(filein); doc.InitSecurityHandler(); Page page = doc.PageBegin().Current(); TextExtractor txt = new TextExtractor(); txt.Begin(page, 0, TextExtractor.ProcessingFlags.e_remove_hidden_text); string text = txt.GetAsText(); // or traverse words one by one... TextExtractor.Word word; for (TextExtractor.Line line = txt.GetFirstLine(); line.IsValid(); line=line.GetNextLine()) { for (word=line.GetFirstWord(); word.IsValid(); word=word.GetNextWord()) { Console.WriteLine(word.GetString()); } } For full sample code, please take a look at TextExtract sample project. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Constructor and destructor""" _PDFNetPython.TextExtractor_swiginit(self, _PDFNetPython.new_TextExtractor()) __swig_destroy__ = _PDFNetPython.delete_TextExtractor e_no_ligature_exp = _PDFNetPython.TextExtractor_e_no_ligature_exp e_no_dup_remove = _PDFNetPython.TextExtractor_e_no_dup_remove e_punct_break = _PDFNetPython.TextExtractor_e_punct_break e_remove_hidden_text = _PDFNetPython.TextExtractor_e_remove_hidden_text e_no_invisible_text = _PDFNetPython.TextExtractor_e_no_invisible_text e_no_watermarks = _PDFNetPython.TextExtractor_e_no_watermarks e_extract_using_zorder = _PDFNetPython.TextExtractor_e_extract_using_zorder
[docs] def Begin(self, page, clip_ptr=None, flags=0): r""" Start reading the page. :type page: :py:class:`Page` :param page: Page to read. :type clip_ptr: :py:class:`Rect` :param clip_ptr: A pointer to the optional clipping rectangle. This parameter can be used to selectively read text from a given rectangle. :type flags: int :param flags: A list of ProcessingFlags used to control text extraction algorithm. """ return _PDFNetPython.TextExtractor_Begin(self, page, clip_ptr, flags)
[docs] def SetOCGContext(self, ctx): r""" Sets the Optional Content Group (OCG) context that should be used when processing the document. This function can be used to change the current OCG context. Optional content (such as PDF layers) will be selectively processed based on the states of optional content groups in the given context. :type ctx: :py:class:`Context` :param ctx: Optional Content Group (OCG) context, or NULL if TextExtractor should process all content on the page. """ return _PDFNetPython.TextExtractor_SetOCGContext(self, ctx)
[docs] def GetWordCount(self): r""" :rtype: int :return: the number of words on the page. """ return _PDFNetPython.TextExtractor_GetWordCount(self)
[docs] def SetRightToLeftLanguage(self, rtl): r""" Sets the directionality of text extractor. Must be called before the processing of a page started. :type rtl: boolean :param rtl: mode reverses the directionality of TextExtractor algorithm. """ return _PDFNetPython.TextExtractor_SetRightToLeftLanguage(self, rtl)
[docs] def GetRightToLeftLanguage(self): r""" :rtype: boolean :return: the directionality of text extractor. """ return _PDFNetPython.TextExtractor_GetRightToLeftLanguage(self)
[docs] def GetAsText(self, dehyphen=True): r""" Get all words in the current selection as a single string. :param out_str: The string containing all words in the current selection. Words will be separated with space (i.e. ' ') or new line (i.e. ' ') characters. :type dehyphen: boolean :param dehyphen: If true, finds and removes hyphens that split words across two lines. Hyphens are often used a the end of lines as an indicator that a word spans two lines. Hyphen detection enables removal of hyphen character and merging of text runs to form a single word. This option has no effect on Tagged PDF files. """ return _PDFNetPython.TextExtractor_GetAsText(self, dehyphen)
[docs] def GetTextUnderAnnot(self, annot): r""" Get all the characters that intersect an annotation. :type annot: :py:class:`Annot` :param annot: The annotation to intersect with. """ return _PDFNetPython.TextExtractor_GetTextUnderAnnot(self, annot)
e_words_as_elements = _PDFNetPython.TextExtractor_e_words_as_elements e_output_bbox = _PDFNetPython.TextExtractor_e_output_bbox e_output_style_info = _PDFNetPython.TextExtractor_e_output_style_info
[docs] def GetAsXML(self, xml_output_flags=0): r""" Get text content in a form of an XML string. :param out_xml: - The string containing XML output. :type xml_output_flags: int :param xml_output_flags: - flags controlling XML output. For more information, please see TextExtract::XMLOutputFlags. XML output will be encoded in UTF-8 and will have the following structure: .. code-block:: c++ Page num="1 crop_box="0, 0, 612, 792" media_box="0, 0, 612, 792" rotate="0"> <Flow id="1"> <Para id="1"> <Line box="72, 708.075, 467.895, 10.02" style="font-family:Calibri; font-size:10.02; color: #000000;"> <Word box="72, 708.075, 30.7614, 10.02">PDFNet</Word> <Word box="106.188, 708.075, 15.9318, 10.02">SDK</Word> <Word box="125.617, 708.075, 6.22242, 10.02">is</Word> ... </Line> </Para> </Flow> </Page> @endcode The above XML output was generated by passing the following union of flags in the call to GetAsXML(): (TextExtractor::e_words_as_elements | TextExtractor::e_output_bbox | TextExtractor::e_output_style_info) In case 'xml_output_flags' was not specified, the default XML output would look as follows: <Page num="1 crop_box="0, 0, 612, 792" media_box="0, 0, 612, 792" rotate="0" Flow id="1" Para id="1" LinePDFNet SDK is an amazingly comprehensive, high-quality PDF developer toolkit...Line Linelevels. Using the PDFNet PDF library, ...Line ... Para Flow Page """ return _PDFNetPython.TextExtractor_GetAsXML(self, xml_output_flags)
[docs] def GetHighlights(self, char_ranges): r""" Get a Highlights object based on an array of character ranges. :type char_ranges: std::vector< PDF::CharRange,std::allocator< PDF::CharRange > > :param char_ranges: an array of character ranges to be highlighted :rtype: :py:class:`Highlights` :return: a Highlights object containing the selected characters """ return _PDFNetPython.TextExtractor_GetHighlights(self, char_ranges)
[docs] def GetNumLines(self): r""" :rtype: int :return: The number of lines of text on the selected page. """ return _PDFNetPython.TextExtractor_GetNumLines(self)
[docs] def GetFirstLine(self): r""" :rtype: :py:class:`Line` :return: The first line of text on the selected page. Notes: To traverse the list of all text lines on the page use line.GetNextLine(). To traverse the list of all word on a given line use line.GetFirstWord(). """ return _PDFNetPython.TextExtractor_GetFirstLine(self)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.TextExtractor_Destroy(self)
# Register TextExtractor in _PDFNetPython: _PDFNetPython.TextExtractor_swigregister(TextExtractor)
[docs] class Style(object): r""" A class representing predominant text style associated with a given Line, a Word, or a Glyph. The class includes information about the font, font size, font styles, text color, etc. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def GetFont(self): r""" :rtype: :py:class:`Obj` :return: low-level PDF font object. A high level font object can be instantiated as follows: In C++: pdftron.PDF.Font f(style.GetFont()) In C#: pdftron.PDF.Font f = new pdftron.PDF.Font(style.GetFont()); """ return _PDFNetPython.Style_GetFont(self)
[docs] def GetFontName(self): r""" :rtype: string :return: the font name used to draw the selected text. """ return _PDFNetPython.Style_GetFontName(self)
[docs] def GetFontSize(self): r""" :rtype: double :return: The font size used to draw the selected text as it appears on the output page. Notes: Unlike the 'font size' in the graphics state (pdftron.PDF.GState) the returned font size accounts for the effects CTM, text matrix, and other graphics state attributes that can affect the appearance of text. """ return _PDFNetPython.Style_GetFontSize(self)
[docs] def GetWeight(self): r""" :rtype: int :return: The weight (thickness) component of the fully-qualified font name or font specifier. The possible values are 100, 200, 300, 400, 500, 600, 700, 800, or 900, where each number indicates a weight that is at least as dark as its predecessor. A value of 400 indicates a normal weight; 700 indicates bold. Note: The specific interpretation of these values varies from font to font. For example, 300 in one font may appear most similar to 500 in another. """ return _PDFNetPython.Style_GetWeight(self)
[docs] def IsItalic(self): r""" :rtype: boolean :return: true if glyphs have dominant vertical strokes that are slanted. Notes: the return value corresponds to the state of 'italic' flag in the 'Font Descriptor'. """ return _PDFNetPython.Style_IsItalic(self)
[docs] def IsSerif(self): r""" :rtype: boolean :return: true if glyphs have serifs, which are short strokes drawn at an angle on the top and bottom of glyph stems. Notes: the return value corresponds to the state of 'serif' flag in the 'Font Descriptor'. """ return _PDFNetPython.Style_IsSerif(self)
[docs] def GetColor(self): r""" :rtype: std::vector< int,std::allocator< int > > :return: text color in RGB color space. """ return _PDFNetPython.Style_GetColor(self)
def __eq__(self, s): return _PDFNetPython.Style___eq__(self, s) def __ne__(self, s): return _PDFNetPython.Style___ne__(self, s) def __init__(self, args): _PDFNetPython.Style_swiginit(self, _PDFNetPython.new_Style(args)) mp_style = property(_PDFNetPython.Style_mp_style_get, _PDFNetPython.Style_mp_style_set) __swig_destroy__ = _PDFNetPython.delete_Style
# Register Style in _PDFNetPython: _PDFNetPython.Style_swigregister(Style)
[docs] class Word(object): r""" TextExtractor::Word object represents a word on a PDF page. Each word contains a sequence of characters in one or more styles (see TextExtractor::Style). """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def GetNumGlyphs(self): r""" :rtype: int :return: The number of glyphs in this word. """ return _PDFNetPython.Word_GetNumGlyphs(self)
[docs] def GetBBox(self): r""" :param out_bbox: The bounding box for this word (in unrotated page coordinates). Notes: To account for the effect of page '/Rotate' attribute, transform all points using page.GetDefaultMatrix(). """ return _PDFNetPython.Word_GetBBox(self)
[docs] def GetQuad(self): r""" :param out_quad: The quadrilateral representing a tight bounding box for this word (in unrotated page coordinates). """ return _PDFNetPython.Word_GetQuad(self)
[docs] def GetGlyphQuad(self, glyph_idx): r""" :type glyph_idx: int :param glyph_idx: The index of a glyph in this word. :param out_quad: The quadrilateral representing a tight bounding box for a given glyph in the word (in unrotated page coordinates). """ return _PDFNetPython.Word_GetGlyphQuad(self, glyph_idx)
[docs] def GetCharStyle(self, char_idx): r""" :type char_idx: int :param char_idx: The index of a character in this word. :rtype: :py:class:`Style` :return: The style associated with a given character. """ return _PDFNetPython.Word_GetCharStyle(self, char_idx)
[docs] def GetStyle(self): r""" :rtype: :py:class:`Style` :return: predominant style for this word. """ return _PDFNetPython.Word_GetStyle(self)
[docs] def GetStringLen(self): r""" :rtype: int :return: the number of characters in this word. """ return _PDFNetPython.Word_GetStringLen(self)
[docs] def GetString(self): r""" :rtype: string :return: the content of this word represented as a Unicode string. """ return _PDFNetPython.Word_GetString(self)
[docs] def GetNextWord(self): r""" :rtype: :py:class:`Word` :return: the next word on the current line. """ return _PDFNetPython.Word_GetNextWord(self)
[docs] def GetCurrentNum(self): r""" :rtype: int :return: the index of this word of the current line. A word that starts the line will return 0, whereas the last word in the line will return (line.GetNumWords()-1). """ return _PDFNetPython.Word_GetCurrentNum(self)
[docs] def IsValid(self): r""" :rtype: boolean :return: true if this is a valid word, false otherwise. """ return _PDFNetPython.Word_IsValid(self)
def __eq__(self, arg2): return _PDFNetPython.Word___eq__(self, arg2) def __ne__(self, arg2): return _PDFNetPython.Word___ne__(self, arg2) def __init__(self, args): _PDFNetPython.Word_swiginit(self, _PDFNetPython.new_Word(args)) mp_word = property(_PDFNetPython.Word_mp_word_get, _PDFNetPython.Word_mp_word_set) __swig_destroy__ = _PDFNetPython.delete_Word
# Register Word in _PDFNetPython: _PDFNetPython.Word_swigregister(Word)
[docs] class Line(object): r""" TextExtractor::Line object represents a line of text on a PDF page. Each line consists of a sequence of words, and each words in one or more styles. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] def GetNumWords(self): r""" :rtype: int :return: The number of words in this line. """ return _PDFNetPython.Line_GetNumWords(self)
[docs] def IsSimpleLine(self): r""" :rtype: boolean :return: true is this line is not rotated (i.e. if the quadrilaterals returned by GetBBox() and GetQuad() coincide). """ return _PDFNetPython.Line_IsSimpleLine(self)
[docs] def GetBBox(self): r""" :param out_bbox: The bounding box for this line (in unrotated page coordinates). Notes: To account for the effect of page '/Rotate' attribute, transform all points using page.GetDefaultMatrix(). """ return _PDFNetPython.Line_GetBBox(self)
[docs] def GetQuad(self): r""" :rtype: std::vector< double,std::allocator< double > > :return: The quadrilateral representing a tight bounding box for this line (in unrotated page coordinates). """ return _PDFNetPython.Line_GetQuad(self)
[docs] def GetFirstWord(self): r""" :rtype: :py:class:`Word` :return: the first word in the line. Notes: To traverse the list of all words on this line use word.GetNextWord(). """ return _PDFNetPython.Line_GetFirstWord(self)
[docs] def GetWord(self, word_idx): r""" :rtype: :py:class:`Word` :return: the i-th word in this line. :type word_idx: int :param word_idx: A integer representing the index of the word to get. """ return _PDFNetPython.Line_GetWord(self, word_idx)
[docs] def GetNextLine(self): r""" :rtype: :py:class:`Line` :return: the next line on the page. """ return _PDFNetPython.Line_GetNextLine(self)
[docs] def GetCurrentNum(self): r""" :rtype: int :return: the index of this line of the current page. """ return _PDFNetPython.Line_GetCurrentNum(self)
[docs] def GetStyle(self): r""" :rtype: :py:class:`Style` :return: predominant style for this line. """ return _PDFNetPython.Line_GetStyle(self)
[docs] def GetParagraphID(self): r""" :rtype: int :return: The unique identifier for a paragraph or column that this line belongs to. This information can be used to identify which lines belong to which paragraphs. """ return _PDFNetPython.Line_GetParagraphID(self)
[docs] def GetFlowID(self): r""" :rtype: int :return: The unique identifier for a paragraph or column that this line belongs to. This information can be used to identify which lines/paragraphs belong to which flows. """ return _PDFNetPython.Line_GetFlowID(self)
[docs] def EndsWithHyphen(self): r""" :rtype: boolean :return: true is this line of text ends with a hyphen (i.e. '-'), false otherwise. """ return _PDFNetPython.Line_EndsWithHyphen(self)
[docs] def IsValid(self): r""" :rtype: boolean :return: true if this is a valid line, false otherwise. """ return _PDFNetPython.Line_IsValid(self)
def __eq__(self, arg2): return _PDFNetPython.Line___eq__(self, arg2) def __ne__(self, arg2): return _PDFNetPython.Line___ne__(self, arg2) def __init__(self, args): _PDFNetPython.Line_swiginit(self, _PDFNetPython.new_Line(args)) mp_line = property(_PDFNetPython.Line_mp_line_get, _PDFNetPython.Line_mp_line_set) __swig_destroy__ = _PDFNetPython.delete_Line
# Register Line in _PDFNetPython: _PDFNetPython.Line_swigregister(Line)
[docs] class SearchResult(object): r"""The result of running PDF::TextSearch::Run()""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __nonzero__(self): return _PDFNetPython.SearchResult___nonzero__(self) __bool__ = __nonzero__
[docs] def IsFound(self): r""" :rtype: boolean :return: true if a match was found. """ return _PDFNetPython.SearchResult_IsFound(self)
[docs] def IsDocEnd(self): r""" :rtype: boolean :return: true if finished searching the entire document. """ return _PDFNetPython.SearchResult_IsDocEnd(self)
[docs] def IsPageEnd(self): r""" :rtype: boolean :return: true if finished searching a page. """ return _PDFNetPython.SearchResult_IsPageEnd(self)
[docs] def GetPageNumber(self): r""" :rtype: int :return: the number of the page with the match. """ return _PDFNetPython.SearchResult_GetPageNumber(self)
[docs] def GetMatch(self): r""" :rtype: string :return: the string that matches the search pattern. """ return _PDFNetPython.SearchResult_GetMatch(self)
[docs] def GetAmbientString(self): r""" :rtype: string :return: the ambient string of the found string (computed only if 'e_ambient_string' is set). """ return _PDFNetPython.SearchResult_GetAmbientString(self)
[docs] def GetHighlights(self): r""" :rtype: :py:class:`Highlights` :return: The Highlights info associated with the match (computed only if 'e_highlight' is set). """ return _PDFNetPython.SearchResult_GetHighlights(self)
def __init__(self, args): _PDFNetPython.SearchResult_swiginit(self, _PDFNetPython.new_SearchResult(args)) __swig_destroy__ = _PDFNetPython.delete_SearchResult
# Register SearchResult in _PDFNetPython: _PDFNetPython.SearchResult_swigregister(SearchResult)
[docs] class TextSearch(object): r""" TextSearch searches through a PDF document for a user-given search pattern. The current implementation supports both verbatim search and the search using regular expressions, whose detailed syntax can be found at: http://www.boost.org/doc/libs/release/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html TextSearch also provides users with several useful search modes and extra information besides the found string that matches the pattern. TextSearch can either keep running until a matched string is found or be set to return periodically in order for the caller to perform any necessary updates (e.g., UI updates). It is also worth mentioning that the search modes can be changed on the fly while searching through a document. Possible use case scenarios for TextSearch include: - Guide users of a PDF viewer (e.g. implemented by PDFViewCtrl) to places where they are intersted in; - Find interested PDF documents which contain certain patterns; - Extract interested information (e.g., credit card numbers) from a set of files; - Extract Highlight information (refer to the Highlights class for details) from files for external use. Note: - Since hyphens ('-') are frequently used in PDF documents to concatenate the two broken pieces of a word at the end of a line, for example "TextSearch is powerful for finding patterns in PDF files; yes, it is really pow- erful." a search for "powerful" should return both instances. However, not all end-of-line hyphens are hyphens added to connect a broken word; some of them could be "real" hyphens. In addition, an input search pattern may also contain hyphens that complicate the situation. To tackle this problem, the following conventions are adopted: a)When in the verbatim search mode and the pattern contains no hyphen, a matching string is returned if it is exactly the same or it contains end-of-line or start-of-line hyphens. For example, as mentioned above, a search for "powerful" would return both instances. b)When in verbatim search mode and the pattern contains one or multiple hyphens, a matching string is returned only if the string matches the pattern exactly. For example, a search for "pow-erful" will only return the second instance, and a search for "power-ful" will return nothing. c)When searching using regular expressions, hyphens are not taken care implicitly. Users should take care of it themselves. For example, in order to find both the "powerful" instances, the input pattern can be "pow-{0,1}erful". A sample use case (in C++): .. code-block:: c++ //... Initialize PDFNet ... PDFDoc doc(filein); doc.InitSecurityHandler(); int page_num; char buf[32]; UString result_str, ambient_string; Highlights hlts; TextSearch txt_search; TextSearch::Mode mode = TextSearch::e_whole_word | TextSearch::e_page_stop; UString pattern( "joHn sMiTh" ); //PDFDoc doesn't allow simultaneous access from different threads. If this //document could be used from other threads (e.g., the rendering thread inside //PDFView/PDFViewCtrl, if used), it is good practice to lock it. //Notice: don't forget to call doc.Unlock() to avoid deadlock. doc.Lock(); txt_search.Begin( doc, pattern, mode ); while ( true ) { SearchResult result = code = txt_search.Run(page_num, result_str, ambient_string, hlts ); if ( code == TextSearch::e_found ) { result_str.ConvertToAscii(buf, 32, true); cout < "found one instance: " < char_buf < endl; } else { break; } } //unlock the document to avoid deadlock. doc.UnLock(); For a full sample, please take a look at the TextSearch sample project. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): r"""Constructor and destructor.""" _PDFNetPython.TextSearch_swiginit(self, _PDFNetPython.new_TextSearch()) __swig_destroy__ = _PDFNetPython.delete_TextSearch e_reg_expression = _PDFNetPython.TextSearch_e_reg_expression e_case_sensitive = _PDFNetPython.TextSearch_e_case_sensitive e_whole_word = _PDFNetPython.TextSearch_e_whole_word e_search_up = _PDFNetPython.TextSearch_e_search_up e_page_stop = _PDFNetPython.TextSearch_e_page_stop e_highlight = _PDFNetPython.TextSearch_e_highlight e_ambient_string = _PDFNetPython.TextSearch_e_ambient_string e_raw_text_search = _PDFNetPython.TextSearch_e_raw_text_search e_search_using_zorder = _PDFNetPython.TextSearch_e_search_using_zorder
[docs] def Begin(self, doc, pattern, mode, start_page=-1, end_page=-1): r""" Initialize for search process. This should be called before starting the actual search with method Run(). :type doc: :py:class:`PDFDoc` :param doc: the PDF document to search in. :type pattern: string :param pattern: the pattern to search for. When regular expression is used, it contains the expression, and in verbatim mode, it is the exact string to search for. :type mode: int :param mode: the mode of the search process. :type start_page: int :param start_page: the start page of the page range to search in. The default value is -1 indicating the range starts from the first page. :type end_page: int :param end_page: the end page of the page range to search in. The default value is -1 indicating the range ends at the last page. :rtype: boolean :return: true if the initialization has succeeded. """ return _PDFNetPython.TextSearch_Begin(self, doc, pattern, mode, start_page, end_page)
[docs] def Run(self): r""" Search the document and returns upon the following circumstances: a)Reached the end of the document; b)Reached the end of a page (if set to return by specifying mode 'e_page_stop' ); c)Found an instance matching the search pattern. Note that this method should be called in a loop in order to find all matching instances; in other words, the search is conducted in an incremental fashion. """ return _PDFNetPython.TextSearch_Run(self)
[docs] def SetPattern(self, pattern): r""" Set the current search pattern. Note that it is not necessary to call this method since the search pattern is already set when calling the Begin() method. This method is provided for users to change the search pattern while searching through a document. :type pattern: string :param pattern: the search pattern to set. :rtype: boolean :return: true if the setting has succeeded. """ return _PDFNetPython.TextSearch_SetPattern(self, pattern)
[docs] def GetMode(self): r""" Retrieve the current search mode. :rtype: int :return: the current search mode. """ return _PDFNetPython.TextSearch_GetMode(self)
[docs] def SetMode(self, mode): r""" Set the current search mode. For example, the following code turns on the regular expressions: TextSearch ts; ... TextSearch::Mode mode = ts.GetMode(); mode |= TextSearch::e_reg_expression; ts.SetMode(mode); ... :type mode: int :param mode: the search mode to set. """ return _PDFNetPython.TextSearch_SetMode(self, mode)
[docs] def SetRightToLeftLanguage(self, flag): r""" Tells TextSearch that language is from right to left. :type flag: boolean :param flag: Set to true if the language is right to left. """ return _PDFNetPython.TextSearch_SetRightToLeftLanguage(self, flag)
[docs] def GetCurrentPage(self): r""" Retrieve the number of the current page that is searched in. If the returned value is -1, it indicates the search process has not been initialized (e.g., Begin() is not called yet); if the returned value is 0, it indicates the search process has finished, and if the returned value is positive, it is a valid page number. :rtype: int :return: the current page number. """ return _PDFNetPython.TextSearch_GetCurrentPage(self)
[docs] def SetOCGContext(self, context): r""" Sets the Optional Content Group (OCG) context that should be used when processing the document. This function can be used to change the current OCG context. Optional content (such as PDF layers) will be selectively processed based on the states of optional content groups in the given context. :type context: :py:class:`Context` :param context: Optional Content Group (OCG) context, or NULL if TextSearch should process all content on the page. """ return _PDFNetPython.TextSearch_SetOCGContext(self, context)
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.TextSearch_Destroy(self)
[docs] def SetAmbientLettersBefore(self, ambient_letters_before): r""" Sets the maximum number of ambient string letters before the search term (default: 30). This should be called before starting the actual search with method Run(). :type ambient_letters_before: int :param ambient_letters_before: -- maximum number of letters. """ return _PDFNetPython.TextSearch_SetAmbientLettersBefore(self, ambient_letters_before)
[docs] def SetAmbientLettersAfter(self, ambient_letters_after): r""" Sets the maximum number of ambient string letters after the search term (default: 70). This should be called before starting the actual search with method Run(). :type ambient_letters_after: int :param ambient_letters_after: -- maximum number of letters. """ return _PDFNetPython.TextSearch_SetAmbientLettersAfter(self, ambient_letters_after)
[docs] def SetAmbientWordsBefore(self, ambient_words_before): r""" Sets the maximum number of ambient string words before the search term (default: 1). This should be called before starting the actual search with method Run(). :type ambient_words_before: int :param ambient_words_before: -- maximum number of words. """ return _PDFNetPython.TextSearch_SetAmbientWordsBefore(self, ambient_words_before)
[docs] def SetAmbientWordsAfter(self, ambient_words_after): r""" Sets the maximum number of ambient string words after the search term (default: 10). This should be called before starting the actual search with method Run(). :type ambient_words_after: int :param ambient_words_after: -- maximum number of words. """ return _PDFNetPython.TextSearch_SetAmbientWordsAfter(self, ambient_words_after)
mp_textsearch = property(_PDFNetPython.TextSearch_mp_textsearch_get, _PDFNetPython.TextSearch_mp_textsearch_set)
# Register TextSearch in _PDFNetPython: _PDFNetPython.TextSearch_swigregister(TextSearch)
[docs] class Redactor(object): r""" PDF Redactor is a separately licensable Add-on that offers options to remove (not just covering or obscuring) content within a region of PDF. With printed pages, redaction involves blacking-out or cutting-out areas of the printed page. With electronic documents that use formats such as PDF, redaction typically involves removing sensitive content within documents for safe distribution to courts, patent and government institutions, the media, customers, vendors or any other audience with restricted access to the content. The redaction process in PDFNet consists of two steps: a) Content identification: A user applies redact annotations that specify the pieces or regions of content that should be removed. The content for redaction can be identified either interactively (e.g. using 'pdftron.PDF.PDFViewCtrl' as shown in PDFView sample) or programmatically (e.g. using 'pdftron.PDF.TextSearch' or 'pdftron.PDF.TextExtractor'). Up until the next step is performed, the user can see, move and redefine these annotations. b) Content removal: Using 'pdftron.PDF.Redactor.Redact()' the user instructs PDFNet to apply the redact regions, after which the content in the area specified by the redact annotations is removed. The redaction function includes number of options to control the style of the redaction overlay (including color, text, font, border, transparency, etc.). PDFTron Redactor makes sure that if a portion of an image, text, or vector graphics is contained in a redaction region, that portion of the image or path data is destroyed and is not simply hidden with clipping or image masks. PDFNet API can also be used to review and remove metadata and other content that can exist in a PDF document, including XML Forms Architecture (XFA) content and Extensible Metadata Platform (XMP) content. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr
[docs] @staticmethod def Redact(args): return _PDFNetPython.Redactor_Redact(args)
def __init__(self): _PDFNetPython.Redactor_swiginit(self, _PDFNetPython.new_Redactor()) __swig_destroy__ = _PDFNetPython.delete_Redactor
# Register Redactor in _PDFNetPython: _PDFNetPython.Redactor_swigregister(Redactor)
[docs] def Redactor_Redact(args): return _PDFNetPython.Redactor_Redact(args)
[docs] class Redaction(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr __swig_destroy__ = _PDFNetPython.delete_Redaction
[docs] def Destroy(self): r"""Frees the native memory of the object.""" return _PDFNetPython.Redaction_Destroy(self)
def __init__(self, args): _PDFNetPython.Redaction_swiginit(self, _PDFNetPython.new_Redaction(args)) mp_imp = property(_PDFNetPython.Redaction_mp_imp_get, _PDFNetPython.Redaction_mp_imp_set)
# Register Redaction in _PDFNetPython: _PDFNetPython.Redaction_swigregister(Redaction)
[docs] class Appearance(object): r"""Class used to customize the appearance of the optional redaction overlay.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") __repr__ = _swig_repr def __init__(self): _PDFNetPython.Appearance_swiginit(self, _PDFNetPython.new_Appearance()) RedactionOverlay = property(_PDFNetPython.Appearance_RedactionOverlay_get, _PDFNetPython.Appearance_RedactionOverlay_set, doc=r""" If RedactionOverlay is set to true, Redactor will draw an overlay covering all redacted regions. The rest of properties in the Appearance class defines visual properties of the overlay. If false the overlay region will not be drawn. """) PositiveOverlayColor = property(_PDFNetPython.Appearance_PositiveOverlayColor_get, _PDFNetPython.Appearance_PositiveOverlayColor_set, doc=r"""PositiveOverlayColor defines the overlay background color in RGB color space for positive redactions.""") NegativeOverlayColor = property(_PDFNetPython.Appearance_NegativeOverlayColor_get, _PDFNetPython.Appearance_NegativeOverlayColor_set, doc=r"""NegativeOverlayColor defines the overlay background color in RGB color space for negative redactions.""") Border = property(_PDFNetPython.Appearance_Border_get, _PDFNetPython.Appearance_Border_set, doc=r"""Border specifies if the overlay will be surrounded by a border.""") UseOverlayText = property(_PDFNetPython.Appearance_UseOverlayText_get, _PDFNetPython.Appearance_UseOverlayText_set, doc=r""" Specifies if the text (e.g. "Redacted" etc.) should be placed on top of the overlay. The remaining properties relate to the positioning, and styling of the overlay text. """) TextFont = property(_PDFNetPython.Appearance_TextFont_get, _PDFNetPython.Appearance_TextFont_set, doc=r"""Specifies the font used to represent the text in the overlay.""") MinFontSize = property(_PDFNetPython.Appearance_MinFontSize_get, _PDFNetPython.Appearance_MinFontSize_set, doc=r"""Specifies the minimum and maximum font size used to represent the text in the overlay.""") MaxFontSize = property(_PDFNetPython.Appearance_MaxFontSize_get, _PDFNetPython.Appearance_MaxFontSize_set) TextColor = property(_PDFNetPython.Appearance_TextColor_get, _PDFNetPython.Appearance_TextColor_set, doc=r"""Specifies the color used to paint the text in the overlay (in RGB).""") HorizTextAlignment = property(_PDFNetPython.Appearance_HorizTextAlignment_get, _PDFNetPython.Appearance_HorizTextAlignment_set, doc=r""" Specifies the horizontal text alignment in the overlay: align<0 -> text will be left aligned. align==0 -> text will be center aligned. align>0 -> text will be right aligned. """) VertTextAlignment = property(_PDFNetPython.Appearance_VertTextAlignment_get, _PDFNetPython.Appearance_VertTextAlignment_set, doc=r""" Specifies the vertical text alignment in the overlay: align<0 -> text will be top aligned. align==0 -> text will be center aligned. align>0 -> text will be bottom aligned. """) ShowRedactedContentRegions = property(_PDFNetPython.Appearance_ShowRedactedContentRegions_get, _PDFNetPython.Appearance_ShowRedactedContentRegions_set, doc=r""" Specifies whether an overlay should be drawn in place of the redacted content. This option can be used to indicate the areas where the content was removed from without revealing the content itself. Default value is False. Notes: The overlay region used RedactedContentColor as a fill color. """) RedactedContentColor = property(_PDFNetPython.Appearance_RedactedContentColor_get, _PDFNetPython.Appearance_RedactedContentColor_set, doc=r""" Specifies the color used to paint the regions where content was removed. Only useful when ShowRedactedContentRegions == true. Default value is Gray color. """) __swig_destroy__ = _PDFNetPython.delete_Appearance
# Register Appearance in _PDFNetPython: _PDFNetPython.Appearance_swigregister(Appearance)