代码之家  ›  专栏  ›  技术社区  ›  chanchal1987

PHP中的PDF创建者和阅读器

  •  1
  • chanchal1987  · 技术社区  · 16 年前

    我想使一个在线PDF的创造者和读者在PHP将支持所有功能,如书签,签名,评论,编辑,页眉和页脚,水印等Adobe Acrobat可用。。你能给我推荐一个好的PHP库来帮助我做到这一点吗?

    6 回复  |  直到 16 年前
        1
  •  2
  •   Tim Cooper    14 年前

    http://davidwalsh.name/read-pdf-doc-file-php 对于阅读pdf,对于创建pdf,我将使用 tcpdf ,这是我用过的最好的免费字体,尽管所有的字体文件都是一个很大的库。

        2
  •  0
  •   oopbase Jayachandran Murugesh    16 年前

    this one . 它应该正是你要找的。

    您可以看看这个例子如何创建一个“helloworld”PDF。

    <?php
    $p = PDF_new();
    
    /*  open new PDF file; insert a file name to create the PDF on disk */
    if (PDF_begin_document($p, "", "") == 0) {
        die("Error: " . PDF_get_errmsg($p));
    }
    
    PDF_set_info($p, "Creator", "hello.php");
    PDF_set_info($p, "Author", "XYZ");
    PDF_set_info($p, "Title", "Hello world (PHP)!");
    
    PDF_begin_page_ext($p, 595, 842, "");
    
    $font = PDF_load_font($p, "Helvetica-Bold", "winansi", "");
    
    PDF_setfont($p, $font, 24.0);
    PDF_set_text_pos($p, 50, 700);
    PDF_show($p, "Hello world!");
    PDF_continue_text($p, "(says PHP)");
    PDF_end_page_ext($p, "");
    
    PDF_end_document($p, "");
    
    $buf = PDF_get_buffer($p);
    $len = strlen($buf);
    
    header("Content-type: application/pdf");
    header("Content-Length: $len");
    header("Content-Disposition: inline; filename=hello.pdf");
    print $buf;
    
    PDF_delete($p);
    ?>
    
        3
  •  0
  •   Mad Scientist    16 年前

    PDF reader for Chrome ,因为Chromium是开源的,所以您可以看看他们是如何在浏览器中呈现它的。也许这个方法对你有用。

        4
  •  0
  •   Sarfraz    16 年前

    看看免费的和流行的 FPDF

    FPDF是一个PHP类,它允许用纯PHP生成PDF文件,也就是说不使用PDFlib库。F from FPDF代表免费:您可以将其用于任何用途,并根据您的需要进行修改。

    功能。以下是它的主要

    • 测量单位、页面格式和页边距的选择
    • 页眉页脚管理
    • 图像支持(JPEG、PNG和GIF)
    • 颜色
    • TrueType、Type1和编码支持
        5
  •  0
  •   jhuiting    16 年前

    @我也用过Tcpdf,它是一个非常有用的库!有关tcpdf的更多信息,请访问Luke提供的链接。我知道tcpdf确实支持水印和背景图像。

        6
  •  0
  •   FabryProg    12 年前