|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"flag"
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
"github.com/jung-kurt/gofpdf"
|
|
|
|
|
"insure/global"
|
|
|
|
|
"insure/initialize"
|
|
|
|
|
"insure/router"
|
|
|
|
|
"strconv"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
initial()
|
|
|
|
|
//testVerify()
|
|
|
|
|
//runServer()
|
|
|
|
|
//gen3()
|
|
|
|
|
runServerInWindows()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func initial() {
|
|
|
|
|
var configFilePath string
|
|
|
|
|
flag.StringVar(&configFilePath, "config", "./conf/config.yaml", "配置文件")
|
|
|
|
|
flag.Parse()
|
|
|
|
|
global.Config = initialize.InitConfig(configFilePath)
|
|
|
|
|
global.DB = initialize.InitDB(global.Config)
|
|
|
|
|
global.Redis = initialize.InitRedis(global.Config)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*func runServer() {
|
|
|
|
|
r := gin.Default()
|
|
|
|
|
s := &http.Server{
|
|
|
|
|
Addr: ":8080",
|
|
|
|
|
Handler: r,
|
|
|
|
|
ReadTimeout: 10 * time.Second,
|
|
|
|
|
WriteTimeout: 10 * time.Second,
|
|
|
|
|
MaxHeaderBytes: 1 << 20,
|
|
|
|
|
}
|
|
|
|
|
router.Initial(r)
|
|
|
|
|
err := endless.ListenAndServe(":"+global.Config.Server.Port, s.Handler)
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
func runServerInWindows() {
|
|
|
|
|
r := gin.Default()
|
|
|
|
|
router.Initial(r)
|
|
|
|
|
r.Run(":" + global.Config.Server.Port)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func gen() {
|
|
|
|
|
pdf := gofpdf.New("P", "mm", "A4", "") // 210mm x 297mm
|
|
|
|
|
pdf.AddPage()
|
|
|
|
|
|
|
|
|
|
for fontSize := 4; fontSize < 40; fontSize += 10 {
|
|
|
|
|
pdf.SetFont("Arial", "S", float64(fontSize))
|
|
|
|
|
pdf.SetXY(0, float64(fontSize))
|
|
|
|
|
pdf.Cell(40, 10, "Hello World")
|
|
|
|
|
}
|
|
|
|
|
err := pdf.OutputFileAndClose("./test.pdf")
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println(err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func strDelimit(str string, sepstr string, sepcount int) string {
|
|
|
|
|
pos := len(str) - sepcount
|
|
|
|
|
for pos > 0 {
|
|
|
|
|
str = str[:pos] + sepstr + str[pos:]
|
|
|
|
|
pos = pos - sepcount
|
|
|
|
|
}
|
|
|
|
|
return str
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func gen1() {
|
|
|
|
|
pdf := gofpdf.New("P", "mm", "A4", "")
|
|
|
|
|
|
|
|
|
|
type countryType struct {
|
|
|
|
|
nameStr, capitalStr, areaStr, popStr string
|
|
|
|
|
}
|
|
|
|
|
countryList := make([]countryType, 0, 8)
|
|
|
|
|
header := []string{"Country", "Capital", "Area (sq km)", "Pop. (thousands)"}
|
|
|
|
|
for i := 0; i < 8; i++ {
|
|
|
|
|
countryList = append(countryList, countryType{
|
|
|
|
|
nameStr: "name" + strconv.Itoa(i),
|
|
|
|
|
capitalStr: "capital" + strconv.Itoa(i),
|
|
|
|
|
areaStr: "area" + strconv.Itoa(i),
|
|
|
|
|
popStr: "pop" + strconv.Itoa(i),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// Simple table
|
|
|
|
|
basicTable := func() {
|
|
|
|
|
left := (210.0 - 4*40) / 2
|
|
|
|
|
pdf.SetX(left)
|
|
|
|
|
for _, str := range header {
|
|
|
|
|
pdf.CellFormat(40, 7, str, "1", 0, "", false, 0, "")
|
|
|
|
|
}
|
|
|
|
|
pdf.Ln(-1)
|
|
|
|
|
for _, c := range countryList {
|
|
|
|
|
pdf.SetX(left)
|
|
|
|
|
pdf.CellFormat(40, 6, c.nameStr, "1", 0, "", false, 0, "")
|
|
|
|
|
pdf.CellFormat(40, 6, c.capitalStr, "1", 0, "", false, 0, "")
|
|
|
|
|
pdf.CellFormat(40, 6, c.areaStr, "1", 0, "", false, 0, "")
|
|
|
|
|
pdf.CellFormat(40, 6, c.popStr, "1", 0, "", false, 0, "")
|
|
|
|
|
pdf.Ln(-1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Better table
|
|
|
|
|
improvedTable := func() {
|
|
|
|
|
// Column widths
|
|
|
|
|
w := []float64{40.0, 35.0, 40.0, 45.0}
|
|
|
|
|
wSum := 0.0
|
|
|
|
|
for _, v := range w {
|
|
|
|
|
wSum += v
|
|
|
|
|
}
|
|
|
|
|
left := (210 - wSum) / 2
|
|
|
|
|
// Header
|
|
|
|
|
pdf.SetX(left)
|
|
|
|
|
for j, str := range header {
|
|
|
|
|
pdf.CellFormat(w[j], 7, str, "1", 0, "C", false, 0, "")
|
|
|
|
|
}
|
|
|
|
|
pdf.Ln(-1)
|
|
|
|
|
// Data
|
|
|
|
|
for _, c := range countryList {
|
|
|
|
|
pdf.SetX(left)
|
|
|
|
|
pdf.CellFormat(w[0], 6, c.nameStr, "LR", 0, "", false, 0, "")
|
|
|
|
|
pdf.CellFormat(w[1], 6, c.capitalStr, "LR", 0, "", false, 0, "")
|
|
|
|
|
pdf.CellFormat(w[2], 6, strDelimit(c.areaStr, ",", 3),
|
|
|
|
|
"LR", 0, "R", false, 0, "")
|
|
|
|
|
pdf.CellFormat(w[3], 6, strDelimit(c.popStr, ",", 3),
|
|
|
|
|
"LR", 0, "R", false, 0, "")
|
|
|
|
|
pdf.Ln(-1)
|
|
|
|
|
}
|
|
|
|
|
pdf.SetX(left)
|
|
|
|
|
pdf.CellFormat(wSum, 0, "", "T", 0, "", false, 0, "")
|
|
|
|
|
}
|
|
|
|
|
// Colored table
|
|
|
|
|
fancyTable := func() {
|
|
|
|
|
// Colors, line width and bold font
|
|
|
|
|
pdf.SetFillColor(255, 0, 0)
|
|
|
|
|
pdf.SetTextColor(255, 255, 255)
|
|
|
|
|
pdf.SetDrawColor(128, 0, 0)
|
|
|
|
|
pdf.SetLineWidth(.3)
|
|
|
|
|
pdf.SetFont("", "B", 0)
|
|
|
|
|
// Header
|
|
|
|
|
w := []float64{40, 35, 40, 45}
|
|
|
|
|
wSum := 0.0
|
|
|
|
|
for _, v := range w {
|
|
|
|
|
wSum += v
|
|
|
|
|
}
|
|
|
|
|
left := (210 - wSum) / 2
|
|
|
|
|
pdf.SetX(left)
|
|
|
|
|
for j, str := range header {
|
|
|
|
|
pdf.CellFormat(w[j], 7, str, "1", 0, "C", true, 0, "")
|
|
|
|
|
}
|
|
|
|
|
pdf.Ln(-1)
|
|
|
|
|
// Color and font restoration
|
|
|
|
|
pdf.SetFillColor(224, 235, 255)
|
|
|
|
|
pdf.SetTextColor(0, 0, 0)
|
|
|
|
|
pdf.SetFont("", "", 0)
|
|
|
|
|
// Data
|
|
|
|
|
fill := false
|
|
|
|
|
for _, c := range countryList {
|
|
|
|
|
pdf.SetX(left)
|
|
|
|
|
pdf.CellFormat(w[0], 6, c.nameStr, "LR", 0, "", fill, 0, "")
|
|
|
|
|
pdf.CellFormat(w[1], 6, c.capitalStr, "LR", 0, "", fill, 0, "")
|
|
|
|
|
pdf.CellFormat(w[2], 6, strDelimit(c.areaStr, ",", 3),
|
|
|
|
|
"LR", 0, "R", fill, 0, "")
|
|
|
|
|
pdf.CellFormat(w[3], 6, strDelimit(c.popStr, ",", 3),
|
|
|
|
|
"LR", 0, "R", fill, 0, "")
|
|
|
|
|
pdf.Ln(-1)
|
|
|
|
|
fill = !fill
|
|
|
|
|
}
|
|
|
|
|
pdf.SetX(left)
|
|
|
|
|
pdf.CellFormat(wSum, 0, "", "T", 0, "", false, 0, "")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pdf.AddPage()
|
|
|
|
|
|
|
|
|
|
pdf.AddUTF8Font("SIMFANG", "", "./SIMFANG.TTF")
|
|
|
|
|
pdf.SetFont("SIMFANG", "", float64(12))
|
|
|
|
|
pdf.SetXY(0, float64(40))
|
|
|
|
|
|
|
|
|
|
imgFileStr := "./static/assets/img/zking_logo.png"
|
|
|
|
|
infoPtr := pdf.RegisterImage(imgFileStr, "")
|
|
|
|
|
imgWd, imgHt := infoPtr.Extent()
|
|
|
|
|
pdf.Image(imgFileStr, 0, 0, imgWd, imgHt, false, "", 0, "")
|
|
|
|
|
pdf.Cell(40, 10, `注意:请认准阅读所附条款,尤其是黑体部分内容`)
|
|
|
|
|
|
|
|
|
|
pdf.Ln(-1)
|
|
|
|
|
pdf.SetFontSize(20)
|
|
|
|
|
pdf.Cell(40, 10, "投标保证保险投保单")
|
|
|
|
|
pdf.Ln(-1)
|
|
|
|
|
pdf.SetFontSize(10)
|
|
|
|
|
pdf.Cell(40, 10, "在您填写本投保单前,请仔细阅读《紫金财产保险股份有限公司投标保证保险条款》 ,特别注意条款中有")
|
|
|
|
|
pdf.Ln(5)
|
|
|
|
|
pdf.Cell(40, 10, "关保险责任、 免除保险人责任和投保人、被保险人义务的规定, 同时听取本公司就条款所做的说明,")
|
|
|
|
|
pdf.Ln(5)
|
|
|
|
|
pdf.Cell(40, 10, "并可就 其中内容要求本公司做出解释。在您已充分理解保险条款后,请您如实填写本投保单并签章确认。")
|
|
|
|
|
pdf.Ln(5)
|
|
|
|
|
pdf.CellFormat(30, 30, "投保人(投标人)", "1", 0, "", false, 0, "")
|
|
|
|
|
pdf.CellFormat(40, 6, "法人名称/自然人姓名", "1", 0, "", false, 0, "")
|
|
|
|
|
pdf.CellFormat(60, 6, "", "1", 0, "", false, 0, "")
|
|
|
|
|
pdf.Ln(-1)
|
|
|
|
|
pdf.SetX(40)
|
|
|
|
|
pdf.CellFormat(40, 6, "证件类型", "1", 0, "", false, 0, "")
|
|
|
|
|
pdf.CellFormat(40, 6, "", "1", 0, "", false, 0, "")
|
|
|
|
|
pdf.CellFormat(40, 6, "证件号码", "1", 0, "", false, 0, "")
|
|
|
|
|
//pdf.MultiCell(40, 6, "证件号码", "1", "", false)
|
|
|
|
|
pdf.CellFormat(40, 6, "", "1", 0, "", false, 0, "")
|
|
|
|
|
pdf.Ln(-1)
|
|
|
|
|
pdf.SetX(40)
|
|
|
|
|
pdf.CellFormat(40, 18, "法人性质", "1", 0, "", false, 0, "")
|
|
|
|
|
//pdf.MultiCell(40, 6, "□国有 ☑集体 □民营 □私营 □外资 □合资 □其他", "1", "", false)
|
|
|
|
|
pdf.CellFormat(40, 18, "□国有 ☑集体 □民营 □私营 □外资 □合资 □其他", "1", 0, "", false, 0, "")
|
|
|
|
|
pdf.CellFormat(40, 18, "法人资质", "1", 0, "", false, 0, "")
|
|
|
|
|
pdf.CellFormat(40, 18, "□特级 ☑一级 □二级 □三级", "1", 0, "", false, 0, "")
|
|
|
|
|
//pdf.MultiCell(40, 6, "□特级 ☑一级 □二级 □三级", "1", "", false)
|
|
|
|
|
pdf.Ln(5)
|
|
|
|
|
pdf.Ellipse(30, 15, 20, 10, 0, "D")
|
|
|
|
|
pdf.Ln(10)
|
|
|
|
|
pdf.SetFont("Arial", "", 14)
|
|
|
|
|
|
|
|
|
|
basicTable()
|
|
|
|
|
pdf.AddPage()
|
|
|
|
|
improvedTable()
|
|
|
|
|
pdf.AddPage()
|
|
|
|
|
fancyTable()
|
|
|
|
|
err := pdf.OutputFileAndClose("./test2.pdf")
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println(err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func gen2() {
|
|
|
|
|
const (
|
|
|
|
|
thin = 0.2
|
|
|
|
|
thick = 3.0
|
|
|
|
|
)
|
|
|
|
|
pdf := gofpdf.New("", "", "", "")
|
|
|
|
|
pdf.SetFont("Helvetica", "", 12)
|
|
|
|
|
pdf.SetFillColor(200, 200, 220)
|
|
|
|
|
pdf.AddPage()
|
|
|
|
|
|
|
|
|
|
y := 15.0
|
|
|
|
|
pdf.Text(10, y, "Circles")
|
|
|
|
|
pdf.SetFillColor(200, 200, 220)
|
|
|
|
|
pdf.SetLineWidth(thin)
|
|
|
|
|
pdf.Circle(20, y+15, 10, "D")
|
|
|
|
|
pdf.Circle(45, y+15, 10, "F")
|
|
|
|
|
pdf.Circle(70, y+15, 10, "FD")
|
|
|
|
|
pdf.SetLineWidth(thick)
|
|
|
|
|
pdf.Circle(95, y+15, 10, "FD")
|
|
|
|
|
pdf.SetLineWidth(thin)
|
|
|
|
|
|
|
|
|
|
y += 40.0
|
|
|
|
|
pdf.Text(10, y, "Ellipses")
|
|
|
|
|
pdf.SetFillColor(220, 200, 200)
|
|
|
|
|
pdf.Ellipse(30, y+15, 20, 10, 0, "D")
|
|
|
|
|
pdf.Ellipse(75, y+15, 20, 10, 0, "F")
|
|
|
|
|
pdf.Ellipse(120, y+15, 20, 10, 0, "FD")
|
|
|
|
|
pdf.SetLineWidth(thick)
|
|
|
|
|
pdf.Ellipse(165, y+15, 20, 10, 0, "FD")
|
|
|
|
|
pdf.SetLineWidth(thin)
|
|
|
|
|
|
|
|
|
|
y += 40.0
|
|
|
|
|
pdf.Text(10, y, "Curves (quadratic)")
|
|
|
|
|
pdf.SetFillColor(220, 220, 200)
|
|
|
|
|
pdf.Curve(10, y+30, 15, y-20, 40, y+30, "D")
|
|
|
|
|
pdf.Curve(45, y+30, 50, y-20, 75, y+30, "F")
|
|
|
|
|
pdf.Curve(80, y+30, 85, y-20, 110, y+30, "FD")
|
|
|
|
|
pdf.SetLineWidth(thick)
|
|
|
|
|
pdf.Curve(115, y+30, 120, y-20, 145, y+30, "FD")
|
|
|
|
|
pdf.SetLineCapStyle("round")
|
|
|
|
|
pdf.Curve(150, y+30, 155, y-20, 180, y+30, "FD")
|
|
|
|
|
pdf.SetLineWidth(thin)
|
|
|
|
|
pdf.SetLineCapStyle("butt")
|
|
|
|
|
|
|
|
|
|
y += 40.0
|
|
|
|
|
pdf.Text(10, y, "Curves (cubic)")
|
|
|
|
|
pdf.SetFillColor(220, 200, 220)
|
|
|
|
|
pdf.CurveBezierCubic(10, y+30, 15, y-20, 10, y+30, 40, y+30, "D")
|
|
|
|
|
pdf.CurveBezierCubic(45, y+30, 50, y-20, 45, y+30, 75, y+30, "F")
|
|
|
|
|
pdf.CurveBezierCubic(80, y+30, 85, y-20, 80, y+30, 110, y+30, "FD")
|
|
|
|
|
pdf.SetLineWidth(thick)
|
|
|
|
|
pdf.CurveBezierCubic(115, y+30, 120, y-20, 115, y+30, 145, y+30, "FD")
|
|
|
|
|
pdf.SetLineCapStyle("round")
|
|
|
|
|
pdf.CurveBezierCubic(150, y+30, 155, y-20, 150, y+30, 180, y+30, "FD")
|
|
|
|
|
pdf.SetLineWidth(thin)
|
|
|
|
|
pdf.SetLineCapStyle("butt")
|
|
|
|
|
|
|
|
|
|
y += 40.0
|
|
|
|
|
pdf.Text(10, y, "Arcs")
|
|
|
|
|
pdf.SetFillColor(200, 220, 220)
|
|
|
|
|
pdf.SetLineWidth(thick)
|
|
|
|
|
pdf.Arc(45, y+35, 20, 10, 0, 0, 180, "FD")
|
|
|
|
|
pdf.SetLineWidth(thin)
|
|
|
|
|
pdf.Arc(45, y+35, 25, 15, 0, 90, 270, "D")
|
|
|
|
|
pdf.SetLineWidth(thick)
|
|
|
|
|
pdf.Arc(45, y+35, 30, 20, 0, 0, 360, "D")
|
|
|
|
|
pdf.SetLineCapStyle("round")
|
|
|
|
|
pdf.Arc(135, y+35, 20, 10, 135, 0, 180, "FD")
|
|
|
|
|
pdf.SetLineWidth(thin)
|
|
|
|
|
pdf.Arc(135, y+35, 25, 15, 135, 90, 270, "D")
|
|
|
|
|
pdf.SetLineWidth(thick)
|
|
|
|
|
pdf.Arc(135, y+35, 30, 20, 135, 0, 360, "D")
|
|
|
|
|
pdf.SetLineWidth(thin)
|
|
|
|
|
pdf.SetLineCapStyle("butt")
|
|
|
|
|
|
|
|
|
|
x1 := 10.0
|
|
|
|
|
y1 := 10.0
|
|
|
|
|
w1 := 5.0
|
|
|
|
|
h1 := 5.0
|
|
|
|
|
|
|
|
|
|
// 绘制复选框
|
|
|
|
|
pdf.Rect(x1, y1, w1, h1, "D") // 边框
|
|
|
|
|
pdf.Rect(x1+1, y+1, w1-2, h1-2, "DF")
|
|
|
|
|
|
|
|
|
|
err := pdf.OutputFileAndClose("./test3.pdf")
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println(err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type pdfTable struct {
|
|
|
|
|
pdf *gofpdf.Fpdf
|
|
|
|
|
columnYList []float64
|
|
|
|
|
style string // 风格 F仅填充 D仅边框 或者DF两个都要
|
|
|
|
|
alignStr string // 对其方式 LCR为水平的左、中、右,TMBA为垂直的上、中、下、基准线
|
|
|
|
|
fontH float64 // 字体高度
|
|
|
|
|
cells []pdfCell //
|
|
|
|
|
x float64
|
|
|
|
|
y float64
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type point struct {
|
|
|
|
|
x float64
|
|
|
|
|
y float64
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type pdfCell struct {
|
|
|
|
|
w float64 // 宽度
|
|
|
|
|
h float64 // 行高
|
|
|
|
|
txtStr string // 文本
|
|
|
|
|
lines int // 判断文本会占几行
|
|
|
|
|
x float64
|
|
|
|
|
y float64
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *pdfTable) addRows(style string, alignStr string, cells ...pdfCell) {
|
|
|
|
|
s.style = style
|
|
|
|
|
s.alignStr = alignStr
|
|
|
|
|
_, s.fontH = s.pdf.GetFontSize()
|
|
|
|
|
// 记录需要的最高行高
|
|
|
|
|
x, y := s.pdf.GetXY() // 获取当前位置
|
|
|
|
|
s.x = x
|
|
|
|
|
s.y = y
|
|
|
|
|
x = s.x
|
|
|
|
|
y = s.y
|
|
|
|
|
for column, cell := range cells {
|
|
|
|
|
y = s.columnYList[column]
|
|
|
|
|
lines := s.pdf.SplitText(cell.txtStr, cell.w)
|
|
|
|
|
//h := float64(len(lines)) * cell.h
|
|
|
|
|
cell.lines = len(lines)
|
|
|
|
|
fmt.Println(x, y, len(lines), lines)
|
|
|
|
|
cell.x = x
|
|
|
|
|
cell.y = y
|
|
|
|
|
x = x + cell.w
|
|
|
|
|
y = y + cell.h
|
|
|
|
|
s.columnYList[column] = y
|
|
|
|
|
s.cells = append(s.cells, cell)
|
|
|
|
|
}
|
|
|
|
|
s.write()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *pdfTable) write() {
|
|
|
|
|
// 手动记录并移动坐标
|
|
|
|
|
for _, c := range s.cells {
|
|
|
|
|
usedH := float64(c.lines) * s.fontH
|
|
|
|
|
margin := (c.h - usedH) / 2.0
|
|
|
|
|
s.pdf.Rect(c.x, c.y, c.w, c.h, s.style)
|
|
|
|
|
s.pdf.SetXY(c.x, c.y+margin) // 保持单元格内的文字有边距
|
|
|
|
|
s.pdf.MultiCell(c.w, s.fontH, c.txtStr, "", s.alignStr, false)
|
|
|
|
|
}
|
|
|
|
|
// 重置变量
|
|
|
|
|
s.cells = nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func gen3() {
|
|
|
|
|
pdf := gofpdf.New("P", "mm", "A4", "")
|
|
|
|
|
pdf.AddPage()
|
|
|
|
|
pdf.AddUTF8Font("SIMFANG", "", "./SIMFANG.TTF")
|
|
|
|
|
pdf.SetFont("SIMFANG", "", float64(10))
|
|
|
|
|
myPdf := pdfTable{pdf: pdf}
|
|
|
|
|
myPdf.columnYList = make([]float64, 5)
|
|
|
|
|
|
|
|
|
|
width, _ := pdf.GetPageSize() // 页面宽度
|
|
|
|
|
left, _, right, _ := pdf.GetMargins() // 左右边距
|
|
|
|
|
usable := width - left - right // 可用的页面宽度
|
|
|
|
|
_, h := pdf.GetFontSize() // 字体高度
|
|
|
|
|
tableH := h + 2 // 行高 多出2mm的边距
|
|
|
|
|
tableWidth := usable / 5 // 每个单元个的宽度
|
|
|
|
|
pdf.SetFillColor(233, 233, 233)
|
|
|
|
|
// 表头
|
|
|
|
|
myPdf.addRows("", "CM", []pdfCell{
|
|
|
|
|
{w: 20, h: 7 * tableH, txtStr: "投保人(投标人)"},
|
|
|
|
|
{w: 50, h: tableH, txtStr: "法人名称/自然人姓名"},
|
|
|
|
|
{w: 3 * tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "CM", []pdfCell{
|
|
|
|
|
{w: 20, h: 0, txtStr: ""},
|
|
|
|
|
{w: 50, h: tableH, txtStr: "证件类型"},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: "证件号码"},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "LM", []pdfCell{
|
|
|
|
|
{w: 20, h: 0, txtStr: ""},
|
|
|
|
|
{w: 50, h: 3 * tableH, txtStr: "法人性质"},
|
|
|
|
|
{w: tableWidth, h: 3 * tableH, txtStr: "□国有 ☑集体 □民营 □私营 □外资 □合资 □其他"},
|
|
|
|
|
{w: tableWidth, h: 3 * tableH, txtStr: "法人资质"},
|
|
|
|
|
{w: tableWidth, h: 3 * tableH, txtStr: "□特级 ☑一级 □二级 □三级"},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "CM", []pdfCell{
|
|
|
|
|
{w: 20, h: 0, txtStr: ""},
|
|
|
|
|
{w: 50, h: tableH, txtStr: "联系人"},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: "联系电话"},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "CM", []pdfCell{
|
|
|
|
|
{w: 20, h: 0, txtStr: ""},
|
|
|
|
|
{w: 50, h: tableH, txtStr: "地址"},
|
|
|
|
|
{w: 3 * tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "CM", []pdfCell{
|
|
|
|
|
{w: 20, h: 5 * tableH, txtStr: "被保险人(招标人)"},
|
|
|
|
|
{w: 50, h: tableH, txtStr: "法人名称/自然人姓名"},
|
|
|
|
|
{w: 3 * tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "CM", []pdfCell{
|
|
|
|
|
{w: 20, h: 0, txtStr: ""},
|
|
|
|
|
{w: 50, h: tableH, txtStr: "证件类型"},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: "证件号码"},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "CM", []pdfCell{
|
|
|
|
|
{w: 20, h: 0, txtStr: ""},
|
|
|
|
|
{w: 50, h: tableH, txtStr: "招标文件编号"},
|
|
|
|
|
{w: 3 * tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "CM", []pdfCell{
|
|
|
|
|
{w: 20, h: 0, txtStr: ""},
|
|
|
|
|
{w: 50, h: tableH, txtStr: "联系人"},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: "联系电话"},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "CM", []pdfCell{
|
|
|
|
|
{w: 20, h: 0, txtStr: ""},
|
|
|
|
|
{w: 50, h: tableH, txtStr: "地址"},
|
|
|
|
|
{w: 3 * tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "CM", []pdfCell{
|
|
|
|
|
{w: 20, h: 3 * tableH, txtStr: "投标项目"},
|
|
|
|
|
{w: 50, h: tableH, txtStr: "项目名称"},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: "立项文件号"},
|
|
|
|
|
{w: tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "CM", []pdfCell{
|
|
|
|
|
{w: 20, h: 0, txtStr: ""},
|
|
|
|
|
{w: 50, h: tableH, txtStr: "项目性质"},
|
|
|
|
|
{w: 3 * tableWidth, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "LM", []pdfCell{
|
|
|
|
|
{w: 20, h: 0, txtStr: ""},
|
|
|
|
|
{w: 50, h: tableH, txtStr: "项目预计金额"},
|
|
|
|
|
{w: 3 * tableWidth, h: tableH, txtStr: "(人民币)大写: 小写:"},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "LM", []pdfCell{
|
|
|
|
|
{w: 70, h: tableH, txtStr: "保险金额"},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 3 * tableWidth, h: tableH, txtStr: "(人民币)大写: 小写:"},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "LM", []pdfCell{
|
|
|
|
|
{w: 70, h: tableH, txtStr: "保险费"},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 3 * tableWidth, h: tableH, txtStr: "(人民币)大写: 小写:"},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "LM", []pdfCell{
|
|
|
|
|
{w: 70, h: tableH, txtStr: "绝对免赔额/免赔率"},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 3 * tableWidth, h: tableH, txtStr: " /"},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "LM", []pdfCell{
|
|
|
|
|
{w: 70, h: 16 * tableH, txtStr: "特别约定"},
|
|
|
|
|
{w: 0, h: 16 * tableH, txtStr: ""},
|
|
|
|
|
{w: 3 * tableWidth, h: 16 * tableH, txtStr: "1、本保单为见索即付保单,本保单发生保险事故,由保险人先行赔付后,享有对 投保人的代位求偿权。2、本保单项下,本保险在投标有效期到期后28日(含)内或被保 险人延长投标有效期后到期日后28日(含)内保持有效,延长投标有效期无需通知本保险 人,但任何索赔要求应在投标有效期内送达我方。保险失效后由平台将本保单交投标人 退回我司注销。3、兹承诺,在收到被保险人书面通知,说明下列中的任何一条时,保 证在10日内无条件给付给被保险人金额为不超过保险金额的款项。1)投保人在投标有效 期内撤销或修改其投标文件的;2)投保人在中标后,非因不可抗力原因放弃中标、无正 当理由不与招标人订立合同、在签订合同时向招标人提出附加条件、或者不按招标文件 要求提交履约担保金的;3)投标人的投标文件存在《福建省住房和城乡建设厅关于施工 招标项目电子投标文件置同认定与处理的指导意见》 (闽建筑[2018]29号)规定的雷同情 形之一4)投标人中标后,因违法行为导致中标被依法确认无效的;5) 法律、法规规定 的其他没收投标保险金情形。4、我单位在收到招标人索赔申请后10日内无条件给予先 行支付预赔款,赔付流程将根据我单位向宁德市公共资源交易中心提供的《金融机构理 赔流程标准》执行。本保险项下所有权利和义务均受中华人民共和国法律管辖和制约。 查验保函网址:http://www.zking.com/dzbdxzcx.jhtml\n尊敬的客户,您可以通过电话(95312)、公司柜面或登陆公司网站\n(www.zking.com)查询您的保单信息、状态以及理赔情况。如您对查询结果有异议, 请及时致电本公司。\n无其他特别约定"},
|
|
|
|
|
{w: 0, h: 16 * tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: 16 * tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "LM", []pdfCell{
|
|
|
|
|
{w: 70, h: tableH, txtStr: "保险合同争议解决方式"},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 3 * tableWidth, h: tableH, txtStr: "诉讼"},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
myPdf.addRows("", "LM", []pdfCell{
|
|
|
|
|
{w: 70, h: tableH, txtStr: "司法管辖"},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 3 * tableWidth, h: tableH, txtStr: "中华人民共和国管辖(港澳台除外)"},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
{w: 0, h: tableH, txtStr: ""},
|
|
|
|
|
}...)
|
|
|
|
|
|
|
|
|
|
err := pdf.OutputFileAndClose("./test4.pdf")
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println(err)
|
|
|
|
|
}
|
|
|
|
|
}
|