Difference between revisions of "ReNamer:Scripts:Xpdf"
Jump to navigation
Jump to search
(→Code: unquoted EXE) |
(forum reference added) |
||
Line 1: | Line 1: | ||
Script integrates [http://www.foolabs.com/xpdf/ Xpdf] command line tool in order to extract PDF tags. | Script integrates [http://www.foolabs.com/xpdf/ Xpdf] command line tool in order to extract PDF tags. | ||
+ | |||
+ | References: | ||
+ | * http://www.den4b.com/forum/viewtopic.php?id=349 | ||
== Requirements == | == Requirements == |
Revision as of 03:06, 6 November 2014
Script integrates Xpdf command line tool in order to extract PDF tags.
References:
Requirements
- ReNamer 5.70
- pdfinfo.exe 3.03 in ReNamer's folder
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.
{ Extract PDF tags using Xpdf }
const
EXE = 'pdfinfo.exe';
TAG = 'Title\s*\:\s*(.*?)[\r\n]';
var
Command, Output: String;
Matches: TStringsArray;
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.