Can I determine if the user printed to a real printer versus the PDF printer?

When I print in two of my apps, the new Windows printer setup allows the user to choose to print to PDF. Is there anything that I can check to determine if they have chosen this option instead of a real printer?

only by examining the printer setupstring, probably?

That info is not included unless it’s reliable to assume PDF if the setup string contains these entries:

ActualHorizontalResolution=72 ActualVerticalResolution=72 MaxHorizontalResolution=72 MaxVerticalResolution=72

I wrote some code a while ago while working on the D2D printer DPI issues that extracts as much information as I could get out of the Xojo framework including the name of the selected printer, I guess you could search that for “PDF” as a super simple method.

But as we’re not given a handle to the printer by the Xojo framework a better way of doing this is getting the name of the printer using the code above, then enumerating through all the printers to match that name which will give you access to all the information related to that printer. You can then check the Driver Name in the PRINTER_INFO_2 structure which would return you strings like “Adobe PDF Converter” for Adobe’s PDF printer and “Microsoft Print To PDF” for Microsoft built in PDF printer. These strings would always be the same no matter if the user renamed the printer on their local machine. You could even search this Driver Name for PDF if you wanted but you’d have to test it with some of the more obscure PDF printers out there though.

This is some old (not even) half finished code but the bare bones is there if you want to pick at it a bit, I’ve just given it the once over and it seems to still work, bonus!

It’s become a moot point since I can’t get the user’s selected filename for the PDF file. What I’m trying to accomplish is to open the resulting PDF file after it’s created similar to the way Mac OS allows us to “Print to Preview”.