Example #1
0
func (pdf *PDF) GetLastError() error {
	defer C.HPDF_ResetError(pdf.doc)
	if err := C.HPDF_GetError(pdf.doc); err != C.HPDF_OK {
		detail := C.HPDF_GetErrorDetail(pdf.doc)
		return NewError(err, detail)
	}
	return nil
}
Example #2
0
func New() (*PDF, error) {
	doc := C.HPDF_New(nil, nil)

	if err := C.HPDF_GetError(doc); err != C.HPDF_OK {
		return nil, NewError(err, 0)
	}

	pdf := &PDF{doc}
	runtime.SetFinalizer(pdf, finalizePDF)
	return pdf, nil
}