Documentation
¶
Index ¶
- Constants
- type CompanySigner
- type ContentStyle
- type FontOption
- type FontWeight
- type FooterOption
- type HeaderOption
- type HeaderSlice
- type Ln
- type PDFHelper
- func (helper *PDFHelper) AddFooter()
- func (helper *PDFHelper) AddHeader()
- func (helper *PDFHelper) AddSignForm(firstParty, secondParty SignerInterface, fillTime, fillIP bool) (err error)
- func (helper *PDFHelper) AddTableBody(width float64, ln Ln, content string, opt ...*ContentStyle)
- func (helper *PDFHelper) AddTableBodyMulti(width float64, startPoint *imgHelper.Position, content string, ...) (thisLineEndPoint, nextLineStartPoint *imgHelper.Position)
- func (helper *PDFHelper) AddTableBodyMultiLines(width float64, ln Ln, contentByte [][]byte, opt ...*ContentStyle) (countLine int)
- func (helper *PDFHelper) AddTableBodyRow(widthSlice []float64, contentSlice []string, opt ...*ContentStyle)
- func (helper *PDFHelper) AddTableHead(width float64, ln Ln, content string, opt ...*ContentStyle)
- func (helper *PDFHelper) AddTableHeadMulti(width float64, startPoint *imgHelper.Position, content string, ...) (thisLineEndPoint, nextLineStartPoint *imgHelper.Position)
- func (helper *PDFHelper) AddWaterMark()
- func (helper *PDFHelper) BatchSplitLines(widthSlice []float64, contentSlice []string) (lineSlice [][]string, maxLines int, err error)
- func (helper *PDFHelper) FirstTitle(text string)
- func (helper *PDFHelper) GetTotalHeight(content string, width float64, weight FontWeight, fontSize, lineHeight float64) (totalHeight float64)
- func (helper *PDFHelper) MainTitle(text string)
- func (helper *PDFHelper) NormalContent(text string, opt ...*ContentStyle)
- func (helper *PDFHelper) SaveAsImgs(dir, fileName string) (localFilePaths []string, err error)
- func (helper *PDFHelper) SaveAsPDF(dir, fileName string) (filePath string, err error)
- func (helper *PDFHelper) SecondTitle(text string)
- func (helper *PDFHelper) SplitLines(width float64, content string) (lines [][]byte, err error)
- func (helper *PDFHelper) SplitText(width float64, content string) (lines []string)
- type PersonSigner
- type RGBColor
- type RectArea
- type SignData
- type SignFormCellStyle
- type SignImg
- type SignKind
- type SignerInterface
- type WaterMarkOption
Constants ¶
View Source
const ( // helper.FontOption.FontName = "MyFont" PortraitValidWidth = 190.0 PortraitValidHeight = 277.0 LandscapeValidWidth = 277.0 LandscapeValidHeight = 190.0 Margin = 10 HalfPortraitValidWidth = 95.0 SignSpaceRowAmount = 4 // 签字区域的空白行数 SignerInfoRowAmount = 8 // 签名人员信息高度(公司8 个人4) BlankRowHeight = 8 // 签字区域单行高度 SignFormPartyLineHeight = 10.0 // 签字区域 甲方乙方的行高 )
View Source
const FontBold = "B"
View Source
const FontHeavy = "H"
View Source
const FontLight = "L"
View Source
const FontRegular = ""
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompanySigner ¶
type CompanySigner struct {
OgName string //【单位】单位名称
OgLicenseNo string //【单位】营业执照编号
OgBankName string //【单位】开户行名称
OgBankNo string //【单位】行号
OgBankAccount string //【单位】银行账号
OgTel string //【单位】电话
OgFax string //【单位】传真
OgAddress string //【单位】地址
LawPersonName string //【单位】法人姓名
SignerName string // 签署人真实姓名
SignerPhone string // 签署人手机号
SignData SignData // 签名信息
}
CompanySigner 公司签署
func (CompanySigner) GetHintName ¶
func (signer CompanySigner) GetHintName() string
func (CompanySigner) GetKind ¶
func (signer CompanySigner) GetKind() SignKind
func (CompanySigner) GetSignData ¶
func (signer CompanySigner) GetSignData() SignData
type ContentStyle ¶
type FontOption ¶
type FontWeight ¶
type FontWeight string
type FooterOption ¶
type FooterOption struct {
}
type HeaderOption ¶
type HeaderSlice ¶
type PDFHelper ¶
type PDFHelper struct {
PDF *gofpdf.Fpdf
FontOption *FontOption // 字体设置
HeaderOption *HeaderOption // 页眉设置
WaterMarkOption *WaterMarkOption // 水印设置
}
func NewPDFHelper ¶
func NewPDFHelper(fontOption *FontOption, headerOption *HeaderOption, footerOption *FooterOption, waterMarkOption *WaterMarkOption) (helper *PDFHelper)
NewPDFHelper 创建一个pdf助手
func (*PDFHelper) AddSignForm ¶
func (helper *PDFHelper) AddSignForm(firstParty, secondParty SignerInterface, fillTime, fillIP bool) (err error)
AddSignForm 添加一个签字用的区域(如果带有签名数据也会一起渲染上去) 图片是网络地址的话,会先下载到当前项目根目录的/tmp下,注意权限
func (*PDFHelper) AddTableBody ¶
func (helper *PDFHelper) AddTableBody(width float64, ln Ln, content string, opt ...*ContentStyle)
AddTableBody 添加一个表格体
func (*PDFHelper) AddTableBodyMulti ¶
func (helper *PDFHelper) AddTableBodyMulti(width float64, startPoint *imgHelper.Position, content string, opt ...*ContentStyle) (thisLineEndPoint, nextLineStartPoint *imgHelper.Position)
AddTableBodyMulti 添加一个表格体
func (*PDFHelper) AddTableBodyMultiLines ¶
func (helper *PDFHelper) AddTableBodyMultiLines(width float64, ln Ln, contentByte [][]byte, opt ...*ContentStyle) (countLine int)
AddTableBodyMultiLines 添加一个表格体(允许换行) 记得归位
func (*PDFHelper) AddTableBodyRow ¶
func (helper *PDFHelper) AddTableBodyRow(widthSlice []float64, contentSlice []string, opt ...*ContentStyle)
AddTableBodyRow 新的tableBody写法(支持换行)
func (*PDFHelper) AddTableHead ¶
func (helper *PDFHelper) AddTableHead(width float64, ln Ln, content string, opt ...*ContentStyle)
AddTableHead 添加一个表格头
func (*PDFHelper) AddTableHeadMulti ¶
func (helper *PDFHelper) AddTableHeadMulti(width float64, startPoint *imgHelper.Position, content string, opt ...*ContentStyle) (thisLineEndPoint, nextLineStartPoint *imgHelper.Position)
AddTableHeadMulti 添加一个表格头
func (*PDFHelper) BatchSplitLines ¶
func (helper *PDFHelper) BatchSplitLines(widthSlice []float64, contentSlice []string) (lineSlice [][]string, maxLines int, err error)
BatchSplitLines 批量拆分
func (*PDFHelper) GetTotalHeight ¶
func (helper *PDFHelper) GetTotalHeight(content string, width float64, weight FontWeight, fontSize, lineHeight float64) (totalHeight float64)
GetTotalHeight 获取多行文字的行高
func (*PDFHelper) NormalContent ¶
func (helper *PDFHelper) NormalContent(text string, opt ...*ContentStyle)
NormalContent 常规正文内容(前面会有两格缩进)
func (*PDFHelper) SaveAsImgs ¶
SaveAsImgs 以图片格式保存 dir : 要以斜杠 / 结尾 fileName : 不要后缀名
func (*PDFHelper) SplitLines ¶
SplitLines 将文字拆分成几行
type PersonSigner ¶
type PersonSigner struct {
TrueName string // 个人真实姓名
Address string // 地址
Phone string // 手机号
IDCardNo string // 身份证号
SignData SignData // 签名信息
}
PersonSigner 个人签署
func (PersonSigner) GetHintName ¶
func (signer PersonSigner) GetHintName() string
func (PersonSigner) GetKind ¶
func (signer PersonSigner) GetKind() SignKind
func (PersonSigner) GetSignData ¶
func (signer PersonSigner) GetSignData() SignData
type SignData ¶
type SignData struct {
DoHint bool // 是否提示签名区域高亮
AutoSign bool // 自动签名
StampImg *SignImg
NameImg *SignImg
OverflowRate float64 // 签名浮动区域(仅自动签名有效 0 - 1)
PageNo int // 签署在合同的第几页
Time string // 签署日期
IP string // 签署IP
SignFormCellStyle [SignSpaceRowAmount]*SignFormCellStyle
FaceImg *SignImg // 人脸识别照片(目前不做相关处理)
SignerID uint64 // 签署人主体ID(目前不做相关处理)
}
type SignFormCellStyle ¶
type SignerInterface ¶
Click to show internal directories.
Click to hide internal directories.