How to search in pdf and use found string for renaming

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
diellar
Posts: 2
Joined: 08 Feb 2020 14:50

How to search in pdf and use found string for renaming

#1 Post by diellar » 08 Feb 2020 15:10

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

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

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

#2 Post by penpen » 08 Feb 2020 15:30

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

diellar
Posts: 2
Joined: 08 Feb 2020 14:50

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

#3 Post by diellar » 08 Feb 2020 16:00

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

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

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

#4 Post by penpen » 09 Feb 2020 14:12

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

Post Reply