【问题标题】:Php Pdf Parser read content showing as a two lines. need to fix itPhp Pdf Parser 读取显示为两行的内容。需要修理它
【发布时间】:2022-12-10 05:46:34
【问题描述】:

我使用pdfparser来阅读PDF内容。但一个地址行显示为两行。在那段时间它显示为两条新线。我想把那个完整的地址作为一行。 pdf文件是动态的。根据它显示为多行的地址长度。

我需要适当的解决方案来将这些内容作为一行阅读。我将在此处附上该 PDF 地址行以供参考。

我想你能理解我的要求。

**我的pdf阅读代码是**

$fileName = basename($_FILES["file"]["name"]); 
$fileType = pathinfo($fileName, PATHINFO_EXTENSION); 

// Allow certain file formats 
$allowTypes = array('pdf'); 
if(in_array($fileType, $allowTypes)){ 
   // Include autoloader file 
   include 'vendor/autoload.php';
             
   // Initialize and load PDF Parser library 
   $parser = new \Smalot\PdfParser\Parser(); 
             
   // Source PDF file to extract text 
   $file = $_FILES["file"]["tmp_name"]; 
             
   // Parse pdf file using Parser library 
   $pdf = $parser->parseFile($file); 
             
   // Extract text from PDF 
   $text = $pdf->getText(); 
             
   // Add line break 
   $pdfText = nl2br($text);
}else{ 
  $statusMsg = '<p>Sorry, only PDF file is allowed to upload.</p>'; 
} 

阅读pdf内容后显示如下

我怎样才能将相关内容作为一行

【问题讨论】:

    标签: php pdf pdf-parsing pdfparser


    【解决方案1】:

    你有没有得到这个答案?

    【讨论】:

    猜你喜欢
    • 2018-07-31
    • 1970-01-01
    • 1970-01-01
    • 2014-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多