简体   繁体   中英

Print automatically printable streams

I am looking for a way to print printable outputs rendered by an application.

An example to be more explicit :

Say we have an application "A" that allows us to print an output.

What I want to automate is :

  1. Detect that "A" is opened and provides an output that can be printed
  2. Go to File -> Print
  3. choose a PDF printer (Adobe, PDF creator)
  4. choose the output file name and save it.

I am on Windows XP.

Thank you in advance,

Aminsky

You will need to

  1. Install system-wide hook to detect that "A" is opened. I successfully used SetWindowsHookEx and EnumWindows for this in the past.
  2. Analyze windows contents (probably analyze window title)
  3. Prepare printer DC for a PDF printer in your application
  4. Call PrintWindow method to cause "A" to print it's window contents to PDF printer.

Please note that not all (but many) applications will properly handle PrintWindow calls.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM