i designed the invoice using bootstrap css, i used tcpdf to design invoice. I called bootstrap css file but its not working, Kindly help me.. My coding is
$baseurl = "http://localhost/erp";
$html = '<style>'.file_get_contents($baseurl.'css/bootstrap.min.css').'</style>';
$html = '<style>'.file_get_contents($baseurl.'css/style.css').'</style>';
First of all - Bootstrap use js scripts for working; As You understand, scripts could not be working in tcpdf file;
More than that - tcpdf not allowed all CSS attributes; I can't find supported css list in official documentation, but this can help;
Related
I want to create a pdf page from html file in Laravel but I do not know how to do it. You can help me
https://github.com/barryvdh/laravel-dompdf
// Import in top of controller file
use Barryvdh\DomPDF\Facade as PDF;
// use below code to generate and download pdf file
$pdf = PDF::loadView('bladefilename', ['arrayname' => $array]);
return $pdf->download('filename.pdf');
Write Above code in the controller file
In Blade file (HTML file) set array data.
Show Below Link : https://github.com/barryvdh/laravel-dompdf/issues/126
I know I am a little bit late but hopefully this will help someone.
There are 2 ways:
Create HTML page and use jspdf to print this page. The best way is to use html2pdf: https://github.com/eKoopmans/html2pdf.js
You can use this one to convert html to canvas and print to pdf. All css will be kept but you have to change the page to fix the space between pages as there may be some bad cut at the end of each page.
Print the page using latex. You have to use laravel latex compiler: https://github.com/fvhockney/latexcompiler
It is a little bit harder to styling the page but there is no problem with paging.
I'm using PHPWord in my SF2.8 application, and i would like to use a twig as template for my docx it works but there is no CSS. How can I do to put CSS ?
Thanks a lot !
I am working on a resume maker project in php, I am fetching all entries from database. so in this project I am using bootstrap for resume designs. I want to add a button to download resume as PDF in same layout as I designed using bootstrap. I have also inserted image of the user. so please help me with specific solution with demo. bootstrap layout is must.
You really should use a library like Prince XML or MPDF for that.
As an example, mpdf is really easy to implement:
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML('<h1>Hello world!</h1>');
$mpdf->Output();
Here is an online manual.
So I am using the codeigniter pdf library from: https://github.com/chrisnharvey/CodeIgniter-PDF-Generator-Library
And it works wonders except, It doesn't keep the style sheet when the pdf is generated.
I am trying to use bootstrap to make it look nice, But when I run the script and download the pdf it doesn't have the styling anymore. What do I need to do to keep the stylesheet linked?
My Controller:
public function AdminPracticeSheetLateReport()
{
$this->load->view('pdf/practiceLateReport');
$this->pdf->load_view('pdf/practiceLateReport');
$this->pdf->render();
$this->pdf->stream("welcome.pdf");
}
I am loading the bootstrap stylesheet like so in my view:
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
Is this even possible with this plugin? If not it's quite the crappy plugin if you ask me.
BTW: This library for codeigniter uses the DomPDF
I just checked the source code of codeigniter and noticed that it does not itself make a PDF, but uses DOMPDF in turn (which is another PHP library). codeigniter does not properly send the html and css to DOMPDF, so in my suggestion you should remove codeigniter and use DOMPDF instead. This should correct your problem and also speed up the conversion by a few miliseconds.
I'm using FPDF to create an A4 sized PDF, I can add text/images and this is working fine. I have a dynamically generated string which contains some HTML tags (BR etc) and was wondering how I can have that output onto the PDF as opposed to literally printing the tags out.
$centre = urldecode($row_CertDetails['centre_name']);
$pdf->Text(10, 110, $centre);
I've seen on some forums people mentioning WriteHTML, however my version of FPDF doesn't seem to include that.
Is it an add-on?
Yes, it is an Add-On:
Write HTML
Author: Clément Lavoillotte
License: FPDF
This is an enhancement of the WriteHTML() method from tutorial 6. Supported tags are: ...
Please see Write HTML FPDF Script #42 which I think is the latest version, but feel free to browse the FPDF scripts/Add-Ons.
I've solved it anyway.
Because I'm also using FPDI, what I did was extract the contents of the class in http://www.fpdf.org/en/script/script42.php and put it inside the FPDI.php file.