Ejemplo n.º 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)}
}
Ejemplo n.º 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)
}
Ejemplo n.º 3
0
func (self PDFVersion) String() string {
	return C.GoString(C.cairo_pdf_version_to_string(C.cairo_pdf_version_t(self)))
}
Ejemplo n.º 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()
}