C# code to 'Save As' an HTMl page containing PDF file

Posted on 2009-04-30
Last Modified: 2012-05-06

I was looking for the code in C# where I am working on the automation of an application. My question is that, while the application is running it opens up a new 'Internet Explorer' window inside which it opens a PDF file.

Now I want to perform following things in this page using C# code:
1. 'Save As' the PDF file to any location.
2. Click on the different buttons available in this page like 'Print', 'send email', save.

Please if someone can provide the solution ASAP, it would be very helpful.

- Dev
Question by:dev_qasource
    LVL 9

    Expert Comment

    How you're converting into PDF , are you using Adobe ActiveX Dll for this or any thirdparty .dll files.

    Author Comment

    We are not converting this into PDF, its actually the web application itself which opens a new pdf file in the new 'internet explorer' window.
    LVL 2

    Expert Comment

    If you're trying to automate tasks, try a scripting language like There is also a DLL/COM Control which you can add to your C# Applications.

    (I've used AutoIt a few times to automate tasks for large financial companies).

    Let me know if you need any further info.


    Author Comment

    I have a question here, since I am using Visual Studio Team system 2008 team system integrated with WebAii design canvas tool (v1.1).

    The Application I am automating is fills a form and then clicking on a button generates a PDF file in the internet explorer itself. Now how would i generate the code using this tool?

    I am not able to get what this tool will do for me and how?

    LVL 2

    Accepted Solution

    AutoIT allows you to access GUI components (e.g. a TextField) or HTML fields and manipulate them.

    So, assuming that you enter a value into a TextField of a specific application (called "theSpecificApp"), an example code could look like this

    Send("{TAB}{TAB}{ENTER}") ;Use Tab/Right/Left Combinations to hit the button.. ooor
    ;MouseClick("left", 100, 200) ; Click with the left mouse on monitor position X Y (100 200)
    WinWaitActive("Internet Explorer with pdf") ; Wait until the IE Window pops up


    With AutoIt you can control Windows Form Elements, IE Objects and lots more. Check out the help file and you'll find everything needed.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now