Example #1
0
func NewPDFSurface(filename string, widthInPoints, heightInPoints float64, version PDFVersion) *Surface {
	cs := C.CString(filename)
	defer C.free(unsafe.Pointer(cs))
	s := C.cairo_pdf_surface_create(cs, C.double(widthInPoints), C.double(heightInPoints))
	C.cairo_pdf_surface_restrict_to_version(s, C.cairo_pdf_version_t(version))
	return &Surface{surface: s, context: C.cairo_create(s)}
}
Example #2
0
func (p version) String() string {
	v := C.cairo_pdf_version_to_string(C.cairo_pdf_version_t(p))
	if v == nil {
		return "unknown PDF version"
	}
	return C.GoString(v)
}
Example #3
0
func (self PDFVersion) String() string {
	return C.GoString(C.cairo_pdf_version_to_string(C.cairo_pdf_version_t(self)))
}
Example #4
0
//RestrictTo restricts the generated PDF to the specified verison.
//
//This method should only be called before any drawing operations have been
//performed on this surface.
//
//Originally cairo_pdf_surface_restrict_to_version.
func (s Surface) RestrictTo(v version) error {
	C.cairo_pdf_surface_restrict_to_version(s.XtensionRaw(), C.cairo_pdf_version_t(v))
	return s.Err()
}