Symfony2 editing PDF - php

I have a problem when trying to edit existing PDF. In non-symfony part of code I've used FPDI library and I could just open existing pdf as:
$pdf->setSourceFile('example.pdf');
Now in the symfony part of the project we're using White october bundle for symfony2 which is basically wrapper around TCPDF library.
But the problem is TCPDF does not have any option to open existing file as template. So is there any way I could edit existing pdf file without including another bundle? Since I don't want to have multiple bundles doing almost exact same thing.

According to the documentation of TCPDF library, you can use the import method.
If your library doesn't allow it, use another one ?
Edit: KnpSnappy doesn't allow editing. Only generating.

Related

Is there a way to use PHPExcel in view of Laravel?

PHPExcel is a library to generate MS Excel file using PHP (and so far the best one I have used in supporting Chinese output). It works fine in Laravel. However, unlike libraries for generating email or PDF files, in PHPExcel (and many other libraries used for generating Excel file) the file can only be generated by calling PHP functions instead of converting HTML into Excel, so the code has to be put in controller / classes.
I feel a little uncomfortable to put codes that mainly for views into controller, and it is a group project so readability is also a concern. Is there a way I can put the code generating Excel file into view in Laravel?
You have to install "maatwebsite/excel" package, and then you can use the functionality of PHPExcel. Go: here to get basic information regarding package installation, and here to get detail tutorial, on how to use this package.
See, if that helps.
Laravel 5 allows you to place your classes anywhere in the app folder, given the appropriate PSR-4 compliance.
Therefore, you can create a class which is solely responsible for containing all codes pertaining to the creation of your Excel files.
Then you can call the method, from your controller whenever appropriate.

Print docs in PDF format in Yii

I have made an application in Yii. Now as per my application requirement I have to make them print in PDF format. I searched over Yii docs but did not got any docs about converting file into printable PDF format. So any help and suggestions will be highly appreciable.
Look into WkHtmlToPdf:
http://code.google.com/p/wkhtmltopdf/
It uses Webkit's rendering engine to make PDFs from HTML / CSS. It's the best library out there that I've found and I've done a bunch of research.
Edit:
Mike on the Yii forum has already built an OO wrapper for WkHtmlToPdf and just released a Yii extension for it.
I have recently used MPDF for a project. It allows you to convert HTML output into PDF format. If you are looking for something simple this might be what you are looking for. Personally, I find it easier to work with HTML/CSS for layout than PDF boxes. I am not sure just how well it scales with complex layouts, though.
Yii also supports using Zend modules. You can use Zend_Pdf if you so choose.
See this documentation page on how to integrate third-party libraries with your Yii code.
Either way, as has already been mentioned, there are tons of PDF libraries available for PHP.
You should search for php libraries to do that. Link to one of them - http://www.tcpdf.org/
I have had great success using fpdf - http://www.fpdf.org/
Unfortunately this feature is not part of Yii. You can try TCPDF, though. http://www.tcpdf.org/
TCPDF lets you parses your HTML output to PDF document. The PDF document can be output in your server or to the user as a direct download.
Hers the extension to create PDF files.
Yii2-PDF

How to create pdf files in drupal?

I want to create pdf files in drupal .module file.
I have view of bulk operations in which I have added an operation send pdf file and download pdf file.
I want to get some data from the database and and create a pdf file from it and when I select an operations it should create and send the pdf file in an email.
So how could I do this???
You should look first in the PHP library for creating PDF files. You can use TCPDF or many others in the PHP libraries:
https://stackoverflow.com/questions/560583/which-is-the-best-pdf-library-for-php
After doing a quick search at Drupal Modules I found this module. And I also found this by Googling. The latter one seems to need no additional PHP modules and should be easy to integrate.
There is a new module named PHP WK HTML to PDF
From his site:
This is intended for module developers, nothing is usable from the
front-end.
This module is a Drupal Library implementation for the PHPWkHtmlToPdf
wrapper and as a result is extremely small because it uses WkHtmlToPdf
to do the heavy work.
And you can use if you want Views PDF
With this module you can output a view as a PDF document. Each field
of the view can be placed on the PDF page directly in the
administration interface. Therefore a new display called "PDF" is
added.
You should use the module print. This module allow you to print a node but also any page of your site. After enable the module you can generate pdf simply by visiting url starting with printpdf/NID or printpdf/AnyPAth.
To generate the pdf it can use the following libraries: dompdf, TCPDF, wkhtmltopdf.
Follow the installation guide
TCPDF is good for pdf creation.
There is new module TCPDF. See tcpdf_example submodule to get started.
For installation see INSTALL.txt:
Download and install libraries module.
Download TCPDF library from http://sourceforge.net/projects/tcpdf/files/
Extract it to sites/all/modules/libraries.
Download and install TCPDF module.
Check the status report to verify if the installation was successful.
Have fun.
I had a very intricately styled view recently that I just couldn't get looking the same as a pdf, I used this service to do it and I was pretty impressed. http://www.html2pdfrocket.com/

How to integrate KCFinder inside zend application as standalone

I want to integrate KCFinder inside Zend framework, i want this
http://kcfinder.sunhater.com/demo/kcfinder/browse.php?type=files&dir=files/public
page to be included inside my template without using any iframe, i had tried many things by calling browser.php file inside my view but i am facing issues with file loading and their dependencies, even resolving php file dependency by using autoloader js files are not loading properly
Please help me out on this
I had collaborated with project like CKfinder called Elrte.org
and i did make a custom ZF form element for it
a sample example on my github account :
https://github.com/tawfekov/Elrte-Element-for-Zend-Framework
the demo has ability to show the rich text editor + file manager
feel free to extend it or to get an example of it

generation of multiple reports and zipping in codeigniter php

I want to generate multiple pdf reports on click of single print button and zip all the pdf's and store it in a folder.
Any help please. I need this functionality in my project.
According to https://stackoverflow.com/questions/560583/which-is-the-best-pdf-library-for-php
, the best pdf php library is FPDF.
They also mention that Zend has a nice PDF Lib. If you are using CodeIgniter you may wish to use the Zend library, as Zend libraries work nicely inside of CodeIgniter. (A simple Google search will show up several tutorials on using Zend libs as CI libs).
Someone on the CI Forums has instructions on using FPDF with CodeIgniter:
http://codeigniter.com/forums/viewthread/45365/
As for the second part of your question, wrapping data in a zip file is easily done with with CodeIgniter Zip Encoding library as detailed in the user guide.

Categories