webbrowser control shows a save as dialog instead of displaying a local .mhtml page - webbrowser-control

This one has me scratching my head.
We have a "Previewer" which hosts a WebBrowser control.
When this "Previewer" is used to "preview" a Word document or Excel Spreadsheet I use some code to convert the document to a .mhtml file. I then tell the WebBrowser to navigate to that.
This works fine on many machines but not all. On some machines, instead of "navigating" to the mhtml and displaying it in the WebBrowser control, the WebBrowser control takes it upon itself to present a "Save As" dialog, asking the user to save the .mhtml file to their PC.
What is going on here, and how do I stop it?
Thanks
An example of the sort of file I try to navigate to:
"file://127.0.0.1/C$/Users/blahblahblahhere/AppData/Local/furthersubfoldershere/637183327673490444_Document1_486951.mhtml"
All I'm doing is
oWB.Navigate(....)
Ok.... this may also be relevant. This happens when a user is using an add-in we wrote in Outlook 365.... So the WebBrowser control is hosted in our Add-in in one of the forms it pops up as the user is doing their thing in Outlook.

Well, I still don't know why it does this for an .mhtml file, but I found that converting it to .html instead actually works. I was reluctant to do that as a Word Document or an Excel Spreadsheet converted to HTML might produce an .HTML file with lots of associated files, e.g. for images. But while it does indeed do that, as it turns out it still works quite happily in the WebBrowser control. And without popping up that "save" dialog.
If you must use MHTML I have no solution for you, but if HTML is "good enough" for you, well, that's how I fixed it for myself.

Related

PDF - Open Bookmarks Panel when pdf opens

When I open a certain pdf file on SharePoint, I wish to see the Bookmarks Navigation tab open by default. I can do this manually by File > Properties > initial View and changing the Navigation tab to "Bookmarks Panel and Page".
I need to do this with hundreds of pdf files and then upload them to SharePoint.
I am using VBA. I don't mind using other forms of automation.
Currently, I have AVDoc (CAcroAVDoc) and can open the Bookmarks Pane but it's not changed in the settings.
AVDoc.SetViewMode 3
I tried PDDoc.SetInfo etc but nothings changing the "settings".
Any suggestion will be appreciated.
I am running a lot of code in Excel VBA, that does a lot of pdf manipulation. The only thing that remains is to change the settings.
With Acrobat as the runtime, there is no scriptable interface to the initial view settings. However, you can easily use any of several .NET PDF libraries to make this change. A Google search for ".NET PDF Library" will yield both free and commercial varieties. You'll need to research which one is best for your task and skill set.

Simulate drag & drop file to website in VBA

I have an Access database that uses VBA code to generate a GPX map file. That works fine. I then want the contents of the GPX file to be displayed on a website, https://mapy.cz
The method that the site authors intend is for users to open the site, then manually drag and drop GPX files onto the site, at which point the contents are read in and displayed by the website. This also works fine.
What I want to do is NOT require my database user to open a browser, locate the file and drag it onto the browser by hand. I want my VBA code to not only create this GPX file, but also open the user's default browser, direct it to this mapping site (all this also works okay), but then SIMULATE or FORCE the drag and drop action FROM MY VBA CODE. That is the part that on which I'm floundering. I've looked up things like using VBA's IE.Document object, and it seems to me that it should be in there somewhere, but I can't find anything that makes sense to me.
I've done similar things in the past, with SendKeys to simulate the user typing, and AutoIT to code-control a running DOS application, including reading the programs responses from the DOS screen and forcing in commands, all from VBA. It seems to me that this should be possible, and not even all that uncommon a requirement, but I've not located anything helpful in all my searching, and I've done a lot. Maybe I'm simply phrasing my searches wrong, but at this point, I'm just flat stuck.

Download Excel file from URL

Background
I am attempting to automate the downloading of an Excel file given a URL. I know how to do this, and realize there are many examples for how to do this using either the webbrowser or webclient control however my situation is somewhat different.
Problem
If I simply paste the URL into a normal browser, it will result in asking me to save / open the file like normal. When using the same URL with either the web browser or web client controls, it results in no file. I believe this is because the URL is simply a SharePoint link, that sends a request to get the file, but is not the actual file itself.
This can be done for security reasons or whatever the case is but I was wondering if anyone has ever found a way around this?
Perhaps a way to even just emulate the browser, then emulate clicking save?
The URL for the Excel file does NOT end in .xlsx, it ends in something like:
webclient/zhZZXYRyAaLUgD?TC_file=redirs/viewdataset
which is why I think the server simply processes the request and then provides the browser the file.
I am attempting to do this in VB.NET but VBA or VB answers seem like they should work as well.
Fiddler Results
I seemed to find an easy way to solve my problem. After downloading my file within Internet Explorer, and then viewing my recent downloads, IE has an option if you right click and select "Copy Download Link". This puts the true download URL in the clipboard and actually works using the My.computer.downloadfile method.

