Data extraction from /Filter /FlateDecode PDF stream in PHP

后端 未结 4 1233
离开以前
离开以前 2020-12-22 20:17

I can not decrypt the data from the stream like:

    56 0 obj 
    << /Length 1242 /Filter /FlateDecode >>
    stream
    x]êΩnƒ Ñ{ûbÀKq¬æ\\âê¢..         


        
4条回答
  •  孤城傲影
    2020-12-22 21:01

    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() - the solution

提交回复
热议问题