How to serve .RTFs - ms-word

I support a web-application that displays reports from a database. Occassionally, a report will contain an attachment (which is typically an image/document which is stored in the database as well).
We serve the attachment via a dynamic .htm resource which streams the attachment from the database, and populates the content-type based on what type of attachment it is (we support PDFs, RTFs, and various image formats)
For RTFs we've come across a problem. It seems a lot of Windows users don't defaultly have an assocation for the 'application/rtf' content-type (they do have an association for the *.rtf file extention). As a result, clicking on the link to the attachment doesn't do anything in Internet Explorer 6.
Returning 'application/msword' as the content-type seems to make the RTF viewable when clicking on the link, but only for people who have MS Office installed (some of the users won't have this installed, and will use alternate RTF readers, like OpenOffice).
This application is accessed publicly, so we don't have control of the user's machine settings.
Has anybody here solved this before? And how? Thanks!

Use application/octet-stream content-type to force download. Once it's downloaded, it should be viewable in whatever is registered to handle .rtf files.

In addition to the Content-Type header, you also need to add the following:
Content-Disposition: attachment; filename=my-document.rtf

Wordpad (which is on pretty much every Windows machine) can view RTF files. Is there an 'application/wordpad' content-type?
Alternatively, given the rarety of RTF files, your best solution might be to use a server-side component to open the RTF file, convert it to some other format (like PDF or straight HTML), and serve that to the requesting client. I don't know what language/platform you're using on the server side, so I don't know what to tell you to use for this.

Related

LotusNotes: saving documents as email files

I need to ask you about the possibility of saving LotusNotes documents (with the attachments) as separated files in EML format on a hard disc.
Of course it's not important to keep the original document's look but it's very important to input into the file the content of the notes document including all the attached files.
The reason is to be able to open the exported file in an email client.
Is it possible?
Do you have any experience with resolving a problem like this?
The easiest way to do this for a small number of documents is to use #MailSend to forward the documents to a Notes user account or to mail-in database, and then go into that mailbox, select the message, and drag it to your desktop. Recent versions of the Notes client will save the document as .eml file that can be opened in Outlook or other standard mail clients. Or instead of sending to something in Notes, you could send to a non-Domino email system, connect with Outlook and do the same drag-to-desktop there, which I believe results in a .msg file instead of a .eml file, but they're essentially the same.
To automate it for a large number of documents that I need to do in one batch, I might still use the #Mailsend approach, but I'd do this on a dedicated Domino server. I'd address the email to an external address, and I'd set up SMTPSaveOutboundToFile=1 in the notes.ini file of that dedicated Domino server.
I think the Notes-client drag to desktop operation results in somewhat higher fidelity in the .eml file than either of the other approaches, but it's been about ten years and three major Notes/Domino versions since I played around with any of these.
Yes this can definitely be done programmatically. To do this, convert the doc to MIME via convertToMIME() using the DxlExporter to do the rest of the work. It creates XML output that contains a <mime> tag in which the output of the fully converted MIME format document resides. See this for a full description: How to Programmatically Convert Lotus Notes email Document to MIME Format

Download message from Google group

I need to download an archived google group.
Following link is one of the messages of that group for example.
https://groups.google.com/forum/#!topic/sci.aeronautics/ViFtpXfVm7M
The problem is, what i see in the browser does not appear in the downloaded webpage.
With my very limited knowledge, It seems to me like the reason behind it is this content is dynamically created by java-script. Or else, these downloaded files are with so called 'mbox' extension which is encrypted ?
What I've tried so far
First trys
Simple download
wget https://groups.google.com/d/topic/sci.aeronautics/ViFtpXfVm7M
With mirror
wget --mirror https://groups.google.com/d/topic/sci.aeronautics/ViFtpXfVm7M
Assuming its encrypted
With cookies.
wget --load-cookies=cookies.txt https://groups.google.com/d/topic/sci.aeronautics/ViFtpXfVm7M
Got thunderbird to setup my gmail and opening. did not open correctly
Assuming the content was javascript generated
Downloaded using phantomJS
https://askubuntu.com/questions/411540/how-to-get-wget-to-download-exact-same-web-page-html-as-browser
Downloaded using phantomJS with a different script
https://gist.github.com/giocomai/247d54e097b5083e2451
Used scripts available from Github
https://github.com/henryk/gggd
https://github.com/icy/google-group-crawler
But none did not work so far.
Can anyone please shed some light on how to download this page with its message as a readable html or txt file ?
Cheers
AyyoSalli
You could use https://groups.google.com/forum/feed/sci.aeronautics/msgs/atom.xml?num=100 to get some of the posts - but it only gets roughly half the posts in this case.
And it has all the messages from all topics together.
View it in Firefox or Classic Opera to see directly in a more human-readable form.
But since you say you already got a file in standard mbox format, what exactly is wrong with it - did you attempt to import it into a locally installed email or newsclient ? (like Thunderbird)

Generate multiple sheets in one pdf file

I am trying to generate a pdf from a Tableau workbook which has two sheets using the url method:
E.g: https://TableauServer/views/workbook/sheet1?:format=pdf&parameter=value
I am doing this in a program which will issue the url request to the url. The url works fine for one sheet. But the problem is how to generate one pdf file with both sheets in it?
If you first put your two sheets into a single dashboard and then use the URL for the published dashboard (still using the format=pdf parameter), this should work just fine.
We know it's possible because within the Tableau pages itself if you download a PDF it gives you several formatting options, including the option to put all the worksheets in a workbook into a single PDF.
I couldn't find any documentation on it though. What I ended up doing was looking at the network console in the browser (usually F12) when I downloaded the PDF from the browser by clicking the Download button. That showed me the URL end point and the JSON body the server expected in the request payload.
The endpoint URL wasn't too cryptic and ended with "commands/tabsrv/pdf-export-server". The challenge was to take the JSON in the request payload and find the right settings to get it into a single PDF.
This method is a more technical approach and requires very little coding skills; any language that has functions for http calls will work (I use python for it).
If you don't mind doing it outside a browser, tabcmd has lots of functionality to control PDF generation at the command line.

How to select a URL from an email in mutt and open it in a web browser?

When I read mails I sometimes would like to select one of the links in the mail's text to open it in a web browser.
Before you answer, I know there is urlview, but there are also BASE64-encoded (or other transfer encodings) mails from which urlview does not find any URLs. Then there are also HTML-only mails that can also be encoded with transfer encodings.
I wonder if there is a trivial and/or nice solution that I couldn't find. I cannot be the only one with this problem. It does not need to be based on urlview, of course.
urlview will work if you employ the "pipe_decode" setting. Example use in a macro, binding to "\u":
macro index,pager \\u "<enter-command>set pipe_decode = yes<enter><pipe-message>urlview<enter><enter-command>set pipe_decode = no<enter>" "view URLs"
with urlscan there exists a worthy successor to urlview.
Support for emails in quoted-printable and base64 encodings. [..] For HTML mails, a crude parser is used to render the HTML into text.

Hyperlink that will open document using DAV protocol?

I have a DAV server (Oracle Portal in this case). If I open word and then enter the DAV URL of a document, I'm correctly prompted for username/password and the document is checked out. I can edit it and just click Save to save it back to the server. So far, so good.
What I need is a link on a web page that will open the document for editing in Word. If I just use the same URL as I use in the File Open dialog in Word, I get a read-only copy, and the File Save dialog suggests to save it locally.
Is there a way to open a document for DAV editing directly from a hyperlink?
According to this thread, you should be able to get DAV supported by adding special headers to your response so that word knows that it is editable via DAV.
It seems to be the default behavior of Word to open such links as read-only. However, there seem to be two workarounds. You can either tweak a registry setting or use the SharePoint.OpenDocuments ActiveX control.
See here: http://www.webdavsystem.com/server/documentation/hyperlinked_ms_office_docs
No. The dav protocol uses standard HTTP transactions, and unless the client is aware of the support for DAV, it won't know to use it.
Word is likely not DAV aware, and you're relying on people mounting DAV devices as a mounted network drive.
IE: As far as words concerned, its just like any other URL.
( Unless there is a way to tell word its specifically on a DAVFS system, via a url with a different protocol specifier, for example davfs://www.google.com/ if davfs happened to be a registered protocol that your client recognised, this of course makes too much sense, and for that reason alone, you are unlikely to find it supported in windows )