手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表Tag:frp

fpdf: This PDF document probably uses a compression technique

 使用fpdf读取PDF文件时,报错:This PDF document probably uses a compression technique which is not supported by the free parser shipped with FPDI. (See https://www.setasign.com/fpdi-pdf-parser for more details)

 
提示这个文件是采用了一个压缩格式,到官网上查看之后,发现他们提供了fpdi-pdf-paser2,但是这是收费的。。。啊啊啊,短时间内先忽略吧。毕竟这样的PDF不多。
 
后面再关注一下有没有类似的东西。
 
1、安装pdf-parser2 : FPDI PDF-Parser 2.x (setasign.com)
2、查看这里的测试代码和示例:https://www.setasign.com/products/fpdi-pdf-parser/details/
 
目前我是放弃了,因为,他develop version,要100欧,然而这只是我自己用来测试,没必要。
------
后记:
1、读了PDF的第一行,发现这个PDF版本是PDF1.5,尝试用chrome打开,另存为,无效。选择打印->另存为PDF,成功
2、网上也有教程,建议是使用ghostscript来处理,比如:php - FPDF error: This document (testcopy.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI - Stack Overflow,代码比较简单:
PHP代码
  1. // USE GHOSTSCRIPT IF PDF VERSION ABOVE 1.4 AND SAVE ANY PDF TO VERSION 1.4 , SAVE NEW PDF OF 1.4 VERSION TO NEW LOCATION   
  2. <?php   
  3. exec('gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="'.$srcfile_new.'" "'.$srcfile.'"');  
  4.  ?>  
结果,官网上没有mac的可执行文件,又不想编译,所以纯记录一下吧
 
-----
0227更新:
GPL Ghostscript 9.50 (2019-10-15)
Copyright (C) 2019 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
GPL Ghostscript 9.50: Cannot open X display `(null)'.
**** Unable to open the initial device, quitting.
 
纠结。

简易重启mac 下的mamp pro

 简单的弄一下。因为有时候要改配置,然后打开mamp,点击重启会耗时特别长。。。。所以简单的弄了一下

XML/HTML代码
  1. #!/bin/bash  
  2.   
  3. function start(){  
  4.     /Applications/MAMP/Library/bin/httpd -f "/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k start  
  5. }  
  6.   
  7. function stop(){  
  8.     /Applications/MAMP/Library/bin/httpd -f "/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k stop  
  9. }  
  10.   
  11. function restart(){  
  12.    (stop)  
  13.    (start)  
  14. }  
  15.   
  16. function status(){  
  17.     ps aux|grep httpd  
  18. }  
  19.   
  20. echo "which do you want to?input the number."  
  21. echo "1. start"  
  22. echo "2. stop"  
  23. echo "3. restart"  
  24. echo "4. status"  
  25. read num  
  26.   
  27. case "$num" in  
  28. [1] ) (start);;  
  29. [2] ) (stop);;  
  30. [3] ) (restart);;  
  31. [4] ) (status);;  
  32. *) echo "exit";;  
  33. esac  
其实没啥难度就是这么几行代码。连路径都没有定义变量。但一般情况下够用了,复制不成功的,可以直接打开://neatstudio.com/mamp.txt
 

Tags: mamp