Behaviour of RTF in browsers - browser

I am receiving text from a backend and displaying it on my web page. The text could be in one of three formats: plain text, HTML, and RTF. I am sure the first two will render without any problems, or loss of formatting.
Will RTF be interpreted and rendered properly by web browsers?

No, RTF will not render at all.

The actual browser itself will not render the RTF directly because a browser renders html.
However, the browser will receive the RTF sent from the server and will launch whatever default RTF editor is in place on the end users system. By default on windows, this is typically wordPad.
However if an end user has Microsoft Word in place or another RTF editor this could be the editor that gets launched. The end user will then be able to read the RTF in this editor.
On my system pushing RTF to a client will launch Word and give me the option to either Open or Save the RTF file immediately.
I hope this helps out.

Related

Convert HTML to PDF in node Js and open in new tab in browser without saving it

I am getting suggestion to use html-pdf npm package but it downloads the converted pdf file and I want to download only when clicked on download pdf button else I just want to open it in new tab or window without downloading. Any suggestions please? Thanks in advance.
PDF is not viewable in a clients browser like an image or text.
It is for all intents a bitstream DOCUMENT file, like say a DocX so it needs Binary applications to view it, and some powerhouse browsers include a built in PDF.js EXTENSION/ Foxit/Skia application/pdf PLUGIN.
So just like viewing a DocX or Video you need to download PDF to the device and view in a binary.pdf AEIOU viewport (Ahref/Embed/Iframe/Object/cUrl)
So you cannot just dictate "open a tab" or "open a window" to view PDF until after the download. Opening a window or target a _blank tab is anti-social and usually blocked by virus security. Likewise binary in Iframe will often be blocked.
So on a positive note how to offer a PDF (href and iframe are the 2 recommended) one way is to offer a thumbnail of the expected download. Thus you can use pictures to overlay a download <a href="file.Pdf" download> <img src=.... something like this:-
Or HOPE a user is using out of the box view InlineFrames even if their pop-up blocker stops new tabs and new windows.
Or you could use a Page to PDF print method, but it will offer to save the Download or Printout.

I want to display a word and excel in web browser. PDF is working but word and excel are not

Can anyone explain me how to display a word and excel in browser.
I had set content type as application/vnd.ms-excel for excel but still not working.
PDF is working fine.
You can save your word and excel files as webpage, just select that option webpage in the save as menu.
A browser is only able to display files from Microsoft Office when the application is installed. For some versions of Microsoft Office viewer applications exist.
But displaying Word and Excel files in modern browsers (especially Internet Explorer) has the drawback that the browser does not display the file in the original window but rather opens a new window.
This in turn is good because current MS Office versions hide some functions and windows when a file is not opened in the application but in the browser. This sometimes makes it impossible to uses formulas in Excel or reopen a file that was opened in readonly mode.
In short: if you want a good experience for your users either accept (if they have it installed) that a second window is opened for the Word and Excel file you present or (if possible) convert it into a html equivalent (which will have a different look) or a pdf (which then automatically is readonly and kind of protected)

Disable copy function in PDFTRON for Android

Is it possible to disable the copy option of the lib when selecting a text in the PDF using the PDFTron lib for Android?
I tried to search for the string, but also have not found it.
If you are using one of the mobile SDK's, or using our PDFViewWPF control for .Net 4+, then this is possible by modifying the tools code that is provided. There will one or two text selection tools, for which you can just comment out. Plus you would want to disable ctrl-c, and right click and select copy abilities. Exact code changes depends on platform. If you are using our older C++ PDFViewCtrl class this is harder to do, but I suspect you are not on this anyway.
Be aware though, there is no real way to prevent a user from extracting text from a PDF, since they can always open it in another PDF viewer and do it there.
See this form post for more info, including how to scramble the unicode values of text.
https://groups.google.com/forum/#!searchin/pdfnet-sdk/disable$20text/pdfnet-sdk/luWQmyhRDTw/z7UIGuu9uYkJ
Note, you will probably be interested in the PDFTron WebViewer technology, which provides much greater control over content. In particular, the original PDF file is never exposed to anyone for download. You can also encrypt the XOD file, so it cannot be opened in an XPS viewer, and you have full control over the UI, including disabling text search/extraction.
https://www.pdftron.com/webviewer/showcase/
https://www.pdftron.com/webviewer/index.html

Are there libraries or existing methods to get a webpage's layout from the html and css?

From the html and css files of a webpage, is there a way to write a program that can guess how the page might be visually structured?
can try saving to website by right click and save webpage or save as, then open up in a program like dreamweaver.

showing content on the blank screen after downloading a file

I've observed that under certain circumstances, a web browser will navigate to a blank page and then prompt the user to download a file. In my current situation, it's navigating to a URL that generates an Excel file. The download of the file works perfectly, but the user is now stranded on a blank page. There are two things I would like to figure out:
What causes the blank page to be displayed? It doesn't happen all the time. Is it the difference between using GET and POST (I can't recall seeing a hyperlink do it, but forms usually do)? Is it something to do with the Content-Disposition? In my current case, I've set the Content-Disposition to be "inline" because I want it to display in the browser in IE. Firefox (and presumably others) will of course prompt to download because they can't display it inline. It is the situation where the user chooses to save it that the blank screen results.
If it is possible, I'd like to display some content on this blank screen to provide the user with a message like "your file has been generated, click here to go back to the main screen" or somesuch. Is there a way I can do that?
I'm using an IIS extension written in C++, so solutions for ASP, PHP, etc will not be helpful unless they're generally applicable (though I wouldn't mind learning about solutions in those languages!). Thanks.
I think you practically answered your own question: setting content-disposition to inline does exactly that. One solution that comes to mind is browser detection: use inline disposition if the browser is IE, attachment otherwise.
BTW, as a user, I prefer sites which offer me a choice whether I want to download the file or view it inside the browser (when, for example, accessing a PDF file). In this case, I would consider having a link/button for downloading the file, and adding a second link/button for IE browsers to view it.

Resources