Creating a Record Option on a PDF or Word Document

I am going to preface this with the question on a more general scale then go on to explain my specific issue.
Is there a way to create a word document, pdf, or anything comparable that I could add a "Record Audio" button to that would save the audio with the file as well as all the other info that might on a pdf/word form?
I know that Adobe Pro has a leave audio comment option, but I am creating this for a user and I do not want them to have to use that. The reason I need this is that I currently have a form usually gets partially filled out and then passed on with a dictation that needs to be transcribed at a later time. I am aiming to do this so that I can have the form and audio file linked and saved under one file.
If there is a way to leave the audio comment on a pdf with some javascript that is triggered by a button, I am perfectly okay with that I just have no clue how to program that (in terms of syntax, I am comfortable programming that isn't the problem lol).
I am also open to forms of documents other than pdf or word. I only mentioned these as they are the industry standard, but if there is another file type that would work around this, I am more than glad to use it!
I am using word 2013 by the way.
Thanks in advance!
You could write a TaskPane Addin that shows the audio controls. Once the recording is complete, the audio could be saved in the CustomXML parts in the document.
Then other users who receive the document and have your AddIn, will be able to listen to the recording.
I have not verified it in-depth, but it would be possible to add a button to the PDF file which creates a Sound annotation. The user should be then automatically asked (via a dialog) to record it.

Hiding the "You cannot save data typed into this form" message in Acrobat

I am embeding a PDF form on my web application. The application allows you to fill in the fields in the form, and when you are done, click on a "Submit" button, which saves whatever you've entered into the form. This functionality is working fine.
Unfortunately, Adobe Reader displays a message on top of their embeded control that says: "Please fill out the following form. You cannot save data typed into this form. Please print your completed form if you would like a copy for your records."
Now, I know what Adobe Reader is trying to tell the user. Basically, Adobe Reader will not allow you to save the contents of what you've entered into your local hard drive as a new PDF.
However, since we've added a Submit button which effectively will save what they typed within our application, and it is working. Therefore, we think this message is misleading, and would like to remove it.
I use iTextSharp in .Net for our form automation server side. I have not found a way to remove this message from the embeded forms.
Any help?
It has been a long time, but adobe has added option to hide this annoying message.
On OSX 11.0.3, Preferences>Forms>Always hide document message bar
I'm pretty sure that there is no way around this if you want to continue to use Acrobat Reader to display the PDF. This message is built into Acrobat Reader, and I am not aware of any way to override it from the outside.
Sorry, this is more in the way of a negative answer than a positive one.
There are some third-party, free, projects that are basically PDF viewers for .NET. This would allow you to get rid of the message by avoiding Acrobat Reader entirely, although this is a large amount of work just to get rid of a message.
This one is pretty comprehensive.
Another option that I'm sure you already thought of is to just build the form on the web page, instead of using the PDF. Again, a lot of extra work just to remove a message.
Adobe Acrobat (Standard and Pro) can change PDF forms to enable Adobe Acrobat Reader users to 'fill+save' form data (instead of the standard 'fill+print').
It is a special option available when saving the PDF saying "Save PDF with extended Reader functions" (or similar... I'm translating this back from German into English).
This cannot be achieved with any non-Adobe PDF creating software (unless this has licensed that function from Adobe). The technical reason for this is that Adobe uses a digital signature to protect this function, and that you'll have to agree to not reverse engineer the key when you accept the Adobe EULA. Acrobat Reader has that key compiled into its binary, and if it verified the key, it will change the message displayed to the user indicating that the form data of this document can be saved (it will also change its behaviour and indeed save the data).
Maybe this info helps you?
Switch to View > Full Screen Mode (short cut is on a mac is ⌘L).
Although this mode hides all menus and scroll bars too, I prefer it. IMHO the reader uses far too much screen real estate on junk)