GithubHelp home page GithubHelp logo

Comments (3)

sampila avatar sampila commented on August 24, 2024

Hi @schooltech,

Currently the issue is taken care and will be available in the next release.

Thanks

from unipdf.

sampila avatar sampila commented on August 24, 2024

Hi @schooltech,

We release new UniPDF version to solve this issue https://github.com/unidoc/unipdf/releases/tag/v3.52.0.

We closing this issue for now and you can re-open this issue if you still having problem after updating to the latest version of UniPDF.

from unipdf.

schooltech avatar schooltech commented on August 24, 2024

Hi @sampila , I just tested the latest v3.52.0 version and the bug is still there when span rows across pages ,
`
font, err := model.NewCompositePdfFontFromTTFFile("./web/public/dist/fonts/microsoft.ttf")
if err != nil {
log.Fatal(err)
}
c := creator.New()
c.EnableFontSubsetting(font)
var PPMM = float64(72 * 1.0 / 25.4)
c.SetPageSize(creator.PageSize{210 * PPMM, 297 * PPMM})
c.SetPageMargins(50, 50, 50, 50)

drawCell := func(table *creator.Table, text string, font *model.PdfFont, colspan int, rowspan int) {
	p := c.NewStyledParagraph()
	p.Append(text).Style.Font = font
	p.SetMargins(0, 0, 5, 5)

	cell := table.MultiCell(rowspan, colspan)
	cell.SetBorder(creator.CellBorderSideAll, creator.CellBorderStyleSingle, 0.5)
	cell.SetHorizontalAlignment(creator.CellHorizontalAlignmentCenter)
	cell.SetVerticalAlignment(creator.CellVerticalAlignmentMiddle)
	cell.SetIndent(0)
	cell.SetContent(p)
}
drawFooter("", c, font)

list := make([]map[string]string, 0)
for i := 0; i < 200; i++ {
	m := make(map[string]string)
	m[fmt.Sprintf("row-%v", i)] = fmt.Sprintf("name:tom-%v;no:naom-%v;p-0%v", i, i, i)
	list = append(list, m)
}

table := c.NewTable(3)
table.SetMargins(10, 10, 10, 10)

index := 0
for _, mp := range list {
	for k, v := range mp {
		items := strings.Split(v, ";") 
		drawCell(table, k, font, 1, len(items))
		subIndex := 0
		for _, item := range items {
			drawCell(table, item, font, 1, 1)
			if subIndex == 0 {
				drawCell(table, k, font, 1, len(items))
			}
			subIndex++
		}

	}
	index++
}

c.Draw(table)

c.WriteToFile("d:/span-row-over-page.pdf")

`
span-rows-across-pages.pdf

from unipdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.