Skip to main content
Inspiring
May 14, 2025
Answered

How to add page numbers to PDF that will persist when document is "saved as" text?

  • May 14, 2025
  • 1 reply
  • 2409 views

I have a batch of PDF documents that were created from scans and OCR'd. As a next step I need to save them as text, but before I do I'd like to add page numbering (e.g. 'page 1 of 5') that will appear in the text output to identify the location of the text within the larger document. 

 

I did try placing page numbers in the PDF header, but so far I haven't found an export format that retains the header content. (I tried exporting as txt, rtf, and PDF-A. I also tried saving the PDF using the "with comments and document stamp" setting.) 

 

I'd appreciate any advice on how to retain the page numbers in the text output. 

Correct answer kathy_7334

Strange... I would expect it to export, too. Maybe because it's on a layer it doesn't get included.

So yes, you can use a field, but you'll need to flatten it after adding it to convert it into "static" page contents. And then it will export for sure.


Hi @try67 , I unsuccessfully tried flattening and then exporting to plain text before posting here and that method does not preserve the header information. But I played around some more with export types and what DOES seem to preserve the header content is flattening and then exporting to accessible text, so that might be a good solution for me. 

Thanks again.

1 reply

S_S
Community Manager
Community Manager
May 14, 2025

Hi @kathy_7334,

 

Hope you are doing well. Thanks for reaching out!

 

I have a suggestion: 

Instead of using Header & Footer, use the Edit PDF > Add Text tool to manually insert page numbers onto each page using actual text objects. This method embeds the text in the content layer and will be picked up by Acrobat when exporting to .txt.

Steps:

  1. Open the PDF.

  2. Go to Tools > Edit PDF.

  3. Use Add Text to manually insert "Page X of Y" at the top or bottom of each page.

  4. Save and export as .txt.

Let me know if this works for you.


Regards,
Souvik.

Inspiring
May 14, 2025

Thanks for your quick reply, @S. S.  Since I'll be batch processing many files, is it possible to automate the process of inserting and populating the text objects?

try67
Community Expert
Community Expert
May 14, 2025

You can specify the settings once in your Action, and they will be applied the same for all files you process with it.