[Solved] How to search for value in pdf? lazarus / 21-General ---------------------------------------------------------------------- loaded · 2022-01-27 16:19 Hi All, I will have to do a study on this subject soon. For example, can I access the id value in the attached pdf using stream? I would be very pleased if friends who have experience and knowledge express their ideas and suggestions. Respects. ---------------------------------------------------------------------- winni · 2022-01-27 17:48 Hi! There is the linux tool pdftotext with this simple syntax: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i pdftotext some.pdf some.txt  It is from the llinux package Xpdf.  This was ported to Windows. The output for your sample is this: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Çalışma Sayfası1 Id 9960515081 Sayfa 1 L  Winni ---------------------------------------------------------------------- loaded · 2022-01-27 18:03 winni my esteemed brother, Thank you very much for taking your precious time to reply. I put your suggestion at the top of my to-try list. If I can't solve it by reading binary directly or if I can't find another solution, I will definitely use it. ---------------------------------------------------------------------- Jurassic Pork · 2022-01-28 12:17 hello, it is also possible with Python4Lazarus using the module pymupdf( including mupdf library): Script python to execute from Lazarus : Code: Python  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i import sys, fitzfname = 'd:/temp/sample.pdf'  # get document filenamedoc = fitz.open(fname)  # open documentfor page in doc:  # iterate the document pages    print('==   Text  ===')    text = page.get_text("text")    print(text)    print('==   HTML  ===')    html = page.get_text("html")    print(html) python print is redirected in a Tmemo. Result in attachment. Friendly, J.P ---------------------------------------------------------------------- loaded · 2022-01-28 12:35 Thank you very much, Jurassic Pork, for taking the time to reply. Another research topic (one starts before another ends) has emerged for me. I will consider your solution. In the meantime, I did not sit idle and in my research; I learned that the data in the pdf is encoded as FlateDecode. I'll do some more research, it sounds like it's solvable. Thank you very much Jurassic Pork and winni, your suggestions made me have an idea about not reinventing the wheel. I solved my problem with ghostscript. By the way, ghostscript can easily split, merge and rotate pdf files.Respects. ---------------------------------------------------------------------- paweld · 2022-01-28 14:00 You can also use PDFium - example attached. Download libraries from: h ttps://github.com/pvginkel/PdfiumViewer/tree/releases/2.12.0.0/Librari es/Pdfium ---------------------------------------------------------------------- loaded · 2022-01-28 15:42 Dear paweld, thank you very much for the reply. Yes, I will try your suggestion at a convenient time. ---------------------------------------------------------------------- pcurtis · 2022-01-28 16:54 @paweld Perfect Adobe / Foxit / ... can kiss my shinny metal ... 7Mb reader not 500Mb ---------------------------------------------------------------------- alaa123456789 · 2022-02-15 17:09 this pdfium viwer not written in lazarus , we need a sample in lazarus if possible thanks ---------------------------------------------------------------------- pcurtis · 2022-02-15 17:50 paweld supplied a sample project ---------------------------------------------------------------------- alaa123456789 · 2022-02-15 18:12 Well done , thank you ---------------------------------------------------------------------- ginoo · 2024-01-09 10:08 Quote from: paweld on January 28, 2022, 03:00:54 pmYou can also use PDFium - example attached. Download libraries from: https://github.com /pvginkel/PdfiumViewer/tree/releases/2.12.0.0/Libraries/Pdfium Hello, do you also happen to have an example that works on linux? ---------------------------------------------------------------------- paweld · 2024-01-10 06:52 @ginoo: unfortunately no ---------------------------------------------------------------------- madref · 2024-01-10 09:58 Read this post and see if it can help you. ---------------------------------------------------------------------- ginoo · 2024-01-10 17:05 Quote from: madref on January 10, 2024, 10:58:53 amRead this post and see if it can help you. Thank you for responding. I took a look but I don't think that's what I need. I wanted to be able to put text into an existing pdf. I had also tried "pdfvectorialreader" but I can't even compile it. ---------------------------------------------------------------------- loaded · 2024-01-10 18:04 Quote from: ginoo on January 10, 2024, 06:05:26 pmThank you for responding. I took a look but I don't think that's what I need. I wanted to be able to put text into an existing pdf. I had also tried "pdfvectorialreader" but I can't even compile it. If you want to add text to the beginning or end of the pdf, you can try ghostscript scripts. But if you want to change the text in the content of the pdf, I don't know. https://forum.lazarus.freepascal.org/index.php/topic,65199.msg496587.h tml#msg496587