hpdf

package module
v0.0.0-...-0b94ebb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2017 License: MIT Imports: 7 Imported by: 2

README

# hpdf

[![Build Status](https://img.shields.io/circleci/project/github/rosylilly/hpdf.svg)](https://circleci.com/gh/rosylilly/hpdf)
[![Coverage Status](https://coveralls.io/repos/github/rosylilly/hpdf/badge.svg?branch=master)](https://coveralls.io/github/rosylilly/hpdf?branch=master)

a [libharu](http://www.libharu.org/) binding for golang

Copyright 2013 (c) Sho Kusano

__WIP__: [Check supported APIs](https://github.com/rosylilly/hpdf/issues/4)

## Install

A hpdf requires libharu's shared-libary. please install libharu before install hpdf.

```shell
$ brew install libharu
```

(in Mac OS X)

Install hpdf by github

```shell
$ go install github.com/rosylilly/hpdf
```

NOTE: Set env `CC=GCC-4.2` in Mac OS X and go v1.1.2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorMessages = map[ErrorCode]string{
	ERR_ARRAY_COUNT_ERR:              "Internal error. Data consistency was lost",
	ERR_ARRAY_ITEM_NOT_FOUND:         "Internal error. Data consistency was lost",
	ERR_ARRAY_ITEM_UNEXPECTED_TYPE:   "Internal error. Data consistency was lost",
	ERR_BINARY_LENGTH_ERR:            "Data length > HPDF_LIMIT_MAX_STRING_LEN",
	ERR_CANNOT_GET_PALLET:            "Cannot get pallet data from PNG image",
	ERR_DICT_COUNT_ERR:               "Dictionary elements > HPDF_LIMIT_MAX_DICT_ELEMENT",
	ERR_DICT_ITEM_NOT_FOUND:          "Internal error. Data consistency was lost",
	ERR_DICT_ITEM_UNEXPECTED_TYPE:    "Internal error. Data consistency was lost",
	ERR_DICT_STREAM_LENGTH_NOT_FOUND: "Internal error. Data consistency was lost",
	ERR_DOC_ENCRYPTDICT_NOT_FOUND:    "HPDF_SetEncryptMode() or HPDF_SetPermission() called before password set",
	ERR_DOC_INVALID_OBJECT:           "Internal error. Data consistency was lost",
	ERR_DUPLICATE_REGISTRATION:       "Tried to re-register a registered font",
	ERR_EXCEED_JWW_CODE_NUM_LIMIT:    "Cannot register a character to the Japanese word wrap characters list",
	ERR_ENCRYPT_INVALID_PASSWORD:     "Tried to set the owner password to NULL or Owner and user password are the same",
	ERR_ERR_UNKNOWN_CLASS:            "Internal error. Data consistency was lost",
	ERR_EXCEED_GSTATE_LIMIT:          "Stack depth > HPDF_LIMIT_MAX_GSTATE",
	ERR_FAILD_TO_ALLOC_MEM:           "Memory allocation failed",
	ERR_FILE_IO_ERROR:                "File processing failed. (Detailed code is set.)",
	ERR_FILE_OPEN_ERROR:              "Cannot open a file. (Detailed code is set.)",
	ERR_FONT_EXISTS:                  "Tried to load a font that has been registered",
	ERR_FONT_INVALID_WIDTHS_TABLE:    "Font-file format is invalid or Internal error. Data consistency was lost",
	ERR_INVALID_AFM_HEADER:           "Cannot recognize header of afm file",
	ERR_INVALID_ANNOTATION:           "Specified annotation handle is invalid",
	ERR_INVALID_BIT_PER_COMPONENT:    "Bit-per-component of a image which was set as mask-image is invalid",
	ERR_INVALID_CHAR_MATRICS_DATA:    "Cannot recognize char-matrics-data of afm file",
	ERR_INVALID_COLOR_SPACE:          "Invalid color_space parameter of HPDF_LoadRawImage, Color-space of a image which was set as mask-image is invalid or Invoked function invalid in present color-space",
	ERR_INVALID_COMPRESSION_MODE:     "Invalid value set when invoking HPDF_SetCommpressionMode()",
	ERR_INVALID_DATE_TIME:            "An invalid date-time value was set",
	ERR_INVALID_DESTINATION:          "An invalid destination handle was set",
	ERR_INVALID_DOCUMENT:             "An invalid document handle was set",
	ERR_INVALID_DOCUMENT_STATE:       "Function invalid in the present state was invoked",
	ERR_INVALID_ENCODER:              "An invalid encoder handle was set",
	ERR_INVALID_ENCODER_TYPE:         "Combination between font and encoder is wrong",
	ERR_INVALID_ENCODING_NAME:        "An Invalid encoding name is specified",
	ERR_INVALID_ENCRYPT_KEY_LEN:      "Encryption key length is invalid",
	ERR_INVALID_FONTDEF_DATA:         "An invalid font handle was set or Unsupported font format",
	ERR_INVALID_FONTDEF_TYPE:         "Internal error. Data consistency was lost",
	ERR_INVALID_FONT_NAME:            "Font with the specified name is not found",
	ERR_INVALID_IMAGE:                "Unsupported image format",
	ERR_INVALID_JPEG_DATA:            "Unsupported image format",
	ERR_INVALID_N_DATA:               "Cannot read a postscript-name from an afm file",
	ERR_INVALID_OBJECT:               "An invalid object is set or Internal error. Data consistency was lost",
	ERR_INVALID_OBJ_ID:               "Internal error. Data consistency was lost",
	ERR_INVALID_OPERATION:            "Invoked HPDF_Image_SetColorMask() against the image-object which was set a mask-image",
	ERR_INVALID_OUTLINE:              "An invalid outline-handle was specified",
	ERR_INVALID_PAGE:                 "An invalid page-handle was specified",
	ERR_INVALID_PAGES:                "An invalid pages-handle was specified. (internal error)",
	ERR_INVALID_PARAMETER:            "An invalid value is set",
	ERR_INVALID_PNG_IMAGE:            "Invalid PNG image format",
	ERR_INVALID_STREAM:               "Internal error. Data consistency was lost",
	ERR_MISSING_FILE_NAME_ENTRY:      "Internal error. \"_FILE_NAME\" entry for delayed loading is missing",
	ERR_INVALID_TTC_FILE:             "Invalid .TTC file format",
	ERR_INVALID_TTC_INDEX:            "Index parameter > number of included fonts",
	ERR_INVALID_WX_DATA:              "Cannot read a width-data from an afm file",
	ERR_ITEM_NOT_FOUND:               "Internal error. Data consistency was lost",
	ERR_LIBPNG_ERROR:                 "Error returned from PNGLIB while loading image",
	ERR_NAME_INVALID_VALUE:           "Internal error. Data consistency was lost",
	ERR_NAME_OUT_OF_RANGE:            "Internal error. Data consistency was lost",
	ERR_PAGES_MISSING_KIDS_ENTRY:     "Internal error. Data consistency was lost",
	ERR_PAGE_CANNOT_FIND_OBJECT:      "Internal error. Data consistency was lost",
	ERR_PAGE_CANNOT_GET_ROOT_PAGES:   "Internal error. Data consistency was lost",
	ERR_PAGE_CANNOT_RESTORE_GSTATE:   "There are no graphics-states to be restored",
	ERR_PAGE_CANNOT_SET_PARENT:       "Internal error. Data consistency was lost",
	ERR_PAGE_FONT_NOT_FOUND:          "The current font is not set",
	ERR_PAGE_INVALID_FONT:            "An invalid font-handle was specified",
	ERR_PAGE_INVALID_FONT_SIZE:       "An invalid font-size was set",
	ERR_PAGE_INVALID_GMODE:           "See Graphics mode",
	ERR_PAGE_INVALID_INDEX:           "Internal error. Data consistency was lost",
	ERR_PAGE_INVALID_ROTATE_VALUE:    "Specified value is not multiple of 90",
	ERR_PAGE_INVALID_SIZE:            "An invalid page-size was set",
	ERR_PAGE_INVALID_XOBJECT:         "An invalid image-handle was set",
	ERR_PAGE_OUT_OF_RANGE:            "The specified value is out of range",
	ERR_REAL_OUT_OF_RANGE:            "The specified value is out of range",
	ERR_STREAM_EOF:                   "Unexpected EOF marker was detected",
	ERR_STREAM_READLN_CONTINUE:       "Internal error. Data consistency was lost",
	ERR_STRING_OUT_OF_RANGE:          "The length of the text is too long",
	ERR_THIS_FUNC_WAS_SKIPPED:        "Function not executed because of other errors",
	ERR_TTF_CANNOT_EMBEDDING_FONT:    "Font cannot be embedded. (license restriction)",
	ERR_TTF_INVALID_CMAP:             "Unsupported ttf format. (cannot find unicode cmap)",
	ERR_TTF_INVALID_FOMAT:            "Unsupported ttf format",
	ERR_TTF_MISSING_TABLE:            "Unsupported ttf format. (cannot find a necessary table)",
	ERR_UNSUPPORTED_FONT_TYPE:        "Internal error. Data consistency was lost",
	ERR_UNSUPPORTED_FUNC:             "Library not configured to use PNGLIB or Internal error. Data consistency was lost",
	ERR_UNSUPPORTED_JPEG_FORMAT:      "Unsupported JPEG format",
	ERR_UNSUPPORTED_TYPE1_FONT:       "Failed to parse .PFB file",
	ERR_XREF_COUNT_ERR:               "Internal error. Data consistency was lost",
	ERR_ZLIB_ERROR:                   "Error while executing ZLIB function",
	ERR_INVALID_PAGE_INDEX:           "An invalid page index was passed",
	ERR_INVALID_URI:                  "An invalid URI was set",
	ERR_ANNOT_INVALID_ICON:           "An invalid icon was set",
	ERR_ANNOT_INVALID_BORDER_STYLE:   "An invalid border-style was set",
	ERR_PAGE_INVALID_DIRECTION:       "An invalid page-direction was set",
	ERR_INVALID_FONT:                 "An invalid font-handle was specified",
}

Functions

func Version

func Version() string

Types

type AnnotHighlightMode

type AnnotHighlightMode int

type AnnotIcon

type AnnotIcon int
const (
	ANNOT_ICON_COMMENT       AnnotIcon = C.HPDF_ANNOT_ICON_COMMENT
	ANNOT_ICON_KEY           AnnotIcon = C.HPDF_ANNOT_ICON_KEY
	ANNOT_ICON_NOTE          AnnotIcon = C.HPDF_ANNOT_ICON_NOTE
	ANNOT_ICON_HELP          AnnotIcon = C.HPDF_ANNOT_ICON_HELP
	ANNOT_ICON_NEW_PARAGRAPH AnnotIcon = C.HPDF_ANNOT_ICON_NEW_PARAGRAPH
	ANNOT_ICON_PARAGRAPH     AnnotIcon = C.HPDF_ANNOT_ICON_PARAGRAPH
	ANNOT_ICON_INSERT        AnnotIcon = C.HPDF_ANNOT_ICON_INSERT
)

type Annotation

type Annotation struct {
	// contains filtered or unexported fields
}

func (*Annotation) SetBorderStyle

func (annotation *Annotation) SetBorderStyle(
	subtype BSSubtype, width float32, dashOn, dashOff, dashPhase uint16,
) error

type BSSubtype

type BSSubtype int
const (
	BS_SOLID      BSSubtype = C.HPDF_BS_SOLID
	BS_DASHED     BSSubtype = C.HPDF_BS_DASHED
	BS_BEVELED    BSSubtype = C.HPDF_BS_BEVELED
	BS_INSET      BSSubtype = C.HPDF_BS_INSET
	BS_UNDERLINED BSSubtype = C.HPDF_BS_UNDERLINED
)

type Box

type Box struct {
	Left   float32
	Bottom float32
	Right  float32
	Top    float32
}

type ByteType

type ByteType int
const (
	BYTE_TYPE_SINGLE  ByteType = C.HPDF_BYTE_TYPE_SINGLE
	BYTE_TYPE_LEAD    ByteType = C.HPDF_BYTE_TYPE_LEAD
	BYTE_TYPE_TRIAL   ByteType = C.HPDF_BYTE_TYPE_TRIAL
	BYTE_TYPE_UNKNOWN ByteType = C.HPDF_BYTE_TYPE_UNKNOWN
)

type CMYKColor

type CMYKColor struct {
	C float32
	M float32
	Y float32
	K float32
}

type ColorSpace

type ColorSpace int
const (
	CS_DEVICE_GRAY ColorSpace = C.HPDF_CS_DEVICE_GRAY
	CS_DEVICE_RGB  ColorSpace = C.HPDF_CS_DEVICE_RGB
	CS_DEVICE_CMYK ColorSpace = C.HPDF_CS_DEVICE_CMYK
	CS_CAL_GRAY    ColorSpace = C.HPDF_CS_CAL_GRAY
	CS_CAL_RGB     ColorSpace = C.HPDF_CS_CAL_RGB
	CS_LAB         ColorSpace = C.HPDF_CS_LAB
	CS_ICC_BASED   ColorSpace = C.HPDF_CS_ICC_BASED
	CS_SEPARATION  ColorSpace = C.HPDF_CS_SEPARATION
	CS_DEVICE_N    ColorSpace = C.HPDF_CS_DEVICE_N
	CS_INDEXED     ColorSpace = C.HPDF_CS_INDEXED
	CS_PATTERN     ColorSpace = C.HPDF_CS_PATTERN
	CS_EOF         ColorSpace = C.HPDF_CS_EOF
	CS_UNKNOWN     ColorSpace = -100
)

type CompressionMode

type CompressionMode uint32

type DashMode

type DashMode struct {
	Ptn    [8]uint16
	NumPtn uint
	Phase  uint
}

type Destination

type Destination struct {
	// contains filtered or unexported fields
}

func (*Destination) SetFit

func (destination *Destination) SetFit() error

func (*Destination) SetFitB

func (destination *Destination) SetFitB() error

func (*Destination) SetFitBH

func (destination *Destination) SetFitBH(top float32) error

func (*Destination) SetFitBV

func (destination *Destination) SetFitBV(left float32) error

func (*Destination) SetFitH

func (destination *Destination) SetFitH(top float32) error

func (*Destination) SetFitR

func (destination *Destination) SetFitR(left, bottom, right, top float32) error

func (*Destination) SetFitV

func (destination *Destination) SetFitV(left float32) error

func (*Destination) SetXYZ

func (destination *Destination) SetXYZ(left, top, zoom float32) error

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func (*Encoder) GetByteType

func (encoder *Encoder) GetByteType(text string, index uint) ByteType

func (*Encoder) GetType

func (encoder *Encoder) GetType() EncoderType

func (*Encoder) GetUnicode

func (encoder *Encoder) GetUnicode(code uint16) rune

func (*Encoder) GetWritingMode

func (encoder *Encoder) GetWritingMode() WritingMode

type EncoderType

type EncoderType int
const (
	ENCODER_TYPE_SINGLE_BYTE   EncoderType = C.HPDF_ENCODER_TYPE_SINGLE_BYTE
	ENCODER_TYPE_DOUBLE_BYTE   EncoderType = C.HPDF_ENCODER_TYPE_DOUBLE_BYTE
	ENCODER_TYPE_UNINITIALIZED EncoderType = C.HPDF_ENCODER_TYPE_UNINITIALIZED
	ENCODER_UNKNOWN            EncoderType = C.HPDF_ENCODER_UNKNOWN
)

type EncryptMode

type EncryptMode int
const (
	ENCRYPT_R2 EncryptMode = C.HPDF_ENCRYPT_R2
	ENCRYPT_R3 EncryptMode = C.HPDF_ENCRYPT_R3
)

type Error

type Error struct {
	Code ErrorCode
	// contains filtered or unexported fields
}

func NewError

func NewError(status, detail C.HPDF_STATUS) *Error

func (*Error) Error

func (err *Error) Error() string

type ErrorCode

type ErrorCode int
const (
	ERR_ARRAY_COUNT_ERR              ErrorCode = C.HPDF_ARRAY_COUNT_ERR
	ERR_ARRAY_ITEM_NOT_FOUND         ErrorCode = C.HPDF_ARRAY_ITEM_NOT_FOUND
	ERR_ARRAY_ITEM_UNEXPECTED_TYPE   ErrorCode = C.HPDF_ARRAY_ITEM_UNEXPECTED_TYPE
	ERR_BINARY_LENGTH_ERR            ErrorCode = C.HPDF_BINARY_LENGTH_ERR
	ERR_CANNOT_GET_PALLET            ErrorCode = C.HPDF_CANNOT_GET_PALLET
	ERR_DICT_COUNT_ERR               ErrorCode = C.HPDF_DICT_COUNT_ERR
	ERR_DICT_ITEM_NOT_FOUND          ErrorCode = C.HPDF_DICT_ITEM_NOT_FOUND
	ERR_DICT_ITEM_UNEXPECTED_TYPE    ErrorCode = C.HPDF_DICT_ITEM_UNEXPECTED_TYPE
	ERR_DICT_STREAM_LENGTH_NOT_FOUND ErrorCode = C.HPDF_DICT_STREAM_LENGTH_NOT_FOUND
	ERR_DOC_ENCRYPTDICT_NOT_FOUND    ErrorCode = C.HPDF_DOC_ENCRYPTDICT_NOT_FOUND
	ERR_DOC_INVALID_OBJECT           ErrorCode = C.HPDF_DOC_INVALID_OBJECT
	ERR_DUPLICATE_REGISTRATION       ErrorCode = C.HPDF_DUPLICATE_REGISTRATION
	ERR_EXCEED_JWW_CODE_NUM_LIMIT    ErrorCode = C.HPDF_EXCEED_JWW_CODE_NUM_LIMIT
	ERR_ENCRYPT_INVALID_PASSWORD     ErrorCode = C.HPDF_ENCRYPT_INVALID_PASSWORD
	ERR_ERR_UNKNOWN_CLASS            ErrorCode = C.HPDF_ERR_UNKNOWN_CLASS
	ERR_EXCEED_GSTATE_LIMIT          ErrorCode = C.HPDF_EXCEED_GSTATE_LIMIT
	ERR_FAILD_TO_ALLOC_MEM           ErrorCode = C.HPDF_FAILD_TO_ALLOC_MEM
	ERR_FILE_IO_ERROR                ErrorCode = C.HPDF_FILE_IO_ERROR
	ERR_FILE_OPEN_ERROR              ErrorCode = C.HPDF_FILE_OPEN_ERROR
	ERR_FONT_EXISTS                  ErrorCode = C.HPDF_FONT_EXISTS
	ERR_FONT_INVALID_WIDTHS_TABLE    ErrorCode = C.HPDF_FONT_INVALID_WIDTHS_TABLE
	ERR_INVALID_AFM_HEADER           ErrorCode = C.HPDF_INVALID_AFM_HEADER
	ERR_INVALID_ANNOTATION           ErrorCode = C.HPDF_INVALID_ANNOTATION
	ERR_INVALID_BIT_PER_COMPONENT    ErrorCode = C.HPDF_INVALID_BIT_PER_COMPONENT
	ERR_INVALID_CHAR_MATRICS_DATA    ErrorCode = C.HPDF_INVALID_CHAR_MATRICS_DATA
	ERR_INVALID_COLOR_SPACE          ErrorCode = C.HPDF_INVALID_COLOR_SPACE
	ERR_INVALID_COMPRESSION_MODE     ErrorCode = C.HPDF_INVALID_COMPRESSION_MODE
	ERR_INVALID_DATE_TIME            ErrorCode = C.HPDF_INVALID_DATE_TIME
	ERR_INVALID_DESTINATION          ErrorCode = C.HPDF_INVALID_DESTINATION
	ERR_INVALID_DOCUMENT             ErrorCode = C.HPDF_INVALID_DOCUMENT
	ERR_INVALID_DOCUMENT_STATE       ErrorCode = C.HPDF_INVALID_DOCUMENT_STATE
	ERR_INVALID_ENCODER              ErrorCode = C.HPDF_INVALID_ENCODER
	ERR_INVALID_ENCODER_TYPE         ErrorCode = C.HPDF_INVALID_ENCODER_TYPE
	ERR_INVALID_ENCODING_NAME        ErrorCode = C.HPDF_INVALID_ENCODING_NAME
	ERR_INVALID_ENCRYPT_KEY_LEN      ErrorCode = C.HPDF_INVALID_ENCRYPT_KEY_LEN
	ERR_INVALID_FONTDEF_DATA         ErrorCode = C.HPDF_INVALID_FONTDEF_DATA
	ERR_INVALID_FONTDEF_TYPE         ErrorCode = C.HPDF_INVALID_FONTDEF_TYPE
	ERR_INVALID_FONT_NAME            ErrorCode = C.HPDF_INVALID_FONT_NAME
	ERR_INVALID_IMAGE                ErrorCode = C.HPDF_INVALID_IMAGE
	ERR_INVALID_JPEG_DATA            ErrorCode = C.HPDF_INVALID_JPEG_DATA
	ERR_INVALID_N_DATA               ErrorCode = C.HPDF_INVALID_N_DATA
	ERR_INVALID_OBJECT               ErrorCode = C.HPDF_INVALID_OBJECT
	ERR_INVALID_OBJ_ID               ErrorCode = C.HPDF_INVALID_OBJ_ID
	ERR_INVALID_OPERATION            ErrorCode = C.HPDF_INVALID_OPERATION
	ERR_INVALID_OUTLINE              ErrorCode = C.HPDF_INVALID_OUTLINE
	ERR_INVALID_PAGE                 ErrorCode = C.HPDF_INVALID_PAGE
	ERR_INVALID_PAGES                ErrorCode = C.HPDF_INVALID_PAGES
	ERR_INVALID_PARAMETER            ErrorCode = C.HPDF_INVALID_PARAMETER
	ERR_INVALID_PNG_IMAGE            ErrorCode = C.HPDF_INVALID_PNG_IMAGE
	ERR_INVALID_STREAM               ErrorCode = C.HPDF_INVALID_STREAM
	ERR_MISSING_FILE_NAME_ENTRY      ErrorCode = C.HPDF_MISSING_FILE_NAME_ENTRY
	ERR_INVALID_TTC_FILE             ErrorCode = C.HPDF_INVALID_TTC_FILE
	ERR_INVALID_TTC_INDEX            ErrorCode = C.HPDF_INVALID_TTC_INDEX
	ERR_INVALID_WX_DATA              ErrorCode = C.HPDF_INVALID_WX_DATA
	ERR_ITEM_NOT_FOUND               ErrorCode = C.HPDF_ITEM_NOT_FOUND
	ERR_LIBPNG_ERROR                 ErrorCode = C.HPDF_LIBPNG_ERROR
	ERR_NAME_INVALID_VALUE           ErrorCode = C.HPDF_NAME_INVALID_VALUE
	ERR_NAME_OUT_OF_RANGE            ErrorCode = C.HPDF_NAME_OUT_OF_RANGE
	ERR_PAGES_MISSING_KIDS_ENTRY     ErrorCode = C.HPDF_PAGES_MISSING_KIDS_ENTRY
	ERR_PAGE_CANNOT_FIND_OBJECT      ErrorCode = C.HPDF_PAGE_CANNOT_FIND_OBJECT
	ERR_PAGE_CANNOT_GET_ROOT_PAGES   ErrorCode = C.HPDF_PAGE_CANNOT_GET_ROOT_PAGES
	ERR_PAGE_CANNOT_RESTORE_GSTATE   ErrorCode = C.HPDF_PAGE_CANNOT_RESTORE_GSTATE
	ERR_PAGE_CANNOT_SET_PARENT       ErrorCode = C.HPDF_PAGE_CANNOT_SET_PARENT
	ERR_PAGE_FONT_NOT_FOUND          ErrorCode = C.HPDF_PAGE_FONT_NOT_FOUND
	ERR_PAGE_INVALID_FONT            ErrorCode = C.HPDF_PAGE_INVALID_FONT
	ERR_PAGE_INVALID_FONT_SIZE       ErrorCode = C.HPDF_PAGE_INVALID_FONT_SIZE
	ERR_PAGE_INVALID_GMODE           ErrorCode = C.HPDF_PAGE_INVALID_GMODE
	ERR_PAGE_INVALID_INDEX           ErrorCode = C.HPDF_PAGE_INVALID_INDEX
	ERR_PAGE_INVALID_ROTATE_VALUE    ErrorCode = C.HPDF_PAGE_INVALID_ROTATE_VALUE
	ERR_PAGE_INVALID_SIZE            ErrorCode = C.HPDF_PAGE_INVALID_SIZE
	ERR_PAGE_INVALID_XOBJECT         ErrorCode = C.HPDF_PAGE_INVALID_XOBJECT
	ERR_PAGE_OUT_OF_RANGE            ErrorCode = C.HPDF_PAGE_OUT_OF_RANGE
	ERR_REAL_OUT_OF_RANGE            ErrorCode = C.HPDF_REAL_OUT_OF_RANGE
	ERR_STREAM_EOF                   ErrorCode = C.HPDF_STREAM_EOF
	ERR_STREAM_READLN_CONTINUE       ErrorCode = C.HPDF_STREAM_READLN_CONTINUE
	ERR_STRING_OUT_OF_RANGE          ErrorCode = C.HPDF_STRING_OUT_OF_RANGE
	ERR_THIS_FUNC_WAS_SKIPPED        ErrorCode = C.HPDF_THIS_FUNC_WAS_SKIPPED
	ERR_TTF_CANNOT_EMBEDDING_FONT    ErrorCode = C.HPDF_TTF_CANNOT_EMBEDDING_FONT
	ERR_TTF_INVALID_CMAP             ErrorCode = C.HPDF_TTF_INVALID_CMAP
	ERR_TTF_INVALID_FOMAT            ErrorCode = C.HPDF_TTF_INVALID_FOMAT
	ERR_TTF_MISSING_TABLE            ErrorCode = C.HPDF_TTF_MISSING_TABLE
	ERR_UNSUPPORTED_FONT_TYPE        ErrorCode = C.HPDF_UNSUPPORTED_FONT_TYPE
	ERR_UNSUPPORTED_FUNC             ErrorCode = C.HPDF_UNSUPPORTED_FUNC
	ERR_UNSUPPORTED_JPEG_FORMAT      ErrorCode = C.HPDF_UNSUPPORTED_JPEG_FORMAT
	ERR_UNSUPPORTED_TYPE1_FONT       ErrorCode = C.HPDF_UNSUPPORTED_TYPE1_FONT
	ERR_XREF_COUNT_ERR               ErrorCode = C.HPDF_XREF_COUNT_ERR
	ERR_ZLIB_ERROR                   ErrorCode = C.HPDF_ZLIB_ERROR
	ERR_INVALID_PAGE_INDEX           ErrorCode = C.HPDF_INVALID_PAGE_INDEX
	ERR_INVALID_URI                  ErrorCode = C.HPDF_INVALID_URI
	ERR_ANNOT_INVALID_ICON           ErrorCode = C.HPDF_ANNOT_INVALID_ICON
	ERR_ANNOT_INVALID_BORDER_STYLE   ErrorCode = C.HPDF_ANNOT_INVALID_BORDER_STYLE
	ERR_PAGE_INVALID_DIRECTION       ErrorCode = C.HPDF_PAGE_INVALID_DIRECTION
	ERR_INVALID_FONT                 ErrorCode = C.HPDF_INVALID_FONT
)

type Font

type Font struct {
	// contains filtered or unexported fields
}

func (*Font) GetAscent

func (font *Font) GetAscent() int32

func (*Font) GetBBox

func (font *Font) GetBBox() *Box

func (*Font) GetCapHeight

func (font *Font) GetCapHeight() uint32

func (*Font) GetDescent

func (font *Font) GetDescent() int32

func (*Font) GetEncodingName

func (font *Font) GetEncodingName() string

func (*Font) GetFontName

func (font *Font) GetFontName() string

func (*Font) GetUnicodeWidth

func (font *Font) GetUnicodeWidth(char rune) int32

func (*Font) GetXHeight

func (font *Font) GetXHeight() uint32

func (*Font) MeasureText

func (font *Font) MeasureText(text string, width float32, fontSize float32, charSpace float32, wordSpace float32, wordwrap bool, realWidth *float32) uint32

func (*Font) TextWidth

func (font *Font) TextWidth(text string) *TextWidth

type GMode

type GMode uint32
const (
	GMODE_PAGE_DESCRIPTION GMode = C.HPDF_GMODE_PAGE_DESCRIPTION
	GMODE_PATH_OBJECT      GMode = C.HPDF_GMODE_PATH_OBJECT
	GMODE_TEXT_OBJECT      GMode = C.HPDF_GMODE_TEXT_OBJECT
	GMODE_CLIPPING_PATH    GMode = C.HPDF_GMODE_CLIPPING_PATH
	GMODE_SHADING          GMode = C.HPDF_GMODE_SHADING
	GMODE_INLINE_IMAGE     GMode = C.HPDF_GMODE_INLINE_IMAGE
	GMODE_EXTERNAL_OBJECT  GMode = C.HPDF_GMODE_EXTERNAL_OBJECT
)

type Image

type Image struct {
	// contains filtered or unexported fields
}

func (*Image) GetBitsPerComponent

func (image *Image) GetBitsPerComponent() uint32

func (*Image) GetColorSpace

func (image *Image) GetColorSpace() ColorSpace

func (*Image) GetHeight

func (image *Image) GetHeight() uint32

func (*Image) GetSize

func (image *Image) GetSize() *Point

func (*Image) GetWidth

func (image *Image) GetWidth() uint32

func (*Image) SetColorMask

func (image *Image) SetColorMask(
	rmin, rmax, gmin, gmax, bmin, bmax uint32,
) error

func (*Image) SetMaskImage

func (image *Image) SetMaskImage(mask *Image) error

type InfoType

type InfoType int
const (
	INFO_CREATION_DATE InfoType = C.HPDF_INFO_CREATION_DATE
	INFO_MOD_DATE      InfoType = C.HPDF_INFO_MOD_DATE
	INFO_AUTHOR        InfoType = C.HPDF_INFO_AUTHOR
	INFO_CREATOR       InfoType = C.HPDF_INFO_CREATOR
	INFO_TITLE         InfoType = C.HPDF_INFO_TITLE
	INFO_SUBJECT       InfoType = C.HPDF_INFO_SUBJECT
	INFO_KEYWORDS      InfoType = C.HPDF_INFO_KEYWORDS
	INFO_PRODUCER      InfoType = C.HPDF_INFO_PRODUCER
)

type LineCap

type LineCap int
const (
	LINE_CAP_BUTT_END              LineCap = C.HPDF_BUTT_END
	LINE_CAP_ROUND_END             LineCap = C.HPDF_ROUND_END
	LINE_CAP_PROJECTING_SCUARE_END LineCap = C.HPDF_PROJECTING_SCUARE_END
	LINE_CAP_LINECAP_EOF           LineCap = C.HPDF_LINECAP_EOF
)

type LineJoin

type LineJoin int
const (
	LINE_JOIN_MITER_JOIN   LineJoin = C.HPDF_MITER_JOIN
	LINE_JOIN_ROUND_JOIN   LineJoin = C.HPDF_ROUND_JOIN
	LINE_JOIN_BEVEL_JOIN   LineJoin = C.HPDF_BEVEL_JOIN
	LINE_JOIN_LINEJOIN_EOF LineJoin = C.HPDF_LINEJOIN_EOF
)

type LinkAnnotation

type LinkAnnotation struct {
	Annotation
}

func (*LinkAnnotation) SetBorderStyle

func (annotation *LinkAnnotation) SetBorderStyle(
	width float32, dashOn, dashOff uint16,
) error

func (*LinkAnnotation) SetHighlightMode

func (annotation *LinkAnnotation) SetHighlightMode(
	annotHightlightMode AnnotHighlightMode,
) error

type Outline

type Outline struct {
	Parent  *Outline
	Caption string
	// contains filtered or unexported fields
}

func (*Outline) SetDestination

func (outline *Outline) SetDestination(destination *Destination) error

func (*Outline) SetOpened

func (outline *Outline) SetOpened(opend bool) error

type PDF

type PDF struct {
	// contains filtered or unexported fields
}

func New

func New() (*PDF, error)

func (*PDF) AddPage

func (pdf *PDF) AddPage() (*Page, error)

func (*PDF) AddPageLabel

func (pdf *PDF) AddPageLabel(
	pageNum uint, pageNumStyle PageNumStyle, firstPage uint, prefix string,
) error

func (*PDF) CreateOutline

func (pdf *PDF) CreateOutline(parent *Outline, caption string, encoder *Encoder) (*Outline, error)

func (*PDF) Free

func (pdf *PDF) Free()

func (*PDF) FreeDoc

func (pdf *PDF) FreeDoc()

func (*PDF) FreeDocAll

func (pdf *PDF) FreeDocAll()

func (*PDF) GetCurrentEncoder

func (pdf *PDF) GetCurrentEncoder() *Encoder

func (*PDF) GetCurrentPage

func (pdf *PDF) GetCurrentPage() *Page

func (*PDF) GetEncoder

func (pdf *PDF) GetEncoder(encodingName string) (*Encoder, error)

func (*PDF) GetFont

func (pdf *PDF) GetFont(fontName string, encodingName ...string) (*Font, error)

func (*PDF) GetInfoAttr

func (pdf *PDF) GetInfoAttr(infoType InfoType) (string, error)

func (*PDF) GetLastError

func (pdf *PDF) GetLastError() error

func (*PDF) GetPageByIndex

func (pdf *PDF) GetPageByIndex(index uint32) (*Page, error)

func (*PDF) GetPageLayout

func (pdf *PDF) GetPageLayout() PageLayout

func (*PDF) GetPageMode

func (pdf *PDF) GetPageMode() PageMode

func (*PDF) GetViewerPreference

func (pdf *PDF) GetViewerPreference() ViewerPreference

func (*PDF) HasDoc

func (pdf *PDF) HasDoc() bool

func (*PDF) InsertPage

func (pdf *PDF) InsertPage(src *Page) (*Page, error)

func (*PDF) LoadJpegImageFromFile

func (pdf *PDF) LoadJpegImageFromFile(filename string) (*Image, error)

func (*PDF) LoadJpegImageFromMem

func (pdf *PDF) LoadJpegImageFromMem(mem []byte) (*Image, error)

func (*PDF) LoadPngImageFromFile

func (pdf *PDF) LoadPngImageFromFile(filename string) (*Image, error)

func (*PDF) LoadPngImageFromFile2

func (pdf *PDF) LoadPngImageFromFile2(filename string) (*Image, error)

func (*PDF) LoadPngImageFromMem

func (pdf *PDF) LoadPngImageFromMem(mem []byte) (*Image, error)

func (*PDF) LoadRawImageFromFile

func (pdf *PDF) LoadRawImageFromFile(
	filename string, width, height uint32, colorSpace ColorSpace,
) (*Image, error)

func (*PDF) LoadRawImageFromMem

func (pdf *PDF) LoadRawImageFromMem(
	mem []byte,
	width uint32,
	height uint32,
	colorSpace ColorSpace,
	bitsPerComponent uint32,
) (*Image, error)

func (*PDF) LoadTTFontFromFile

func (pdf *PDF) LoadTTFontFromFile(fontName string, embedding bool) (string, error)

func (*PDF) LoadTTFontFromFile2

func (pdf *PDF) LoadTTFontFromFile2(fontName string, index uint, embedding bool) (string, error)

func (*PDF) LoadType1FontFromFile

func (pdf *PDF) LoadType1FontFromFile(afmFn string, pfmFn ...string) (string, error)

func (*PDF) NewDoc

func (pdf *PDF) NewDoc() error

func (*PDF) SaveToFile

func (pdf *PDF) SaveToFile(fn string) error

func (*PDF) SaveToStream

func (pdf *PDF) SaveToStream(wr io.Writer) error

func (*PDF) SetCompressionMode

func (pdf *PDF) SetCompressionMode(compressionMode CompressionMode) error

func (*PDF) SetCurrentEncoder

func (pdf *PDF) SetCurrentEncoder(encodingName string) error

func (*PDF) SetEncryptMode

func (pdf *PDF) SetEncryptMode(encryptMode EncryptMode, keyLen uint32) error

func (*PDF) SetInfoAttr

func (pdf *PDF) SetInfoAttr(infoType InfoType, value string) error

func (*PDF) SetInfoDateAttr

func (pdf *PDF) SetInfoDateAttr(infoType InfoType, datetime time.Time) error

func (*PDF) SetOpenAction

func (pdf *PDF) SetOpenAction(destination *Destination) error

func (*PDF) SetPageLayout

func (pdf *PDF) SetPageLayout(layout PageLayout) error

func (*PDF) SetPageMode

func (pdf *PDF) SetPageMode(pageMode PageMode) error

func (*PDF) SetPagesConfiguration

func (pdf *PDF) SetPagesConfiguration(page_per_pages uint) error

func (*PDF) SetPassword

func (pdf *PDF) SetPassword(ownerPassword, userPassword string) error

func (*PDF) SetPermission

func (pdf *PDF) SetPermission(permission Permission) error

func (*PDF) SetViewerPreference

func (pdf *PDF) SetViewerPreference(preference ViewerPreference) error

func (*PDF) UseCNSEncodings

func (pdf *PDF) UseCNSEncodings() error

func (*PDF) UseCNSFonts

func (pdf *PDF) UseCNSFonts() error

func (*PDF) UseCNTEncodings

func (pdf *PDF) UseCNTEncodings() error

func (*PDF) UseCNTFonts

func (pdf *PDF) UseCNTFonts() error

func (*PDF) UseJPEncodings

func (pdf *PDF) UseJPEncodings() error

func (*PDF) UseJPFonts

func (pdf *PDF) UseJPFonts() error

func (*PDF) UseKREncodings

func (pdf *PDF) UseKREncodings() error

func (*PDF) UseKRFonts

func (pdf *PDF) UseKRFonts() error

func (*PDF) UseUTFEncodings

func (pdf *PDF) UseUTFEncodings() error

type Page

type Page struct {
	// contains filtered or unexported fields
}

func (*Page) BeginText

func (page *Page) BeginText() error

func (*Page) CreateDestination

func (page *Page) CreateDestination() (*Destination, error)

func (*Page) CreateLinkAnnot

func (page *Page) CreateLinkAnnot(
	rect *Rect, destination *Destination,
) (*LinkAnnotation, error)

func (*Page) CreateTextAnnot

func (page *Page) CreateTextAnnot(
	rect *Rect, text string, encoder *Encoder,
) (*TextAnnotation, error)

func (*Page) CreateURILinkAnnot

func (page *Page) CreateURILinkAnnot(
	rect *Rect, uri string,
) (*URILinkAnnotation, error)

func (*Page) CurveTo

func (page *Page) CurveTo(x1 float32, y1 float32, x2 float32, y2 float32, x3 float32, y3 float32) error

func (*Page) DrawImage

func (page *Page) DrawImage(image *Image, x, y, width, height float32) error

func (*Page) EndText

func (page *Page) EndText() error

func (*Page) Fill

func (page *Page) Fill() error

func (*Page) FillStroke

func (page *Page) FillStroke() error

func (*Page) GetCMYKFill

func (page *Page) GetCMYKFill() *CMYKColor

func (*Page) GetCMYKStroke

func (page *Page) GetCMYKStroke() *CMYKColor

func (*Page) GetCurrentFont

func (page *Page) GetCurrentFont() *Font

func (*Page) GetCurrentFontSize

func (page *Page) GetCurrentFontSize() float32

func (*Page) GetCurrentPos

func (page *Page) GetCurrentPos() *Point

func (*Page) GetCurrentTextPos

func (page *Page) GetCurrentTextPos() *Point

func (*Page) GetDash

func (page *Page) GetDash() *DashMode

func (*Page) GetGMode

func (page *Page) GetGMode() GMode

func (*Page) GetGrayFill

func (page *Page) GetGrayFill() float32

func (*Page) GetGrayStroke

func (page *Page) GetGrayStroke() float32

func (*Page) GetHeight

func (page *Page) GetHeight() float32

func (*Page) GetHorizontalScalling

func (page *Page) GetHorizontalScalling() float32

func (*Page) GetLineCap

func (page *Page) GetLineCap() LineCap

func (*Page) GetLineJoin

func (page *Page) GetLineJoin() LineJoin

func (*Page) GetLineWidth

func (page *Page) GetLineWidth() float32

func (*Page) GetMiterLimit

func (page *Page) GetMiterLimit() float32

func (*Page) GetRGBFill

func (page *Page) GetRGBFill() *RGBColor

func (*Page) GetRGBStroke

func (page *Page) GetRGBStroke() *RGBColor

func (*Page) GetTransMatrix

func (page *Page) GetTransMatrix() *TransMatrix

func (*Page) GetWidth

func (page *Page) GetWidth() float32

func (*Page) LineTo

func (page *Page) LineTo(x float32, y float32) error

func (*Page) MeasureText

func (page *Page) MeasureText(text string, width float32, wordwrap bool) (float32, error)

func (*Page) MoveTextPos

func (page *Page) MoveTextPos(x float32, y float32) error

func (*Page) MoveTo

func (page *Page) MoveTo(x float32, y float32) error

func (*Page) Rectangle

func (page *Page) Rectangle(x float32, y float32, width float32, height float32) error

func (*Page) SetCMYKFill

func (page *Page) SetCMYKFill(c, m, y, k float32) error

func (*Page) SetCMYKStroke

func (page *Page) SetCMYKStroke(c, m, y, k float32) error

func (*Page) SetCharSpace

func (page *Page) SetCharSpace(value float32) error

func (*Page) SetDash

func (page *Page) SetDash(dashPtn []uint16, phase uint) error

func (*Page) SetFontAndSize

func (page *Page) SetFontAndSize(font *Font, size float32) error

func (*Page) SetGrayFill

func (page *Page) SetGrayFill(gray float32) error

func (*Page) SetGrayStroke

func (page *Page) SetGrayStroke(gray float32) error

func (*Page) SetHeight

func (page *Page) SetHeight(height float32) error

func (*Page) SetHorizontalScalling

func (page *Page) SetHorizontalScalling(scale float32) error

func (*Page) SetLineCap

func (page *Page) SetLineCap(lineCap LineCap) error

func (*Page) SetLineWidth

func (page *Page) SetLineWidth(lineWidth float32) error

func (*Page) SetRGBFill

func (page *Page) SetRGBFill(r float32, g float32, b float32) error

func (*Page) SetRGBStroke

func (page *Page) SetRGBStroke(r float32, g float32, b float32) error

func (*Page) SetRotate

func (page *Page) SetRotate(rotate uint16) error

func (*Page) SetSize

func (page *Page) SetSize(size PageSize, direction PageDirection) error

func (*Page) SetWidth

func (page *Page) SetWidth(width float32) error

func (*Page) SetWordSpace

func (page *Page) SetWordSpace(value float32) error

func (*Page) ShowText

func (page *Page) ShowText(text string) error

func (*Page) Stroke

func (page *Page) Stroke() error

func (*Page) TextOut

func (page *Page) TextOut(x float32, y float32, text string) error

func (*Page) TextWidth

func (page *Page) TextWidth(text string) float32

type PageDirection

type PageDirection int
const (
	PAGE_PORTRAIT  PageDirection = C.HPDF_PAGE_PORTRAIT
	PAGE_LANDSCAPE PageDirection = C.HPDF_PAGE_LANDSCAPE
)

type PageLayout

type PageLayout int
const (
	PAGE_LAYOUT_SINGLE           PageLayout = C.HPDF_PAGE_LAYOUT_SINGLE
	PAGE_LAYOUT_ONE_COLUMN       PageLayout = C.HPDF_PAGE_LAYOUT_ONE_COLUMN
	PAGE_LAYOUT_TWO_COLUMN_LEFT  PageLayout = C.HPDF_PAGE_LAYOUT_TWO_COLUMN_LEFT
	PAGE_LAYOUT_TWO_COLUMN_RIGHT PageLayout = C.HPDF_PAGE_LAYOUT_TWO_COLUMN_RIGHT
)

type PageMode

type PageMode int
const (
	PAGE_MODE_USE_NONE    PageMode = C.HPDF_PAGE_MODE_USE_NONE
	PAGE_MODE_USE_OUTLINE PageMode = C.HPDF_PAGE_MODE_USE_OUTLINE
	PAGE_MODE_USE_THUMBS  PageMode = C.HPDF_PAGE_MODE_USE_THUMBS
	PAGE_MODE_FULL_SCREEN PageMode = C.HPDF_PAGE_MODE_FULL_SCREEN
)

type PageNumStyle

type PageNumStyle int
const (
	PAGE_NUM_STYLE_DECIMAL       PageNumStyle = C.HPDF_PAGE_NUM_STYLE_DECIMAL
	PAGE_NUM_STYLE_UPPER_ROMAN   PageNumStyle = C.HPDF_PAGE_NUM_STYLE_UPPER_ROMAN
	PAGE_NUM_STYLE_LOWER_ROMAN   PageNumStyle = C.HPDF_PAGE_NUM_STYLE_LOWER_ROMAN
	PAGE_NUM_STYLE_UPPER_LETTERS PageNumStyle = C.HPDF_PAGE_NUM_STYLE_UPPER_LETTERS
	PAGE_NUM_STYLE_LOWER_LETTERS PageNumStyle = C.HPDF_PAGE_NUM_STYLE_LOWER_LETTERS
)

type PageSize

type PageSize int
const (
	PAGE_SIZE_LETTER    PageSize = C.HPDF_PAGE_SIZE_LETTER
	PAGE_SIZE_LEGAL     PageSize = C.HPDF_PAGE_SIZE_LEGAL
	PAGE_SIZE_A3        PageSize = C.HPDF_PAGE_SIZE_A3
	PAGE_SIZE_A4        PageSize = C.HPDF_PAGE_SIZE_A4
	PAGE_SIZE_A5        PageSize = C.HPDF_PAGE_SIZE_A5
	PAGE_SIZE_B4        PageSize = C.HPDF_PAGE_SIZE_B4
	PAGE_SIZE_B5        PageSize = C.HPDF_PAGE_SIZE_B5
	PAGE_SIZE_EXECUTIVE PageSize = C.HPDF_PAGE_SIZE_EXECUTIVE
	PAGE_SIZE_US4x6     PageSize = C.HPDF_PAGE_SIZE_US4x6
	PAGE_SIZE_US4x8     PageSize = C.HPDF_PAGE_SIZE_US4x8
	PAGE_SIZE_US5x7     PageSize = C.HPDF_PAGE_SIZE_US5x7
	PAGE_SIZE_COMM10    PageSize = C.HPDF_PAGE_SIZE_COMM10
)

type Permission

type Permission uint32
const (
	ENABLE_READ     Permission = C.HPDF_ENABLE_READ
	ENABLE_PRINT    Permission = C.HPDF_ENABLE_PRINT
	ENABLE_EDIT_ALL Permission = C.HPDF_ENABLE_EDIT_ALL
	ENABLE_COPY     Permission = C.HPDF_ENABLE_COPY
	ENABLE_EDIT     Permission = C.HPDF_ENABLE_EDIT
)

type Point

type Point struct {
	X float32
	Y float32
}

type RGBColor

type RGBColor struct {
	R float32
	G float32
	B float32
}

type Rect

type Rect struct {
	Left   float32
	Bottom float32
	Right  float32
	Top    float32
}

func NewRect

func NewRect(left, bottom, right, top float32) *Rect

type TextAnnotation

type TextAnnotation struct {
	Annotation
}

func (*TextAnnotation) SetIcon

func (annotation *TextAnnotation) SetIcon(icon AnnotIcon) error

func (*TextAnnotation) SetOpened

func (annotation *TextAnnotation) SetOpened(opened bool) error

type TextWidth

type TextWidth struct {
	NumChars uint32
	NumWords uint32
	Width    uint32
	NumSpace uint32
}

type TransMatrix

type TransMatrix struct {
	A float32
	B float32
	C float32
	D float32
	X float32
	Y float32
}

type URILinkAnnotation

type URILinkAnnotation struct {
	Annotation
}

type WritingMode

type WritingMode int
const (
	WMODE_HORIZONTAL WritingMode = C.HPDF_WMODE_HORIZONTAL
	WMODE_VERTICAL   WritingMode = C.HPDF_WMODE_VERTICAL
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL