Welcome Guest, Not a member yet? Register   Sign In
I need to know the recommended pdf manufacturer.
#1

hello Smile
I am trying to trial and error the pdf maker.
First up is 'tcpdf'.
To pass the process through tcpdf, I need the raw html.
However, the `view` function no longer returns html (codeigniter3 could return html using the `view` function).

PHP Code:
        // basic, portrait and A4 canvas
        $tcpdf = new TCPDF('P''mm''A4'true'UTF-8'false);
    
        
// set document information
        $tcpdf->SetCreator('TCPDF');
        $tcpdf->SetAuthor('yoshi.');
        $tcpdf->SetTitle('TCPDF Title');
        $tcpdf->SetSubject('TCPDF Subject');
        $tcpdf->SetKeywords('TCPDF, PDF, example, test, guide');
    
        
// no header
        $tcpdf->setPrintHeader(false);
        $tcpdf->setPrintFooter(false);
    
        $tcpdf
->AddPage('P');
        // $tcpdf->SetFont("kozminproregular", "", 10);
        $tcpdf->Cell(00'A4 portrait'11'C');
    
        
// from html
        $schoolCode $this->login['school']->code;
        $viewPaths = [
            'file' => self::SCHOOL_REPORT['enrollment']."/$schoolCode/enrollment.php",
            'default' => 'school/report/enrollment/school/default/enrollment',
            'mySchool' => "school/report/enrollment/school/$schoolCode/enrollment",
        ];
        $data = [
            'schoolName' =>  $this->login['school']->name
        
];

        $renderer Services::renderer();
        $html $renderer
            
->setData($data)
            // ->renderString(file_exists($viewPaths['file']) ? $viewPaths['mySchool'] : $viewPaths['default']);
            ->renderString('school/report/enrollment/school/Demo/enrollment');
        dd($html);
        $tcpdf->writeHTML($html); 

Next, the font issue.
tcpdf has few Japanese fonts supported. Therefore, I would like to use google fonts via CDN for now.

before I need to know how to get the raw html...
Reply
#2

Hello, we are using the cid0* fonts included in TCPDF to create our PDF in CJK. Don't know if that will suit your needs. Getting a font ready for TCPDF requires a conversion process so I don't see how you may include a font from "Google fonts via CDN".
Reply
#3

PHP.net = file_get_contents

As for the google font you can import them into your CSS file.
The app folder I think is .htacess protected so you will need to work around that.
If you use the view it should grab the html, it still works with the email, but your using the render.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

I use mPDF, install via composer mpdf/mpdf - I also find their documentation quite good. Adding fonts is a breeze.
Dirk B.
Abatrans Software
No SEO spam - see forum guidelines
Reply
#5

Should be in the pdf metadata.

Smalot - PDF parser
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

@tgix @InsiteFX @abatrans

Thanks everyone, I was able to use the fonts in mPDF.
Reply
#7

(This post was last modified: 08-28-2022, 12:21 AM by paulbalandan.)

I use mPDF.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB