[Flow] Create PDF from template
Mark Kuiphuis
mark at capesso.com.au
Fri Jul 4 07:37:49 CEST 2014
We are using Famelo.PDF for creating PDF's from a FLUID template and it
works pretty good (I personally miss the opportunity to customize output
format (A4, A5, portrait, landscape) without creating separate functions
for all these flavours).
But a customer will not touch a FLUID template.
However, a lot of companies are not used to ODT either.....Tried to do
it with docx, but it's a real pain getting it right....
But we also use a custom script to first do a mail merge in ODT and
finally convert that to PDF.
To be able to convert odt to pdf on the server, you not only need to
install openoffice binary, but also allow the user running the webserver
process execute access to that binary.
The openoffice command I use to convert an ODT to PDF is:
sudo '/path/to/soffice --headless --convert-to-pdf ' . $file . '
--outdir ' . $outputFolder;
Then in the folder /etc/sudoers.d/ I have created a file with the
following contents:
apacheUser ALL=(root) NOPASSWD: /path/to/soffice
(I was unable to execute soffice without this line present). But maybe
this is a security issue?
Cheers, Mark
On 4/07/2014 1:57 am, Christian Müller wrote:
> Hi all,
>
> basically that is what TYPO3.TcPdf does (render HTML from Fluid, then
> put that trough tcpdf), but I currently don't use it and so it is not
> updated to current Flow. Might be interesting to do that and maybe bring
> it from TYPO3 to Flowpack and get it working and updated again.
>
> Cheers,
> Christian
>
> Christian Loock wrote:
>> Hello,
>>
>> well yeah, that can be troublesome. I'm pretty sure that tcpdf can
>> generate PDF out of HTML source. You also might want to have a look at
>> Apache FOP. It is a very powerfull tool that allows you to generate PDFs
>> out of XML Templates. I used this a few years ago to dyamically generate
>> PDFs, with content the user could manipulate. The downside would be,
>> that you have to learn xsl:fo. The big advantage is, that you
>> theoratically can generate PDFs out of every format you can convert
>> using xsl stylesheets.
>>
>> Cheers
>>
>>
>> On 03.07.2014 16:48, Roberto Torresani wrote:
>>> Hi
>>>
>>> Thank you for the speedy reply.
>>> I forgot to write that I need to create PDF from a template/file that my
>>> customer could change.
>>> For this motive I think to use odt, because he can modify template with
>>> openoffice (or libreoffice , ...)
>>>
>>> Thank you for the quick reply.
>>> I forgot to write that I would need to create PDF from a template/file
>>> that
>>> my customer can change.
>>> For this reason I was thinking of using odt, because he can modify the
>>> template with OpenOffice (or LibreOffice, ...). Should be included in the
>>> template marks, and cycles to fill the tables on multiple lines.
>>> A little more complicated than what I had written before, sorry.
>>>
>>> Thank you again
>>> Roberto
>>>
>>>
>>>
>>> 2014-07-03 16:34 GMT+02:00 Roberto Torresani <erreti at gmail.com>:
>>>
>>>> Hi all
>>>> In my Flow project I need to create PDF reports from a template (odt?).
>>>> I'be been looking around but I haven't found anything.
>>>> What is your tips on this task? Do you use some php library or other
>>>> solutions?
>>>>
>>>> Thank you
>>>> Roberto
>>>>
>>>> --
>>>> Certified TYPO3 Integrator
>>>>
>>>
>>>
>>
--
--
Mark Kuiphuis
More information about the Flow
mailing list