Example #1
0
func (pdf *PDF) GetInfoAttr(infoType InfoType) (string, error) {
	cvalue := C.HPDF_GetInfoAttr(pdf.doc, C.HPDF_InfoType(infoType))

	if cvalue != nil {
		defer C.free(unsafe.Pointer(cvalue))
		return C.GoString(cvalue), nil
	} else {
		return "", pdf.GetLastError()
	}
}
Example #2
0
func (pdf *PDF) SetInfoDateAttr(infoType InfoType, datetime time.Time) error {
	cdate := timeToHPDFDate(datetime)
	C.HPDF_SetInfoDateAttr(pdf.doc, C.HPDF_InfoType(infoType), cdate)
	return pdf.GetLastError()
}
Example #3
0
func (pdf *PDF) SetInfoAttr(infoType InfoType, value string) error {
	cvalue := C.CString(value)
	defer C.free(unsafe.Pointer(cvalue))
	C.HPDF_SetInfoAttr(pdf.doc, C.HPDF_InfoType(infoType), cvalue)
	return pdf.GetLastError()
}