codeigniter


Convert html to pdf in codeigniter


I am using dompdf library to convert html content to pdf.I am facing some problems.
1) I am able to generate pdf but On My HTML content there are some images but when I am generating pdf images are not coming in PDF.
2) Also PDF is not showing complete data means data is coming surely but not visible of complete width.
Please help!!!
Here is my sample of making my html to pdf...I wish i give you some idea
LIBRARIES:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Dompdf_gen {
public function __construct() {
require_once APPPATH.'third_party/dompdf/dompdf_config.inc.php';
$pdf = new DOMPDF();
$CI =& get_instance();
$CI->dompdf = $pdf;
}
}
Controller:
function pdf($id){
$data['contract_items_all'] = $this->contract_items->get_serial_infos($this->uri->segment(4));
$data['child_info'] = $this->contract_items->get_children_info($cid);
$this->load->library('dompdf_gen');
$html = $this->load->view('contracts/equipment_pdf', $data, true);//this equipment_pdf contain the html that you will convert to pdf
$this->load->library('dompdf_gen');
$dompdf = new DOMPDF();
// Convert to PDF
$this->dompdf->load_html($html);
$this->dompdf->render();
$this->dompdf->stream("Contract.pdf",array("Attachment"=>0)); // VIEW IN OTHER TAB
//$this->dompdf->stream("Contract.pdf"); // SAVE FILE TO DISK
}
why are you loading libraries twice?
// ...
$this->load->library('dompdf_gen');
$html = $this->load->view('contracts/equipment_pdf', $data, true);//this equipment_pdf contain the html that you will convert to pdf
$this->load->library('dompdf_gen');
$dompdf = new DOMPDF();
// ...

Related Links

Is it safe to use session in codeigniter?
Cannot use object of type stdClass as array in pcategories.php
How to integrate PHPBB3 or MYBB3 with codeigniter
Bulk upload Proceed codeigniter
Custom Pagination Page Count Message
Codeigniter update functions updates all rows
CodeIgniter mysqli - An Error Was Encountered Invalid DB driver
codeigniter data not showing when entering $user_id and data is showing when putting directly user_id no which is “1”
How to integrate Codeigniter 3 framework with netbeans 8 or any version completly
Link Pagination does'nt shown on codeigniter
Rediecting to another view from one view in codeigniter
Putting TCPDF code externally in Codeigniter
Cannot get session data in filemanager
codeigniter session loading error: No such file or directory
Codeignither Form validation error HMVC
how to check result of doctrine statement

Categories

HOME
actions-on-google
magento
office-js
auth0
afp
datetime
saml
google-cloud-dataproc
libreoffice
cql3
tsql
whitespace
range
windows-10-desktop
h2o
gcov
openframeworks
development-environment
command-line-arguments
orchardcms-1.10
accumulo
ssrs-tablix
data-annotations
jquery-selectors
org-mode
pydev
rtp
jsgrid
sax
hawq
toolbar
asana-api
bluebird
localdb
background-process
stackexchange.exceptional
sieve-of-eratosthenes
jackrabbit
xaf
disqus
ecdsa
angular-xeditable
extjs4
php-5.5
textangular
syncfusion
mergesort
mediawiki-api
wp-api
msysgit
slt
gulp-babel
move
sharpziplib
jasmine2.0
abbyy
javascript-security
netbeans-7
jcuda
android-camera-intent
manifoldcf
configuration-profile
jsbin
restbed
sliding
airplay
filenet-content-engine
many-to-one
protected
maven-cargo
dhc
bloodhound
sql-server-ce-3.5
odoo
easynetq
prettyfaces
dynamic-data-display
team-explorer-everywhere
keymapping
confirmation
jquery-mobile-popup
modx-evolution
external-dependencies
buildout
gora
mosek
asp.net-authentication
google-chrome-frame
northwind
vote
rc-shell
datakey
mysql-backup
b-method
replay
nsindexset

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App