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

Parallel Programming in Codeigniter
CodeIgniter-Checking session variable is already set or not when clicking each link or reloading page
Where fieldname is null using active record
how to send array of values to a query dynamically in codeigniter
Codeignitor active record nested select issue
Codeigniter and i18n for ajax url
How to debug CI-Merchant Paypal Pro integration?
Different user levels
codeigniter session is not storing all data
Dynamic Get Clumn value
Pagination CodeIgniter: Page, wrong link
codigniter limit function not working with $this->db->query($sql) [closed]
add_column bug for Postgres with Codeigniter?
HybridAuth keeps giving “User profile request failed. Most likely the user is not connected to the provider and he should to authenticate again.”
can't navigate first uri segment (controller) in wamp
pyrocms Unable to connect to your database server using the provided settings. Filename: /libraries/MX/Loader.php Line Number: 104

Categories

HOME
typescript
f#
sqlite
dom
whatsapp
orbeon
direction
parse.com
blogs
saml
delphi-xe7
google-analytics-api
stm
cross-compiling
google-cloud-sdk
realm-java
broker
yii1.x
x-sendfile
shinydashboard
clappr
concurrenthashmap
lync
dwm
ecmascript-4
dsx
jpype
subscription
tern
freerdp
mergesort
appdynamics
federation
ctl
tpl-dataflow
canopen
ammonite
jahia
a-star
mapr
atmosphere.js
flattr
webtrends
balsamiq
docklight
membership
xirr
sample-data
json4s
gem5
smarty2
byte-order-mark
spiceworks
chatjs
laravel-validation
gdk
httpservice
bessel-functions
iqueryable
bonecp
fig
keymapping
angularjs-google-maps
asciiencoding
antisamy
junit-runner
xcache
wow64
kmz
couchpotato
python-dateutil
impdp
datakey
quilt
sdl.net
cluetip
hunchentoot
symstore
server.transfer

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