PDF Printing Issues

How to Stop Notepad from Adding Page Numbers when Printing to PDF

Khadija KhanKhadija Khan Nov 3, 2026 869 views

Question details

The user needs to prevent page numbers from automatically appearing when printing or converting a plain text file to PDF via Notepad.

How to Stop Notepad from Adding Page Numbers to PDFs
Product
Notepad / Adobe PDF Printer
Device & OS
not provided
Scenario
Printing a text file to PDF using the Adobe PDF printer or other virtual PDF printers.
Observed behavior
Page numbers and file names are automatically injected into the top and bottom of the resulting PDF pages.
Before you start

Open the text file you intend to convert to PDF in Windows Notepad before making changes to the page setup configuration.

Solution 1Recommended

Clear Header and Footer Settings in Notepad

Modify Notepad's default page settings to prevent it from injecting page numbers and file names during the print process.

Notepad automatically inserts default formatting codes for headers and footers (which include page numbers) when sending a document to the printer. Because virtual PDF printers process the exact print output provided by the source application, you must disable this feature directly within Notepad's print settings, rather than in your PDF software.

1
Open Page Setup

In your open Notepad window, click on the 'File' menu in the top-left corner and select 'Page Setup' from the dropdown list.

2
Clear Header and Footer Fields

Locate the 'Header' and 'Footer' text boxes in the dialog window. Delete all the text and formatting codes (such as '&f' or 'Page &p') inside these fields so they are completely blank.

3
Save and Print to PDF

Click the 'OK' button to save your changes. You can now go to File > Print, select your Adobe PDF printer, and generate your PDF. The page numbers will no longer appear.

Clear Header and Footer Settings in Notepad
Permanent Configuration: Notepad will remember these blank header and footer settings for all future print jobs until you manually add the formatting codes back.
Easy PDF Conversion

Use WPS Office to Convert Text to PDF Seamlessly

Skip the hassle of adjusting clunky Notepad print settings. WPS Office allows you to open plain text files and directly export them to professional PDFs without any hidden headers, footers, or unwanted page numbers.

  1. 1. Open the Text File: Launch WPS Office, click 'Open', and select your plain text (.txt) file to view it clearly in WPS Writer.
  2. 2. Adjust Formatting (Optional): Change fonts, adjust margins, or modify the document layout to your preference without worrying about default text codes.
  3. 3. Export Directly to PDF: Go to the 'Menu' at the top left and click 'Export to PDF'. Choose your save location and confirm to get a clean PDF with exactly the layout you see on screen.
Opens .txt and other text formats instantlyOne-click 'Export to PDF' without dealing with virtual print settingsFully compatible with Microsoft Word documents and standard PDF formatsAdvanced formatting options for more professional-looking documents
microsoft office alternative - wps office

Frequently Asked Questions

Why does my PDF have '&f' or 'Page &p' printed on it?

These are default formatting codes used by Windows Notepad. The '&f' code prints the file name, and 'Page &p' prints the page number. Clearing these codes in Notepad's Page Setup entirely removes them from your printed or PDF documents.

Can I change the margins in Notepad before printing to PDF?

Yes. In Notepad, go to File > Page Setup. You can adjust the Left, Right, Top, and Bottom margins in inches or millimeters before sending the document to your PDF virtual printer.

Will changing Adobe Acrobat settings fix the Notepad page number issue?

No. The headers and page numbers are injected by Notepad itself before the document even reaches the Adobe PDF printer. You must clear the Header and Footer settings within Notepad to resolve the issue.

How do I restore the default headers and footers in Notepad?

To restore them, simply go back to File > Page Setup in Notepad. Type '&f' into the Header field to display the document's file name, and 'Page &p' into the Footer field to display the page numbers again.