Welcome Guest, Not a member yet? Register   Sign In
yet another pdf library
#1

[eluser]pixelazion[/eluser]
hi everyone,

i found another pdf library which handles long tables pretty well, i'm having trouble converting it as ci plugin. I'v been to dompdf to tcpdf and still have some layout issues. anyway here's the link to the found library. http://www.html2pdf.fr/?lang=en
see example 5 to see what i mean from the link above.

i need help on this one. i just need it to be converted to CI plugin.

here's what i got so far:

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');


    function html2pdf( $content = '', $filename = '', $papersize="letter", $orientation = "P" ){

        
        require_once("html2pdf/html2pdf.class.php");
        $html2pdf = new HTML2PDF( $orientation, $papersize, 'en' );

        $html2pdf->pdf->SetDisplayMode( 'fullpage' );

        $html2pdf->WriteHTML( $content, isset( $_GET['vuehtml'] ) );

        $html2pdf->Output( $filename.'.pdf' );

    }

?>

directory structure is standard CI

tnx
#2

[eluser]Thorpe Obazee[/eluser]
I haven't used html2pdf library.

What layout issues occurred using dompdf?
#3

[eluser]pixelazion[/eluser]
you see when long table breaks they lose the header part specially when a table cell breaks into 2 pages, lost its width attribute and the 2nd page will now depend on the content.
#4

[eluser]pistolPete[/eluser]
This should be changed:

Code:
// second parameter:
// FALSE = show PDF
// TRUE = show HTML
$html2pdf->WriteHTML( $content, FALSE);
#5

[eluser]pixelazion[/eluser]
tnx for the reply, i'm really new to this library plus, it's french ^_^

how do you save the pdf to a directory directly? just like dompdf you can write it to file...

^_^
#6

[eluser]pistolPete[/eluser]
[quote author="pixelazion" date="1237236875"]i'm really new to this library plus, it's french ^_^ [/quote]
I just had a quick look, didn't know it either.
And yes, it's pretty unusual to have a non english source code Smile

[quote author="pixelazion" date="1237236875"]
how do you save the pdf to a directory directly? just like dompdf you can write it to file...
[/quote]

The second parameter of Output() accepts nearly the same arguments as the underlying FPDF class method:
Code:
// second paramter:
// '', FALSE, or 'I' :  header('Content-Type: application/pdf'); is sent to display the pdf inline.
// TRUE or 'S': returns the pdf file contents to a variable
// 'F': saves the pdf file to a directory

// in your case:
$html2pdf->Output( $filename.'.pdf', 'F' );
#7

[eluser]pixelazion[/eluser]
tnx pistolPete, i haven't really gone down to the library, i was so preoccupied yesterday, but anyway.... tnx for cracking the nutshell for me.
#8

[eluser]pixelazion[/eluser]
here's a sample of what i'm trying to achieve here. this is done using fpdf library hardcoding the tables, not in html2pdf version. http://www.fpdf.org/en/script/morepagestable.pdf
#9

[eluser]dlange[/eluser]
Hello pixelazion,

I'm also interested in the html2pdf plugin. Have you completed the plugin?

// Daniel
#10

[eluser]pixelazion[/eluser]
yep, i'm still stucked with dompdf... its still the best one around. ^_^




Theme © iAndrew 2016 - Forum software by © MyBB