guidox / Hardware

Print to a PDF File with the Built-in PDF Printer

TL;DR

Print from any app and choose **Microsoft Print to PDF** as the printer, then set the file name in the save dialog. If the printer is missing, add it with **Enable-WindowsOptionalFeature -FeatureName Printing-PDF**.

Before you start

Requirements

  • Windows 10 or 11
  • An app with a print dialog
  • 10 minutes
Step by step

Instructions

01

Check that the PDF printer exists

The printer is an optional feature and can be missing after a slim install. **Get-Printer** lists it by its exact name, which the print dialog uses.

Get-Printer | Select-Object Name,DriverName,PortName,PrinterStatus
Get-WindowsOptionalFeature -Online -FeatureName Printing-PDF | Select-Object FeatureName,State
Get-PrintConfiguration -PrinterName 'Microsoft Print to PDF' -ErrorAction SilentlyContinue | Select-Object PrinterName,PaperSize
02

Add the printer if it is gone

**Printing-PDF** installs the driver and the port in one step. A restart of the spooler is enough; the feature does not need a reboot.

Enable-WindowsOptionalFeature -Online -FeatureName Printing-PDF -All -NoRestart
Restart-Service Spooler -Force
Get-Printer | Where-Object Name -like '*PDF*' | Select-Object Name,DriverName,PortName
03

Set paper size and orientation first

The PDF printer takes the settings from the driver defaults, not from the app. Setting them before printing avoids a landscape page saved as portrait.

Set-PrintConfiguration -PrinterName 'Microsoft Print to PDF' -PaperSize A4
Get-PrintConfiguration -PrinterName 'Microsoft Print to PDF' | Select-Object PaperSize,Duplexing,Color
Get-PrintCapabilities -PrinterName 'Microsoft Print to PDF' | Select-Object PaperSizes
04

Print and choose the destination

**Ctrl+P**, then the PDF printer, then Print. The save dialog is the actual file selection, so the name and the folder are chosen there, not in the app.

# in the app: Ctrl+P > Microsoft Print to PDF > Print
# in the save dialog: pick the folder and type the name
Get-ChildItem "$env:USERPROFILE\Documents" -Filter *.pdf | Sort-Object LastWriteTime -Descending | Select-Object -First 3 Name,Length,LastWriteTime
05

Check the result

A PDF that is 0 KB means the print job failed between the app and the port. Page count and size are the two quick checks.

$f = Get-ChildItem "$env:USERPROFILE\Documents" -Filter *.pdf | Sort-Object LastWriteTime -Descending | Select-Object -First 1
$f | Select-Object Name,Length,LastWriteTime
Get-WinEvent -LogName 'Microsoft-Windows-PrintService/Admin' -MaxEvents 5 -ErrorAction SilentlyContinue | Select-Object TimeCreated,Id,Message -First 3
06

Print without a dialog when you need a fixed target

**Out-Printer** sends text straight to the printer, and the port prompts for a file name once. For a scripted export, **printui** with the printer name is the reliable path.

Get-Content 'C:\temp\report.txt' | Out-Printer -Name 'Microsoft Print to PDF'
Get-PrinterPort | Where-Object Name -like '*PDF*' | Select-Object Name,Description,PrinterName
# scripted: rundll32 printui.dll,PrintUIEntry /k /n "Microsoft Print to PDF" /f "C:\temp\out.pdf"
Troubleshooting

Common issues

The save dialog never appears

The job went to another printer, or the PDF port prompt was disabled. Check the default printer and the port settings.

The PDF has blank pages

The app prints a page range that does not exist, or a font failed. Reinstall the driver with Remove-Printer and Add-Printer.

The file is created but cannot be opened

The port wrote an incomplete file. Clear the queue, print again, and avoid saving to a network path during the print.

Hyperlinks and forms are gone

A print produces fixed pages. Use the app's own Export as PDF when the output must stay interactive.

FAQ

Frequently asked

Does it compress the images?

It uses a standard PDF compression. For a smaller file, reduce the image resolution in the app before printing.

Can I print to PDF from a command line?

Yes, with printui or with the app's own export switch. Plain text works with Out-Printer.

Is the PDF searchable?

Only if the source text was text. A scanned image remains an image unless you run OCR on it.

How to undo this

Remove the printer with Remove-Printer -Name 'Microsoft Print to PDF', or disable the feature with Disable-WindowsOptionalFeature -Online -FeatureName Printing-PDF.

Changelog · 1 entry
  1. 2026-11-01
    First version
Interactive version: checklist, feedback, related guides →

Free · no account needed · tracks your progress