Documentation ¶
Overview ¶
Package qpdf provides simple Go bindings for qpdf C / C++ API. Due to the limitations of the C API, it is only capable of doing basic transformations on PDF files; mostly linearization. Refer to examples/ for usage information. For more information: https://github.com/qpdf/qpdf/
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type QPDF ¶
type QPDF struct {
// contains filtered or unexported fields
}
QPDF contains the qpdf_data object. It should never initialised manually (i.e. new(QPDF) or QPDF{}). It should be initialised using the Init method.
func Init ¶
func Init() *QPDF
Init is an implementation of qpdf_init. It returns a QPDF object containing an initialised qpdf_data pointer. This method must be called before any other QPDF operations.
func (*QPDF) GC ¶
func (q *QPDF) GC()
GC is an implementation of qpdf_cleanup. All dynamic memory - except the qpdf_data object - is managed by the qpdf library. This method may be used to free up the dynamically allocated qpdf_data pointer. After calling this method, any pointers to the qpdf_data object will no longer be valid.
func (*QPDF) HasError ¶
HasError is an implementation of qpdf_has_error. It checks if there are any outstanding / unhandled errors in qpdf_data, and if so, it will return true.
func (*QPDF) LastError ¶
LastError is an implementation of qpdf_get_error, and qpdf_get_error_full_text. It attempts to get the last error condition, and if there is an error, it will pass the condition to qpdf_get_error_full_text to retrieve the full / user-friendly error message from the qpdf library. Upon calling this method, HasError will return false until the next error condition occurs (i.e. it drains the errors).
func (*QPDF) Linearize ¶
func (q *QPDF) Linearize()
Linearize is an implementation of qpdf_set_linearization. It does not actually linearize the qpdf_data object immediately. Instead, enables linearization mode. The actual transformation occurs during qpdf_write.
func (*QPDF) Open ¶
Open is an implementation of qpdf_read. It reads, and parses the source PDF file into qpdf_data. Methods to manipulate the data can be called after the file is opened with this method.