且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Javascript,php等将html + CSS页面转换为pdf?

更新时间:2022-01-15 09:53:50

添加fpdf文件 b
$ b

Add fpdf file

    <?php
require('fpdf.php');
           $pdf=new FPDF();
            $pdf->AddPage();
            $pdf->SetFont('Arial','B',10);
            $pdf->Ln();
            $pdf->Ln();
            $pdf->SetFont('times','B',10);
            $pdf->Cell(25,7,"Name",1);
            $pdf->Cell(20,7,"address",1);

            $pdf->Ln();
            $pdf->Cell(450,7,
        $pdf->Ln();
    ?>

这里是php代码

<?php
$name='your name';
$address='ypur address';
  $pdf->Cell(25,7,$studid,1);
            $pdf->Cell(20,7,$name,1);
            $pdf->Cell(40,7,$address,1);


            $pdf->Ln(); 
        }
$pdf->Output();

您可以将fpdf文件下载到此链接在此输入链接描述

you download fpdf file to this link enter link description here