A-PDF :: Affordable PDF Tools

How to extract date from pdf pages change to YYYYMMDD format for renaming?

Return KB main page

Question

I am trying to use a date "DECEMBER 31, 2010" from the actual PDF pages, convert it to YYYYMMDD format "20101131" and use it as the new file name. How can I do this with A-PDF Rename software?

Solution

While using A-PDF Rename (free download here) to rename your files with page content, you can use content tag and then write script to carry out your needs:

1. Import your PDF file into A-PDF Rename, click "Macro->Content Tag..." to edit Content Tag, mark the tag on date "DECEMBER 31, 2010" on sample PDF page;

2. Write below script in "Advanced" window:

var
aYear,mon,aday:string;
M:integer;
Begin
tag:=trim(tag);
aYear:=rightstr(tag,4);
mon:='JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC';
M:=pos(leftstr(tag,3),mon);
mon:=inttostr(m div 4); if length(mon)=1 then mon:='0'+mon;
aday:=copy(tag,pos(' ',tag)+1,2)
tag:=ayear+mon+aday;
end.

3. Run the script and you will get below result:

a-pdf-rename-write-script-result

Need to rename your PDF files in this way, free download A-PDF Rename to use now!

You can also use A-PDF Content Splitter, A-PDF AutoMail to rename split PDF files in the same way.

Related products

  • A-PDF Rename - batch rename multiple PDF document based on content, metadata and file attributes(Size, Datetime) within PDF files. You can batch change or update multiple PDF files metadata (title, creator, producer, author, subject and keywords) as well as
  • A-PDF Preview and Rename - Preview PDF content easily, rename PDF based on content you previewed.
  • A-PDF Preview and Move - Preview content for multiple PDF files, then OCR page content to rename and define dest folder to move.

We always like improving our products based on your suggestions. Please send your feedback (or ask questions) to us in the contact page.

Return KB main page