在PHP中获取PDF文件的内容 [英] Get content of PDF file in PHP

查看:811
本文介绍了在PHP中获取PDF文件的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个FlipBook jQuery页面和太多电子书(pdf格式)无法显示.我需要隐藏这些PDF,以便使用PHP获取其内容并在我的FlipBook jquery页面中显示它. (而不是提供整个pdf,我希望将其作为一部分提供.)

I have a FlipBook jquery page and too many ebooks(pdf format) to display on it. I need to keep these PDF's hidden so that I would like to get its content with PHP and display it with my FlipBook jquery page. (instead of giving whole pdf I would like to give it as parts).

我可以通过PHP获取PDF文件的全部内容吗? 我需要根据他们的页面分开他们.

Is there any way i can get whole content of PDF file with PHP? I need to seperate them according to their pages.

推荐答案

您可以使用PDF解析器(PHP PDF库)提取每个 以及PDF的所有内容.

You can use PDF Parser (PHP PDF Library) to extract each and everything from PDF's.

PDF分析器库链接: http://www.pdfparser.org/

在线演示链接: http://www.pdfparser.org/demo

文档链接: http://www.pdfparser.org/documentation

示例代码:

<?php

// Include Composer autoloader if not already done.
include 'vendor/autoload.php';

// Parse pdf file and build necessary objects.
$parser = new \Smalot\PdfParser\Parser();
$pdf    = $parser->parseFile('document.pdf');

$text = $pdf->getText();
echo $text;

?>

关于您问题的另一部分:

Regarding another part of your Question:

如何将PDF页面转换为图像:

您需要 ImageMagick [0]表示page 1.

这篇关于在PHP中获取PDF文件的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