I have a component in joomla that exports to PDF, the problem that i'm encountering is that the PDF exported is unreadable because the html of the Joomla! page in inserted after and before the pdf itself.
I have made a standard structure of a component and call it like
index.php?option=com_listado_factura&task=exportar_pdf
being com_listado_factura the name of the component and exportar_factura the function of the controller that exports to pdf.
I've looked everywhere and couldn't find the solution, thanks
The solution was to call:
ob_end_clean();
before
$tcpdf->output();
Related
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?
I could not find a solution for this. So i had to improvise the system
the way I solved the problem is:
generate a pdf using marotopdf library
load the second pdf
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
I want to generate a pdf of a form that a user fills and download it to the users computer.
I tried using the Dompdf package from laravel to do this and everything works fine except the design. The generated pdf does not look exactly like the web page, after doing some searching about this issue, I found out that dompdf does not support a few of the css option.
I was wondering whether there are any other free packages like dompdf that I could use which can have rich styling and convert the web page to pdf with the exact design.
I have problems with arabic characters in pdfs when printing invoices
the problem seem to relate to the pdf lib of zend
so i decide to use tcpdf
now most blogs about this just explain the steps to but tcpdf at your lib and call it from your code
but i don’t know where to call it and use it to create my custom pdf then output the pdf
i tried to call it from the get Pdf function from this file
app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php
but i didn’t work, it gives me an error says something is already outputed
where should i use the tcpdf lib and disable the functionality of the default pdf zend lib?
thanks
I am creating a PDF file using DOM pdf and codeigniter as my framework. In that PDF i want to attach already saved PDF's on my server at the end of newly created PDF file. Is that possible with DOM PDF to create a PDF like that.
Presently DOM PDF will not support for merging two pdf files
You can do with PDFTK.
Or
Refer this :
Merge multiple PDF files into one in PHP
How do I create a pdf with html (DOM) content accounting for the css styles of html?
HTML has MathJax javascript rendered formulae in it. I would like the pdf to show the formulae as they are visible in browser using MathJax.
Also, HTML contains few images.
Which open source java library helps to create such a pdf from html content?
I looked into Apache PdfBox but did not find a solution.
Solution has to be open source library to be used in commercial application.
EDIT
DOM content is dynamic generated on server side and not pushed to browser.
FlyingSaucer is close to what I need. However this does not support java script i.e html with MathJax can not be (properly) converted to pdf.
There are various PDF renderers based on WebKit that support JavaScript. The best I've found is the screen capture feature of PhantomJS.
http://phantomjs.org/screen-capture.html
You'll have to write a bit of code though, and make sure you don't take the screen grab until the JS has finished doing its thing.
Update
Here's a really simple example that reads HTML from stdin and saves a PDF file to disk:
// render.js
var page = new WebPage();
page.content = require("system").stdin.read();
setTimeout( function(){
page.render( 'export.pdf' );
phantom.exit(0);
}, 100 ); // <- wait for JS
You can execute this from whatever server-side runtime you're using, as long as it can execute a shell. To test it from the command line with a static file, you can do:
~/bin/phantomjs render.js < sample.html