Difference between revisions of "ReNamer:Scripts:Xpdf"

From den4b Wiki
Jump to navigation Jump to search
(Bumped up version requirements)
m (Text replacement - "<source>" to "<syntaxhighlight lang="pascal">")
Line 18: Line 18:
 
* Tested with ReNamer 5.74.4 Beta.
 
* Tested with ReNamer 5.74.4 Beta.
  
<source>
+
<syntaxhighlight lang="pascal">
 
{ Extract PDF tags using Xpdf }
 
{ Extract PDF tags using Xpdf }
 
   
 
   

Revision as of 15:01, 8 February 2017

Script integrates Xpdf command line tool in order to extract PDF tags.

References:

Requirements

Code

Author: Denis Kozlov. Date: 2013-04-01.

Modify the TAG constant to specify which tag you want to extract. For the list of available tags consult Xpdf web site or pdfinfo.exe command line tool.

  • Tested with ReNamer 5.74.4 Beta.

<syntaxhighlight lang="pascal"> { Extract PDF tags using Xpdf }

const

 EXE = 'pdfinfo.exe';
 TAG = 'Title\s*\:\s*(.*?)[\r\n]';

var

 Command, Output: String;
 Matches: TWideStringArray;  

begin

 Command := EXE+' "'+FilePath+'"';
 if ExecConsoleApp(Command, Output) = 0 then
 begin
   Matches := SubMatchesRegEx(Output, TAG, False);
   if Length(Matches) > 0 then
     FileName := Matches[0] + WideExtractFileExt(FileName);
 end;

end. </source>