1283 Posts
Bucklash
6 years ago
Topic

Ho Folks

I want to make pdf's out of my content views.

I have looked at Phoca but didn't like it.

Would prefer to use more "seblod" focused way.

Anyhow, as an example, I have a content type called INVOICE.

I would like to send this invoice as a pdf to the relevant party.

Any suggestions?

Cheers

Jon

Get a VIP membership
215 Posts
iliil
6 years ago
7
Level 1

Hello Jon

I don't have a solution (yet) but I need this as well for exporting business documents in my client's intranet.

What I need is to be able to fill the PDF template with SEBLOD values and export. 

So maybe we can share our findings :)

cheers

Michal

1283 Posts
Bucklash
6 years ago
6
Level 2

Yeah cool...

I have been looking at this:

https://www.phpflow.com/php/generate-pdf-file-mysql-database-using-php/

Will have a go over next couple of days hopefully, and then if works then someone could make a plugin for seblod with it :)

215 Posts
iliil
6 years ago
5
Level 3

Look at these 5, please.

https://ourcodeworld.com/articles/read/226/top-5-best-open-source-pdf-generation-libraries-for-php

I kind of like the last one TCPDF.

I have no experience with this, just thinking...that the way to go is to create a SEBLOD link plugin, which will asynchronously execute a PHP script that will generate and return the PDF file.

I looked very quickly at the ways, how PDF's are created by the libraries mentioned above and it seems there are two options:

1) Some libraries e.g. SNAPPY perform PDF generation from an URL of an HTML page. That can be done with an URL to a SEBLOD list displaying only one item (by ID) in the desired template and a raw view.

2) The libraries like TCPDF generate PDF directly from coding instructions. So the PHP ajax script could load the SEBLOD field values from the article using jCckContent class and generate the PDF directly.

Both ideas, however, are project specific, not easily reusable...

Michal

1283 Posts
Bucklash
6 years ago
4
Level 4

Hi Michal

I have created a Github Repository https://github.com/Bucklash/jb_pdf_tcpdf

Not got much done at all.

Will do more over the coming days/weeks/years!!

If you do the same then that would be cool.

Any suggestions, let's hear them.

My first thoughts are:

  • Plugin has parameters for user to fill ie margins etc.
  • Plugin has Text fields for Header and footer Field (same as Email Plugin's Message field with same functionality i.e. string replace)
  • Plugin has same options as Email Plug i.e Create PDF Never||Always||Add||Edit
  • Parameters, tcpdf has a lot!
  • Pages, how many pages should the plugin be able to generate. Each page is hard coded so needs to be a practical number....

TCPDF:

215 Posts
iliil
6 years ago
3
Level 5

Thanks Jon.

There are much more urgent tasks now in front of me too. But I'll definitely need that, so I will contribute to the development for sure soon.

Michal

1283 Posts
Bucklash
6 years ago
2
Level 6

Hi Michal

I have had a go at plugin, 

kinda okay but not working yet so really, not ok...

I can create pdf but no content gets applied plus a few other issues.

First effort at making plugin...

Gonna keep on trying for a while otherwise I will just make relevant data set in afterstore field, kinda hard coded..

If wanna check it out on github be my guest but is probably hard to follow :)

693 Posts
rpoy
5 years ago
1
Level 7

Hey Guys!

Ive been working on a project to create PDFs from a content type.  It would be great to have plugin.  I have been using jsPDF to create the pdfs.

Check out this project: https://github.com/MrRio/jsPDF

It appears that the other projects work similar to jsPDF.  Basicly for each content type field, I read the value, then forced the location on the PDF.

In my project I concentrated on the mainbody position.

I think something more generic could be done...

Randy

1283 Posts
Bucklash
5 years ago
0
Level 8

Nice one Randy!!

When have time I will have a look, keen to see how you did it

Get a VIP membership