pdf importer with maroto

Viewed 54

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?

2 Answers

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).

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

importPdf imports a PDF into the current PDF document linkPdf 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

Related