[Solved] How to decode streams of type FlateDecode? lazarus / 21-General ---------------------------------------------------------------------- loaded · 2022-09-27 07:30 Hi All, There are streams encoded as FlateDecode in a pdf file I have. Is there a method to solve these flows in the simplest way? I would be glad if you share your experience and suggestions. Respects. ---------------------------------------------------------------------- KodeZwerg · 2022-09-27 07:52 Use any Pdf library to do, would be fastest solution. With ZLib you should also be able to "unpack" such stream. ---------------------------------------------------------------------- loaded · 2022-09-27 08:44 Thank you so much KodeZwerg for the answer. I use ghostscript for my pdf processing. It works great. But I wanted to do something myself. Yes Zlib might be the solution, I'll try that. ---------------------------------------------------------------------- marcov · 2022-09-27 09:26 seems so: https://gist.github.com/averagesecurityguy/ba8d9ed3c59c1deff bd1390dafa5a3c2 note the  Code: PHP  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   print(zlib.decompress(s)) ---------------------------------------------------------------------- loaded · 2022-09-27 13:32 Thank you so much marcov for the answer. Quote from: marcov on September 27, 2022, 11:26:15 am seems so: https: //gist.github.com/averagesecurityguy/ba8d9ed3c59c1deffbd1390dafa5a3c2 https://forum.lazarus.freepascal.org/index.php/topic,33009.msg213157.h tml#msg213157 With the help of your suggestion and the codes in the link, my problem was solved. But now a problem has arisen. Pdf files contain both text and stream objects. What's the easiest way to extract these stream objects from texts? The python code in the link you posted can do this very simply. Is this possible in Lazarus? ---------------------------------------------------------------------- KodeZwerg · 2022-09-27 13:41 I do not know about how other languages do work. I more rely to the technical aspect of a file structure like pdf. https://resources.infosecinstitute.com/topic/pdf-file-format-basic- structure/ Above just one of millions web pages that describe the structure. When you have read that, you should know the tricks ---------------------------------------------------------------------- loaded · 2022-09-27 15:51 What I want to do in my current situation; It was more of a method of reading a file that contained both binary and text-only, rather than learning the pdf file structure. This is the first time I have encountered such a situation. Normally, the files would be either text or directly binary. Both are mixed here. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i %PDF-1.74 0 obj(Identity)endobj5 0 obj(Adobe)endobj8 0 obj<>streamxœì½|”Uö 7~îó