PDF导入器与Maroto

huangapple go评论73阅读模式
英文:

pdf importer with maroto

问题

我正在尝试开发一个PDF生成器。这个PDF生成器有多个页面。第一页有一些特定的值,目前工作正常。但是第二页有一个用户上传的发票,用户可以上传图像文件或PDF文件。

为此,我正在使用maroto库,当涉及到图像或内容生成时,它的效果很好,但是它不支持导入另一个PDF并与当前PDF合并。

现在我知道maroto使用gofpdf库,而gofpdf有PDI导入器,所以在我看来应该可以实现这样的功能。我在他们的git问题板上没有得到任何回复,所以在这里问一下。

有人可以帮助我吗?或者我的唯一选择是更换库并重新编码?

英文:

I am trying to develop a pdf generator. The pdf generator has multiple page. First page has some specific value with is working fine. But the second page has invoice which user uploads, In this case the user can upload a image file or pdf file.

For this I am using maroto library which works great when it comes to image or content generation but there is no support for import another pdf and merge with current one.

Now i know maroto uses gofpdf library and gofpdf has pdi importer so in my mind it should be possible to implement such feature. I didn't get any reply from their git issue board so asking it here.

Can anyone help me with this?? or my only choice is to change the library and do the coding again?

答案1

得分: 1

我找不到这个问题的解决方案,所以我不得不对系统进行改进。
我解决问题的方法是:

  1. 使用marotopdf库生成一个pdf文件。
  2. 加载第二个pdf文件。
  3. 使用unidoc库合并两个pdf文件(只是将两个pdf文件一个接一个地合并)。

这并不能完全解决我的问题,因为我希望能够在第二个pdf文件上添加公司标志,但目前无法编辑。但它可以完成主要工作(合并两个pdf文件)。

英文:

I could not find a solution for this. So i had to improvise the system
the way I solved the problem is:

  1. generate a pdf using marotopdf library
  2. load the second pdf
  3. use unidoc library and merge 2 pdfs (its just merging 2 pdfs 1 after another)

This is not solving my problem 100% as i would like to have the ability to add company logo on the second pdf which is not editable atm. But its dining the main work (merge 2 pdf).

答案2

得分: 0

我已经创建了一个简单的库来帮助你完成这个任务。它为gofpdf Fpdf类添加了两个方法:

importPdf方法将一个PDF导入到当前的PDF文档中。
linkPdf方法创建一个指向PDF文档的超链接。

它使用cgo来使用pdsys、pdflib和pdflib_pl库。
你可以在这里找到它:https://github.com/jung-kurt/gofpdf

英文:

I've created a simple library to help you with this. It adds two methods to the gofpdf Fpdf class:

<code>importPdf</code> imports a PDF into the current PDF document
<code>linkPdf</code> creates a hyperlink to a PDF document

It uses cgo to use the pdsys, pdflib and pdflib_pllibraries.
You can find it here: https://github.com/jung-kurt/gofpdf

huangapple
  • 本文由 发表于 2022年8月12日 21:11:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/73334745.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定