Save file automatically without prompting to save it in web browser - c#

In downloading any PDF Files, we need to click on save as popup window in IE and saving it into a folder.
Now, as an automation project, I want that save as popup window should be automatically clicked and it should save the files in the provided folder.
Kindly help us in C# code.
Many thanks.

I don't know if you can set it through code because its all about browser settings also I don't find any option in IE. However in Google Chrome you can customize your downloads using its setting. Please ask the users of your application to start using Chrome (if possible) and change its downloads setting as per the screen shot given below:

Related

How to disable download option of pdf file in c# ?

How to disable the pdf Toolbar because I don't want to give the download option to the pdf viewers.
I have used Iframe for showing Pdf File please find the following code
<iframe ID="iFrame2" runat="server" align="bottom" frameborder="2" name="iframe1" height="500" width="600" src="~/pdffiles/example.pdf"></iframe>
Please help me to disable the download option using c#.
Thanks
You cant. It is a browser feature which means you have no control over it.
You can use third party tools like Google Document Viewer or change the format of your document to an image.
Google Document Viewer
If you want to avoid that an end user saves a PDF document, you are asking something that is impossible. The only way to avoid that an end user doesn't have a copy of the PDF is by not sending him the PDF. A PDF can't be opened in Adobe Reader without having the actual bytes on the disk. Even if you would disable saving (for instance in the context of a web application), you'd always find the PDF somewhere in the temp files and people would be able to copy that file as many times as they want.
Trying to hide the toolbar (a viewer preference) doesn't make sense. Whether or not this viewer preference will be respected entirely depends on the PDF viewer. For instance: in Adobe Reader X and later, you have a special widget (HUD or Heads Up Display) that appears when you hover over the document. This widget allows users to save the document.
Let me quote Adobe:
the "Heads Up Display" (HUD) is not customizable. There are no APIs to
HUD. You can’t use JavaScript to enter Read Mode, exit Read Mode or
detect that the document is in Read Mode. Though it might seem like
it, this wasn’t an oversight. There are some very sound engineering
reasons why this is the case but I won’t go into those here.
Even with Adobe Reader 9, hiding the toolbar isn't sufficient: if the user chooses the appropriate menu item or hits the appropriate "hot key", the toolbar would appear and they could happily click the Save button. In addition, they could have right-clicked and chosen "Save" as well.
In short, you're asking the wrong question (and that probably explains the downvotes given by several people).

Automate Printer Selection c# IDM API

I am using IDM Desktop api to download a large number of documents,in this there is a function available to print the document using
IDMObjects.Document FnDoc;
FnDoc.doPrint(IDMPrinterTypes.NativePrinter);
this is working correctly and i downloaded pdf creater(printer driver) which helps me to download those documents as tiff or pdf images,pdf creater allows me to stop prompting for filenames etc so that i can easily run it through my code,my problem is even if it may not ask for filename the printer selection window appears each time doprint is called,this is the default behaviour from viewer program.
Is there a way to automaticly click "Ok" on the popup window or anyhow skip the printer selection window.
http://pic80.picturetrail.com/VOL1901/12707114/22603895/408975667.jpg
here is the solution code for this
SendKeys.SendWait("{ENTER}");
which can easily send the enter key to any window started by application

Including a .SWF file in a C# Webform

I'm currently working on a project where i need to include a application page for users. I need the users to access few .SWF flash games through this page. I created a folder named applications in the Application and imported the .SWF files into that. After that I tried directly linking them using a hyperlink on my page, but they don't seem to open :/
am i missing something? or is there something else i need to do before that?
Would really appreciate it if you can help
Thank you
I don't think you can just hyperlink to your .swf file. According to this site, and your using Dreamweaver or FrontPage, you can just insert it from the Insert menu (or something of the kind). If you aren't using either of those two, you can edit you .swf file in Flash and choose "Export as HTML" from the file menu (or where ever it is) and then just copy the source code of the resulting file to your webpage.
Normally, you should be able to open .swf files directly in your browser, although embedding the swf into your html is often a good idea, you don't have to.
If the url in your address bar shows an adress ending with '.swf' you can test if a swf has loaded by right clicking in your browser window, if you see the flash context menu (zoom in, zoom out, etc) Your swf has loaded.
If your swf has loaded, but nothing else happens, there can be many other reasons for this.
Where did you get the swf game files? If you copied them from another site it's very likely that the swf is supposed to load other files (game assets (images), settings (xml) etc) before the game can be played.
Sometimes the execution of (actionscript) code in a swf is triggered by script in the html page it is embedded in.
It's not entirely clear what you are trying to do....

Automated copy of selected text in pdf file loaded using web browser control in c#.net

This is what I have done:
I have loaded a pdf file in web browser,
Now I want to select text from that file and paste into a text box.
Can anyone help me?
I'm pretty sure that this is going to be prohibitively difficult, if not impossible, to do.
The browser does not 'run' the PDF, it acts as a host for the PDF application, which ends up sharing it's main window. After that, control of the cursor etc passes to the PDF application and the browser is effectively no longer aware of what happens inside it. If the PDF application being used exposes COM interfaces for manipulating the cursor/text selection (doubtful), then it's possible to script against those interfaces from client script - but you won't be able to actually run any script in that window because the browser is showing a PDF, not a web page.
It might be possible if you hosted the web control on a windows forms application, but even so I wouldn't even know where to start on that one.
If your goal is to extract text from the PDF then you're probably better off pushing it through a .Net PDF library. A quick google on that one will yield you some suitable libraries.
if your pdf file has form elements then the file can be submitted to a url.
check this link.. it might help.
Can a PDF fillable form post itself to an HTTPS URL?

How to handle Save As dialogue box of firefox in Selenium usng C#?

I am looking to download a file/report from a website to my local folder. I am using Selenium with C#. Until now I was able to click the download button, dialogue box open for Save as or open option. Can any one help me in Saving file to folder in MyDocuments via Firefox dialogue box?
Any help is really appreciated.
This is still an open enhancement request, so it shouldn't have ever worked for you unless you had something else handling the browser modal dialog.
http://code.google.com/p/selenium/issues/detail?id=95
Ken

Categories

Resources