从PHP中的/Filter/FlateDecode PDF流提取数据 [英] Data extraction from /Filter /FlateDecode PDF stream in PHP
问题描述
我无法解密流中的数据,例如:
I can not decrypt the data from the stream like:
56 0 obj
<< /Length 1242 /Filter /FlateDecode >>
stream
x]êΩnƒ Ñ{ûbÀKq¬æ\âê¢....(whole binary is omitted)
endstream
endobj
我尝试将文件和二进制字符串中的二进制内容(x]êΩnƒ Ñ{ûbÀKq¬æ\âê¢....
)隔离开.解码功能gzinflate($encripted_data)
向我发送解码错误,我认为发生这种情况是因为编码后的内容未缩小".
I tried isolate the binary content (x]êΩnƒ Ñ{ûbÀKq¬æ\âê¢....
) in a file and in a binary string. Decoding function gzinflate($encripted_data)
sends me error of decoding, and I think it happens because encoded content in not "deflated" or so.
在PDF参考v 1.7(第六版)的第67页中,我发现/FlateDecode过滤器的描述为: ...对使用zlib/deflate压缩方法编码的数据进行解压缩,从而再现原始文本或二进制数据
In PDF Reference v 1.7, (six edition), on a page 67, I found the description of /FlateDecode filter as: ...Decompresses data encoded using the zlib/deflate compression method, reproducing the original text or binary data
我需要真正的原始解决方案,aka php函数或/和算法来处理此"\ FlateDecoded"流.
I need real raw solution, aka php function or/and algorithm what to do with this "\FlateDecoded" stream.
谢谢!
推荐答案
header('Content-Type: text'); // I going to download the result of decoding
$n = "binary_file.bin"; // decoded part in file in a directory
$f = @fopen($n, "rb"); // now file is mine
$c = fread($f, filesize($n)); // now I know all about it
$u = @gzuncompress($c); // function, exactly fits for this /FlateDecode filter
$out = fopen("php://output", "wb"); // ready to output anywhere
fwrite($out, $u); // output to downloadable file
铃铛!铃儿响叮当!...
Jingle bells! Jingle bells!...
gzuncompress()
-解决方案
这篇关于从PHP中的/Filter/FlateDecode PDF流提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!