Page 1 of 1

How to search in pdf and use found string for renaming

Posted: 08 Feb 2020 15:10
by diellar
Hi guys,

I m new in programming so sorry for stupid questions.

My Problem is:

I want to rename several PDFs. I would like to examine the content of the PDFs, more precisely a date within the PDFs to rename them with this date.
The date within the PDFs cannot be displayed with a simple text editor. The date can only be displayed with a PDF reader or the file must be converted.

Is it even wise or possible to do this with a batch file or do I need something like Python?

Thanks a lot in advance.

Greets

diellar

Re: How to search in pdf and use found string for renaming

Posted: 08 Feb 2020 15:30
by penpen
If the content of your PDFs are not encrypted and if the text is not rendered based on binary data representation,
then you should be able to use batch for that task (you could open your PDFs in notepad.exe to see if the search string could be found there),
although other script languages like vbs or jscript might be more usefull;
dbenham's hybrid jscript/batch-script "JREPL.BAT" could help you:
viewtopic.php?f=3&t=6044

penpen

Re: How to search in pdf and use found string for renaming

Posted: 08 Feb 2020 16:00
by diellar
Hi,

thanks for your fast answer.

Yes, I already tried to open it with a simple text editor. But the relevant information was not shown there respectively was not shown
unencrypted.
So I downloaded a free converter which converts pdf into .txt. So the problem still is that I want to do this automatically.
I searched a little bit in the web and I think maybe I should use Python for this task

I also had the idea to start and control the conversion program via batch. However, I don't know how to do that using the
batch command. I think that would also be very complex or not feasible.

Greets

diellar

Re: How to search in pdf and use found string for renaming

Posted: 09 Feb 2020 14:12
by penpen
diellar wrote:
08 Feb 2020 16:00
I also had the idea to start and control the conversion program via batch. However, I don't know how to do that using the
batch command. I think that would also be very complex or not feasible.
It might be complex and not feasible, some programs not even support command line arguments at all;
but we currently can't know that, because we don't know which program you might have downloaded.
However you might smply search for command line arguments for your tool using google (or similar)-
Python also sounds like a good choice (depending on the compiler and interfaces you are using).


penpen