-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Not able to process large content in table cell #568
Comments
Welcome! Thanks for posting your first issue. The way things work here is that while customer issues are prioritized, other issues go into our backlog where they are assessed and fitted into the roadmap when suitable. If you need to get this done, consider buying a license which also enables you to use it in your commercial products. More information can be found on https://unidoc.io/ |
Hi @ajay95573, Currently we are trying to fix the issue with that, currently to fix the issue you need to set the Here's the modified code for the
|
Description
Whenever trying to add large content in table cell, it's getting stuck in pdf processing, draw() method not working.
The content i am trying to add is
content := "Maecenas <a href=\"https://www.w3.org/WAI/\">with a link</a> tempor nibh gravida nunc laoreet, ut rhoncus justo ultricies. Mauris nec purus sit amet" + "Maecenas <a href=\"https://www.w3.org/WAI/\">with a link</a> tempor nibh gravida nunc laoreet, ut rhoncus justo ultricies. Mauris nec purus sit amet" + "Maecenas <a href=\"https://www.w3.org/WAI/\">with a link</a> tempor nibh gravida nunc laoreet, ut rhoncus justo ultricies. Mauris nec purus sit amet" + "Maecenas <a href=\"https://www.w3.org/WAI/\">with a link</a> tempor nibh gravida nunc laoreet, ut rhoncus justo ultricies. Mauris nec purus sit amet" + "Maecenas <a href=\"https://www.w3.org/WAI/\">with a link</a> tempor nibh gravida nunc laoreet, ut rhoncus justo ultricies. Mauris nec purus sit amet" + "Maecenas <a href=\"https://www.w3.org/WAI/\">with a link</a> tempor nibh gravida nunc laoreet, ut rhoncus justo ultricies. Mauris nec purus sit amet" + "Maecenas <a href=\"https://www.w3.org/WAI/\">with a link</a> tempor nibh gravida nunc laoreet, ut rhoncus justo ultricies. Mauris nec purus sit amet" + "Maecenas <a href=\"https://www.w3.org/WAI/\">with a link</a> tempor nibh gravida nunc laoreet, ut rhoncus justo ultricies. Mauris nec purus sit amet" + "Maecenas <a href=\"https://www.w3.org/WAI/\">with a link</a> tempor nibh gravida nunc laoreet, ut rhoncus justo ultricies. Mauris nec purus sit amet" + "Maecenas <a href=\"https://www.w3.org/WAI/\">with a link</a> tempor nibh gravida nunc laoreet, ut rhoncus justo ultricies. Mauris nec purus sit amet" + "Maecenas <a href=\"https://www.w3.org/WAI/\">with a link</a> tempor nibh gravida nunc laoreet, ut rhoncus justo ultricies. Mauris nec purus sit amet" + "Maecenas <a href=\"https://www.w3.org/WAI/\">with a link</a> tempor nibh gravida nunc laoreet, ut rhoncus justo ultricies. Mauris nec purus sit amet" + "Maecenas <a href=\"https://www.w3.org/WAI/\">with a link</a> tempor nibh gravida nunc laoreet, ut rhoncus justo ultricies. Mauris nec purus sit amet"
Expected Behavior
Above mentioned content should be inserted into the cell.
Actual Behavior
Steps to reproduce the behavior:
Attachments
`/*
*/
package main
import (
"fmt"
"github.com/unidoc/unipdf/v3/common/license"
"github.com/unidoc/unipdf/v3/contentstream/draw"
"github.com/unidoc/unipdf/v3/creator"
"github.com/unidoc/unipdf/v3/model"
"log"
"net/http"
)
func init() {
// Make sure to load your metered License API key prior to using the library.
// If you need a key, you can sign up and create a free one at https://cloud.unidoc.io
err := license.SetMeteredKey(
ba01d501fa945e7537275af003ab159a8c61af4ac0f265d4a4ec424c9df29bc7
)if err != nil {
panic(err)
}
}
func main() {
// Serve the PDF via HTTP
http.HandleFunc("/generate-pdf", PDFHandler)
}
func PDFHandler(w http.ResponseWriter, r *http.Request) {
// Create report fonts.
font, err := model.NewStandard14Font("Helvetica")
if err != nil {
log.Fatal(err)
}
}
func drawFrontPage(c *creator.Creator, font, fontBold *model.PdfFont) {
c.CreateFrontPage(func(args creator.FrontpageFunctionArgs) {
p := c.NewStyledParagraph()
p.SetMargins(0, 0, 300, 0)
p.SetTextAlignment(creator.TextAlignmentCenter)
}
func drawFooter(c *creator.Creator, font, fontBold *model.PdfFont) {
c.DrawFooter(func(block *creator.Block, args creator.FooterFunctionArgs) {
p := c.NewStyledParagraph()
p.SetTextAlignment(creator.TextAlignmentCenter)
}
func customizeTOC(c *creator.Creator, font, fontBold *model.PdfFont) {
// Enable automatic table of contents generation.
c.AddTOC = true
}
func basicUsage(c *creator.Creator, font, fontBold *model.PdfFont) error {
// Create chapter.
ch := c.NewChapter("Basic usage")
ch.SetMargins(0, 0, 50, 0)
ch.GetHeading().SetFont(font)
ch.GetHeading().SetFontSize(18)
ch.GetHeading().SetColor(creator.ColorRGBFrom8bit(72, 86, 95))
}
func contentAlignH(c *creator.Creator, ch *creator.Chapter, font, fontBold *model.PdfFont) {
// Create subchapter.
sc := ch.NewSubchapter("Content horizontal alignment")
sc.SetMargins(0, 0, 30, 0)
sc.GetHeading().SetFont(font)
sc.GetHeading().SetFontSize(13)
sc.GetHeading().SetColor(creator.ColorRGBFrom8bit(72, 86, 95))
}
func contentAlignV(c *creator.Creator, ch *creator.Chapter, font, fontBold *model.PdfFont) {
// Create subchapter.
sc := ch.NewSubchapter("Content vertical alignment")
sc.SetMargins(0, 0, 30, 0)
sc.GetHeading().SetFont(font)
sc.GetHeading().SetFontSize(13)
sc.GetHeading().SetColor(creator.ColorRGBFrom8bit(72, 86, 95))
}
func contentWrapping(c *creator.Creator, ch *creator.Chapter, font, fontBold *model.PdfFont) {
// Create subchapter.
sc := ch.NewSubchapter("Content wrapping")
sc.SetMargins(0, 0, 30, 0)
sc.GetHeading().SetFont(font)
sc.GetHeading().SetFontSize(13)
sc.GetHeading().SetColor(creator.ColorRGBFrom8bit(72, 86, 95))
}
func stylingContent(c *creator.Creator, font, fontBold *model.PdfFont) error {
c.NewPage()
}
func contentBorders(c *creator.Creator, ch *creator.Chapter, font, fontBold *model.PdfFont) {
// Create subchapter.
sc := ch.NewSubchapter("Cell borders")
sc.SetMargins(0, 0, 30, 0)
sc.GetHeading().SetFont(font)
sc.GetHeading().SetFontSize(13)
sc.GetHeading().SetColor(creator.ColorRGBFrom8bit(72, 86, 95))
}
func contentBackground(c *creator.Creator, ch *creator.Chapter, font, fontBold *model.PdfFont) {
// Create subchapter.
sc := ch.NewSubchapter("Cell background")
sc.SetMargins(0, 0, 30, 0)
sc.GetHeading().SetFont(font)
sc.GetHeading().SetFontSize(13)
sc.GetHeading().SetColor(creator.ColorRGBFrom8bit(72, 86, 95))
}
func advancedUsage(c *creator.Creator, font, fontBold *model.PdfFont) error {
c.NewPage()
}
func columnSpan(c *creator.Creator, ch *creator.Chapter, font, fontBold *model.PdfFont) {
// Create subchapter.
sc := ch.NewSubchapter("Column span")
sc.SetMargins(0, 0, 30, 0)
sc.GetHeading().SetFont(font)
sc.GetHeading().SetFontSize(13)
sc.GetHeading().SetColor(creator.ColorRGBFrom8bit(72, 86, 95))
}
func tableHeaders(c *creator.Creator, ch *creator.Chapter, font, fontBold *model.PdfFont) error {
// Create subchapter.
sc := ch.NewSubchapter("Headers")
sc.SetMargins(0, 0, 30, 0)
sc.GetHeading().SetFont(font)
sc.GetHeading().SetFontSize(13)
sc.GetHeading().SetColor(creator.ColorRGBFrom8bit(72, 86, 95))
}
func subtables(c *creator.Creator, ch *creator.Chapter, font, fontBold *model.PdfFont) {
// Create subchapter.
sc := ch.NewSubchapter("Subtables")
sc.SetMargins(0, 0, 30, 0)
sc.GetHeading().SetFont(font)
sc.GetHeading().SetFontSize(13)
sc.GetHeading().SetColor(creator.ColorRGBFrom8bit(72, 86, 95))
}
`
The text was updated successfully, but these errors were encountered: