Short answer, no, Print Preview is a common but optional client-side feature and preference that in an uncontrolled environment (the Internet) you do not have programmatic access to.
If you do have a controlled environment then you can just install custom software that you can program against. But since you're asking in the first place I'm assuming this won't be an option for you.
As @jaredlee.exe said, your best best is to pop open a new window but instead of linking directly to the PDF you could try linking to a simple page that has a full-page iframe
or object
(or possibly embed
) that points to your PDF. Then you could bind an onload
(or onreadystatechange
or domcontentloaded
or whatever else) event that fires the print()
method for that specific object.
That all said, there's a really big point to understand and that's that web browsers having the ability to render PDFs natively is a relatively new thing. Adobe shipped a plugin for IE (and maybe Netscape) in the 90's and over the years newer browsers like Chrome and Firefox were added. Overtime, however, these programs started to add their own PDF renderers and once they did that they actually disabled Adobe's. On top of that, operating system vendors (who often happened to also be browser vendors) started to add native PDF renderers directly to their operating system. Some people (myself included) believe that all of these renderers pale in comparison to Adobe's reference renderer so we then disable the built-in ones wherever we find them. So for me (and I know I'm weird) all of these options would still, at best, result in an empty window that's trying to print a blank page and a downloaded PDF.
To restate the above, a web browser is most commonly used to view web pages. The moment you switch to PDFs you are no longer in the "web world" but the "PDF world" and you aren't controlling a "web browser" but instead a "PDF renderer". Unfortunately there's no specification for talking to "PDF renderers" out there because the field is still too new.
To restate my restatement, this all might work some or most of the time, but also don't be surprised if there are edge cases that completely fail.