Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

failed to generate the result PDF #24

Open
unstppbl opened this issue Sep 22, 2020 · 1 comment
Open

failed to generate the result PDF #24

unstppbl opened this issue Sep 22, 2020 · 1 comment

Comments

@unstppbl
Copy link

Why would I receive failed to generate the result PDF error? Running gotenberg in docker-compose, and sending pdf generation request from other service like so:

index, err := gotenberg.NewDocumentFromPath(filename, sourceHTMLPath)
	if err != nil {
		return fmt.Errorf("Error getting document from path: %s", err)
	}
	style, err := gotenberg.NewDocumentFromPath("styles.css", m.cfg.Get("pdf", "stylesPath").String(""))
	if err != nil {
		return fmt.Errorf("Error getting document from path: %s", err)
	}

	font1, err := gotenberg.NewDocumentFromPath("Gilroy-Bold.woff", m.cfg.Get("pdf", "font1path").String(""))
	if err != nil {
		return fmt.Errorf("Error getting document from path: %s", err)
	}

	font2, err := gotenberg.NewDocumentFromPath("Gilroy-ExtraBold.woff", m.cfg.Get("pdf", "font2path").String(""))
	if err != nil {
		return fmt.Errorf("Error getting document from path: %s", err)
	}

	font3, err := gotenberg.NewDocumentFromPath("Gilroy-Light.woff", m.cfg.Get("pdf", "font3path").String(""))
	if err != nil {
		return fmt.Errorf("Error getting document from path: %s", err)
	}

	font4, err := gotenberg.NewDocumentFromPath("Gilroy-Medium.woff", m.cfg.Get("pdf", "font4path").String(""))
	if err != nil {
		return fmt.Errorf("Error getting document from path: %s", err)
	}

	req := gotenberg.NewHTMLRequest(index)

	req.Assets(style, font1, font2, font3, font4)
	req.Margins(gotenberg.NoMargins)
	req.PaperSize(gotenberg.A4)

	if err := m.pdfClient.Store(req, outputPDFPath); err != nil {
		return fmt.Errorf("Error generating pdf: %s", err)
	}
@khndhkx123
Copy link

I had created a pull request to fix this bug.
#34

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants