Difference between revisions of "ReNamer:Scripts:Xpdf"
Jump to navigation
Jump to search
m (Text replacement - "</source>" to "</syntaxhighlight>") |
(Updated references links and tested with newer versions.) |
||
Line 1: | Line 1: | ||
{{Up|ReNamer:Scripts}} | {{Up|ReNamer:Scripts}} | ||
− | Script integrates [http://www. | + | Script integrates [http://www.xpdfreader.com/about.html Xpdf] command line tool in order to extract PDF tags. |
References: | References: | ||
Line 8: | Line 8: | ||
== Requirements == | == Requirements == | ||
− | * [http://www. | + | * Download [http://www.xpdfreader.com/download.html Xpdf tools] and extract <code>pdfinfo.exe</code> into ReNamer's folder. |
== Code == | == Code == | ||
Line 14: | Line 14: | ||
Author: Denis Kozlov. Date: 2013-04-01. | Author: Denis Kozlov. Date: 2013-04-01. | ||
− | Modify the <code>TAG</code> constant to specify which tag you want to extract. For the list of available tags consult [http://www. | + | Modify the <code>TAG</code> constant to specify which tag you want to extract. For the list of available tags consult [http://www.xpdfreader.com/support.html Xpdf] web site or <code>pdfinfo.exe</code> command line tool. |
− | * Tested with ReNamer 5.74.4 Beta. | + | * Tested with ReNamer 5.74.4 Beta + Xpdf tools 3.03; ReNamer 6.7 + Xpdf tools 4.00. |
<syntaxhighlight lang="pascal"> | <syntaxhighlight lang="pascal"> |
Revision as of 20:01, 25 September 2017
Script integrates Xpdf command line tool in order to extract PDF tags.
References:
Requirements
- Download Xpdf tools and extract
pdfinfo.exe
into 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.
- Tested with ReNamer 5.74.4 Beta + Xpdf tools 3.03; ReNamer 6.7 + Xpdf tools 4.00.
{ 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.