Change Date Format in PDF Bookmarks
Tutorial for AutoBookmark™ plug-in for Adobe® Acrobat®
- Introduction
- The tutorial shows how to convert dates contained in PDF bookmark titles from one format to another. We are going to explain how to use Search and Replace Bookmark Titles operation provided by AutoBookmark plug-in to convert dates recorded as Day of the Week, Month DD, YYYY into DD/MM/YYYY format. For example, convert Wednesday, February 1, 2023 into 1/2/2023. This is a typical date format listed on email messages. It is desirable to convert dates into sortable numeric format such as DD/MM/YYYY or MM/DD/YYYY formats. This will allow sorting bookmarks by date and re-organize pages accordingly.
- We are going to assume that PDF document already has bookmarks with titles that contain dates in Day of the Week, Month DD, YYYY format. The goal is to automatically convert dates in the titles into DD/MM/YYYY or MM/DD/YYYY format. We are going to use a set of search and replace rules to perform the conversion. The following screenshot explains what we are trying to accomplish.
- Prerequisites
- You need a copy of the Adobe® Acrobat® (Standard or Professional) along with the AutoBookmark™ plug-in installed on your computer in order to use this tutorial. You can download trial versions of both the Adobe® Acrobat® and the AutoBookmark™ plug-in. Note that plug-in does not work with free Acrobat® Reader.
Step-by-Step Instructions
- Sample Cases
- The tutorial shows how to perform the following date conversions: Please read instructions for the first case before proceeding to the second and third examples.
- Open PDF Document
- Start the Adobe® Acrobat® and open a PDF file you want to process using “File > Open…” menu. The sample PDF file we are going to use already contains bookmarks using Day of the Week, Month Day, Year formatting for the dates.
- Create Replacement Rules
- Open any plain text editor (for example, Notepad) and type the following text into it using [Tab] symbol as a separator between fields. For example, type January[TAB]1. This rule will replace every occurence of word January with 1. The first line in the text file is always a header/title and is ignored from processing. You can type any text here as a description for the rules. Lines 2-14 in the text file contain rules that replace a month with a corresponding number. January with 1, February with 2, March with 3 and so on. The last rule is more complex. It is a regular expression that finds dates (after months have been replaced with numbers) and re-arranging text into DD/MM/YYYY format. Please consult any online source for regular expressions syntax. We recommend using https://www.regular-expressions.info as a good source of reference information.
- Save this file as ConvertDates.txt file using File / Save menu in Notepad.
- You can skip this step by downloading this text file directly from our website.
- Open "Replace Bookmark Text" Dialog
- Use File / Plug-ins / Bookmarks / Modify Bookmarks / Find and Replace Text... menu to open Replace Bookmark Text dialog.
- Check "Use text control file to perform multiple search and replace operations at once" option.
- Press Browse... button and select ConvertDates.txt file that was created in the previous step.
- Run Processing
- Press OK button to apply search and replace rules.
- All dates in the bookmark titles should be converted into DD/MM/YYYY format:
- Modify Rules for MM/DD/YYYY Format
- It is easy to modify rules for any other output date format. The following settings file contain slightly different last replacement rule to get MM/DDD/YYYY in the output.
- Another Example: Convert DD Month YYYY into DD/MM/YYYY
- The following replacement rules show how to convert from slightly different date format DD Month YYYY into DD/MM/YYYY. For example, use it to convert 12 February 2023 into 12/02/2023. The last rule in this case is different from the previous examples:
- This set of rules is going to perform the following text replacement: