signintech / gopdf

A simple library for generating PDF written in Go lang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adobe 110 error after generation of document

bobc82 opened this issue · comments

Hi, i tried to generate a pdf document with the gopdf library using a template downloaded from a storage location. The method works fine and when i see the document generated in the browser, it will open fine. But once the the document is downloaded in a local folder and when i'll try to open it, adobe 110 error occurs. PS: Template doesn't contain errors.
I'll try to show a simplified version of the method i wrote:

pdf := gopdf.GoPdf{}
pdf.Start(gopdf.Config{PageSize: gopdf.Rect{W: 841.89, H: 595.28}})
pdf.AddPageWithOption(gopdf.PageOption{PageSize: &gopdf.Rect{W: 841.89, H: 595.28}})
fileUrl, errSt := storage.Get("private", <path>, 10*60*time.Second)
if errSt != nil {
	return errSt.Error() + "Errore 114", errSt
}
errFile := DownloadFile("template.pdf", fileUrl)
if errFile != nil {
	return errFile.Error() + "Errore 121", errFile
}
tpl1 := pdf.ImportPage("template.pdf", 1, "/MediaBox")
pdf.UseImportedTemplate(tpl1, 0, 0, 841.89, 595.28)

filePdf := pdf.GetBytesPdf()
fileReader := bytes.NewReader(filePdf)

storage.Upload("private", fileReader, <path>, fileReader.Size(), "application/pdf", nil)
return "ok", nil

Importing and templating pdf in gopdf is done by github.com/phpdave11/gofpdi. I think you should try reporting the issue to gofpdi project.