you can change Registry for pdf printer port to D:\002.PDF OR E:\ABC.PDF

If you modify the exported PDF path every time you print it, you can realize continuous numbering. Save to any file name and path.
You don't need any hook API, and you don't need to write any code.
Just change the port of the printer from USB,LPT to file name, as simple as that.

Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports]
"D:\\output.pdf"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Microsoft Print to PDF]
"ChangeID"=dword:0b79c556
"StatusExt"=dword:00000000
"Status"=dword:00000180
"Name"="Microsoft Print to PDF"
"Port"="D:\\output.pdf"