예제 #1
0
파일: graphics.go 프로젝트: rosylilly/hpdf
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()
}
예제 #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()
}
예제 #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()
}
예제 #4
0
파일: rect.go 프로젝트: rosylilly/hpdf
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
}
예제 #5
0
파일: graphics.go 프로젝트: rosylilly/hpdf
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()
}
예제 #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()
}
예제 #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()
}
예제 #8
0
파일: page.go 프로젝트: rosylilly/hpdf
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()
}
예제 #9
0
파일: page.go 프로젝트: rosylilly/hpdf
func (page *Page) SetHeight(height float32) error {
	C.HPDF_Page_SetHeight(page.page, C.HPDF_REAL(height))
	return page.pdf.GetLastError()
}
예제 #10
0
파일: page.go 프로젝트: rosylilly/hpdf
func (page *Page) SetWidth(width float32) error {
	C.HPDF_Page_SetWidth(page.page, C.HPDF_REAL(width))
	return page.pdf.GetLastError()
}
예제 #11
0
파일: graphics.go 프로젝트: rosylilly/hpdf
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()
}
예제 #12
0
func (destination *Destination) SetFitBV(left float32) error {
	C.HPDF_Destination_SetFitBV(destination.destination, C.HPDF_REAL(left))

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

	return destination.page.pdf.GetLastError()
}