More sensitive PDF documents all have invoice numbers, contract numbers or order numbers, etc. These numbers are in uniform format, but the content is sometimes very sensitive and should not be displayed to the public. They need to be protected when sharing. Facing a lot of PDF files, and each file contains many numbers to be modified or hidden with similar structure and fixed format, if we open the files in a practical and traditional way to find and edit them manually, the process is extremely complicated and takes a long time to say, it is more difficult to ensure the integrity and consistency of the processing, and it is easy to omit.
Is there a way to shorten our processing time, accurately identify all the numbers in the PDF file that conform to the format, and replace or hide them in batch? This article introduces a quick solution to help us batch process all the numbers or single numbers in the same format in the document, greatly improving the efficiency and accuracy of processing PDF. Let's take a look at it!
When do you want to modify or hide the numbers in the same format in PDF, such as mobile phone number, logistics number, etc?
Protect private content when displayed
there are sensitive information such as logistics number, identity number or mobile phone number in PDF. If you want to send the file to customers or publish it publicly, you must hide and replace the information to prevent others from seeing the content that is not displayed to the public. We can quickly protect privacy by automatically identifying the number in the same format and replacing or blocking it.
Model document does not disclose information
the numbers, order numbers and express order numbers existing in the actual PDF files that often need to be displayed may all be real data. Direct display will be very unsafe. These digital numbers will be automatically disposed of in a unified format, such as directly covering or replacing them with * * * * * * *, so that the files can be displayed normally without revealing the real information of customers and the company.
Archiving sensitive data
when the same PDF file needs to be shared within the team, circulated by multiple departments or stored for a long time, if the number is very sensitive or has nothing to do with the business, it needs to be hidden uniformly. We can automatically identify and replace the data in the same format, avoid manual modification, and will not destroy the format of the document.
Preview the effect of batch replacing multiple numbers in PDF with other content
before treatment:

after treatment:

method 1: Use HeSoft Doc Batch Tool Hide the logistics document number in PDF in batch
recommended Index:★★★★★
Advantages:
- the function is many, the processing effect is good, the operation is simple and easy to understand, Xiaobai can also get started quickly, and supports batch processing.
- Files will not be uploaded with the nature, are processed in the local computer, to protect the user's privacy.
Disadvantages:
- can only be installed in the computer operation.
Operation steps:
1. Open 【 HeSoft Doc Batch Tool ], select [PDF Tool]-[Find and Replace Keywords in PDF]].

2. Select a method in [Add File] or [Import File from Folder] to add PDF that needs to replace or hide keywords. It also supports dragging files directly below to add, and then click Next.

3. Enter the setting option interface, select [Practical Formula Fuzzy Search Text], and enter the formula for fuzzy search in the keyword list to be searched below (for example, if we need to search for the logistics number in UPS format, we will use the following regular expression). Enter the text to be replaced in the replaced keyword list on the right, and other formulas are also supported. Finally, click Next, then click Browse to select the location to save the new file.

4. After waiting for the processing to be completed, click the red path to open the folder, and then open the PDF to view the replaced or hidden content.

Method 2: Use the PDF editor comment to cover the part of the PDF that needs to be hidden.
Recommended Index:★★★☆ ☆
advantages:
- intuitive operation, no need to learn complex functions.
- Almost any PDF editor has this feature.
Disadvantages:
- manual operation one by one, the efficiency is very low.
- It is prone to omissions and cannot handle a large number of files.
Operation steps:
1. Use the editor to open the PDF file and find the annotation function in the toolbar.

2. Select the rectangle tool and drag and drop the number to be hidden until it is covered.

3. Save the file and repeat the numbers on all pages.
Method 3: Convert to Word format using fuzzy search for replacement
recommended Index:★★★☆ ☆
advantages:
- really completely replace the text content.
- It supports batch search and replacement, and is suitable for the processing of a large number of numbers.
Disadvantages:
- more complex PDF conversions may appear garbled.
- Office 2016 and above is required.
Operation steps:
1. Open PDF with Word and press Ctrl H to open the replacement window.

2. First check the wildcard option, then find the formula with the number entered below the content, and replace it with * * * * * *.

3. Finally save as a new PDF file and continue to process the next file.
Method 4: Acrobat DC Search and Replace with Adobe
recommended Index:★★☆ ☆ ☆
advantages:
- relative manual cover more efficient, clean processing effect.
- All numbers in the same format can be processed.
Disadvantages:
- invalid for scanned PDF, may break the original typography.
- Some PDF software does not support search.
Operation steps:
1. Use Adobe Acrobat DC to open the PDF file, press Ctrl H to find it, enter the first few digits of the same format of the logistics document number, and the corresponding number will automatically appear.

2. Click in turn, and then edit and modify.

3. Then cut to the next one and replace it in turn.
Method 5: Acrobat DC Search and Replace with Adobe
recommended Index:★★☆ ☆ ☆
advantages:
- fully customize the matching rules.
- Can handle very large PDF, and can export the results list.
Disadvantages:
- need to learn the basis of editing, learning costs are large.
- PDF files cannot be modified directly.
Operation steps:
install the Python and PyPDF 2 libraries.
2. Create a new script file:
import re
import PyPDF2
pdf_file = open('input.pdf ', 'rb')
pdf_reader = PyPDF2.PdfReader(pdf_file)
# Match 11-digit mobile phone number
phone_pattern = r'1[3-9]\d{9}'
for page in pdf_reader.pages:
text = page.extract_text()
phones = re.findall(phone_pattern, text)
print(f"Found phone number: {phones}")
3. Output all matching numbers after running.