Problematic PDF download: Prevent IE from opening PDFs

Share your tips, tricks and favorite iMacros macros, scripts and applications for web automation in general here.
Post Reply
Hannes, Tech Support

Problematic PDF download: Prevent IE from opening PDFs

Post by Hannes, Tech Support » Thu Dec 07, 2006 4:32 pm

Sometimes there is no link to the PDF you want to download, so you cannot use the standard "Save Target As" method (cf. http://wiki.imacros.net/SAVEITEM and Save Target As).

In these cases (and assuming there is no way to get the URL of the PDF by other means), you might automate downloading nevertheless: by preventing the browser from opening the PDF. If the document is neither opened in the embedded viewer (i.e. in the IE/iMacros browser window), nor opened by the Adobe Reader, then you can download it like any other file (using an ONDOWNLOAD command in your macro).

Here's how to prevent IE/iMacros browser from opening the PDF:

1) Change Adobe Acrobat Reader settings:
  1. Run Adobe Reader
  2. From the main menu, select Edit - Preferences
  3. Click on Internet
  4. Uncheck the 'Display PDF in browser' setting (see Adobe Reader Preferences.png attachment)
Adobe Reader Preferences.png
2) Disassociate .PDF from Adobe Reader in Windows:
  • Windows 7:
    1. Open an elevated command prompt with administrator privileges (right-click Command Prompt from the Start Menu and select 'Run as administrator')
    2. Enter the following commands and press ENTER after each one:
      • assoc .pdf=
      • ftype acrobat=
  • Windows XP:
    1. Open a My Computer/Windows Explorer window
    2. Select Tools - Folder Options from the menu
    3. Select the File Types tab
    4. Find the PDF extension and delete it (see Folder Options.png attachment)
Folder Options.png
Note:The next time you run Adobe Reader on the machine, it might automatically restore the PDF extension association. Just remember that the PDF association needs to be removed again by following these steps before running your macro.

In case you don't want to make these changes to your profile/login, just create another user/profile, apply these changes to this user, and use iimRunner (cf. http://wiki.imacros.net/iimRunner, http://forum.imacros.net/viewtopic.php?t=1439) to have iMacros run under this user's profile.
jlavender
Posts: 40
Joined: Tue Nov 28, 2006 12:27 am

Post by jlavender » Thu Dec 07, 2006 9:15 pm

No luck. I followed your instructions and my PDF still appeared in the frame. However, I can construct the URL to the PDF. I tried this and it came back with an error, but it might be my syntax:

TAG POS=1 TYPE=SELECT ATTR=HREF:GOTO=https://xxxxx.com/im/CreateCONSPDF.asp? ... yy&epr_id= CONTENT=EVENT:#SAVEITEM
Jack Lavender
jlavender
Posts: 40
Joined: Tue Nov 28, 2006 12:27 am

Post by jlavender » Thu Dec 07, 2006 9:28 pm

Found a bit more information. The iframe is displaying the PDF using the toolkit from http://www.activepdf.com/ - I found the reference buried in the document properties.
Jack Lavender
Post Reply