We don’t allow questions 开发者_运维知识库seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this questionI want to make a online PDF Creator and Reader in PHP which will support all features available in Adobe Acrobat like Bookmarking, Signing, Commenting, Editing, Header and Footer, watermark etc etc.. Can you please suggest me a good PHP Library which will help me to do that?
Google search led me to http://davidwalsh.name/read-pdf-doc-file-php for reading a pdf, for creating a pdf I would use tcpdf, its the best free one I have used although with all the font files its a large library.
Try this one. It should be exactly what you are looking for.
You can take a look at this example how to create a "Hello World" 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);
?>
Google is creating a PDF reader for Chrome, as Chromium is open source you can take a look on how they render it inside the browser. Maybe that method is usable for you.
Have a look at FREE and popular FPDF
FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.
FPDF has other advantages: high level functions. Here is a list of its main
Features:
- Choice of measure unit, page format and margins
- Page header and footer management
- Automatic page break
- Automatic line break and text justification
- Image support (JPEG, PNG and GIF)
- Colors
- Links
- TrueType, Type1 and encoding support
- Page compression
@chanchal1987 I've used Tcpdf as well, it's an really usefull library! Please visit the link Luke provided for more information about tcpdf. I know that tcpdf does support watermarks and background images.
i am using dompdf (https://code.google.com/p/dompdf/) to create pdf via php into my website http://www.pdfwebcreator.com
精彩评论