Beispiel #1
0
func (page *Page) DrawImage(image *Image, x, y, width, height float32) error {
	C.HPDF_Page_DrawImage(
		page.page, image.image,
		C.HPDF_REAL(x), C.HPDF_REAL(y), C.HPDF_REAL(width), C.HPDF_REAL(height),
	)
	return page.pdf.GetLastError()
}
Beispiel #2
0
func (destination *Destination) SetFitR(left, bottom, right, top float32) error {
	C.HPDF_Destination_SetFitR(
		destination.destination,
		C.HPDF_REAL(left), C.HPDF_REAL(bottom), C.HPDF_REAL(right), C.HPDF_REAL(top),
	)

	return destination.page.pdf.GetLastError()
}
Beispiel #3
0
func (destination *Destination) SetXYZ(left, top, zoom float32) error {
	C.HPDF_Destination_SetXYZ(
		destination.destination,
		C.HPDF_REAL(left), C.HPDF_REAL(top), C.HPDF_REAL(zoom),
	)

	return destination.page.pdf.GetLastError()
}
Beispiel #4
0
func (rect *Rect) toHpdf() C.HPDF_Rect {
	var hpdfRect C.HPDF_Rect

	hpdfRect.left = C.HPDF_REAL(rect.Left)
	hpdfRect.bottom = C.HPDF_REAL(rect.Bottom)
	hpdfRect.right = C.HPDF_REAL(rect.Right)
	hpdfRect.top = C.HPDF_REAL(rect.Top)

	return hpdfRect
}
Beispiel #5
0
func (page *Page) SetRGBFill(r float32, g float32, b float32) error {
	C.HPDF_Page_SetRGBFill(
		page.page,
		C.HPDF_REAL(r),
		C.HPDF_REAL(g),
		C.HPDF_REAL(b),
	)

	return page.pdf.GetLastError()
}
Beispiel #6
0
func (annotation *LinkAnnotation) SetBorderStyle(
	width float32, dashOn, dashOff uint16,
) error {
	C.HPDF_LinkAnnot_SetBorderStyle(
		annotation.annotation,
		C.HPDF_REAL(width), C.HPDF_UINT16(dashOn), C.HPDF_UINT16(dashOff),
	)
	return annotation.pdf.GetLastError()
}
Beispiel #7
0
func (annotation *Annotation) SetBorderStyle(
	subtype BSSubtype, width float32, dashOn, dashOff, dashPhase uint16,
) error {
	C.HPDF_Annotation_SetBorderStyle(
		annotation.annotation,
		C.HPDF_BSSubtype(subtype),
		C.HPDF_REAL(width),
		C.HPDF_UINT16(dashOn), C.HPDF_UINT16(dashOff), C.HPDF_UINT16(dashPhase),
	)
	return annotation.pdf.GetLastError()
}
Beispiel #8
0
func (page *Page) MeasureText(text string, width float32, wordwrap bool) (float32, error) {
	ctext := C.CString(text)
	defer C.free(unsafe.Pointer(ctext))

	var cwordwrap C.HPDF_BOOL = C.HPDF_FALSE
	if wordwrap {
		cwordwrap = C.HPDF_TRUE
	}

	var realWidth float32

	C.HPDF_Page_MeasureText(page.page, ctext, C.HPDF_REAL(width), cwordwrap, (*C.HPDF_REAL)(&realWidth))
	return realWidth, page.pdf.GetLastError()
}
Beispiel #9
0
func (page *Page) SetHeight(height float32) error {
	C.HPDF_Page_SetHeight(page.page, C.HPDF_REAL(height))
	return page.pdf.GetLastError()
}
Beispiel #10
0
func (page *Page) SetWidth(width float32) error {
	C.HPDF_Page_SetWidth(page.page, C.HPDF_REAL(width))
	return page.pdf.GetLastError()
}
Beispiel #11
0
func (page *Page) SetFontAndSize(font *Font, size float32) error {
	C.HPDF_Page_SetFontAndSize(
		page.page, font.font, C.HPDF_REAL(size),
	)
	return page.pdf.GetLastError()
}
Beispiel #12
0
func (destination *Destination) SetFitBV(left float32) error {
	C.HPDF_Destination_SetFitBV(destination.destination, C.HPDF_REAL(left))

	return destination.page.pdf.GetLastError()
}
Beispiel #13
0
func (destination *Destination) SetFitBH(top float32) error {
	C.HPDF_Destination_SetFitBH(destination.destination, C.HPDF_REAL(top))

	return destination.page.pdf.GetLastError()
}