Show preview of a file in html in angular 5 - html

I need to preview files of the format pdf or doc. I looked for solutions which included using with the googledocsviewer but the file that I want to preview is present right in the application as a File object. Itried using the with the fileReader.readasDataUrl function and was able to preview txt and image format files, but I need to work with the other formats too.I came across a npm package called file preview https://www.npmjs.com/package/filepreview but I could not understand how to use it. Any suggestions are appreciated.

Related

Saving rmarkdown html files to local drive from shinyapps.io

I have a shiny app which I have published on shinyapps.io.
I am trying to save(download) html files that I create using rmarkdown to a local drive. I can download pdf, jpeg or png formats. but the reason to save html version is to keep the interactive plots that I have created using plotly and ggplot where I can hover my mouse over data and see values.
After a lot of research, I found out a way to save (upload) the html files to my own dropbox using drop_upload function. But it's very inconvenient and not accessible to anyone except me.
So I was wondering if someone could help me with a way to save/download rmarkdown html files to a local drive from shinyapps.io?

How is Chrome SingleFile format achieved?

Chrome has an extension called SingleFile. It basically saves a web page in a one file *.htm page that is a clone of the original website. I have seen something like this done with Mozilla MAFF format. The MAFF format saves the file in *.maf, and is you want to see contents (html, css, images etc.) you can change the format to *.zip. Then you can unzip it. With the SingleFile (Chrome) you can’t unzip the file by changing extension. Does anybody know how this is achieved? Is this a known thing that *.htm can offer? Thanks
The MAFF format saves the file in *.maf, and is you want to see
contents (html, css, images etc.) you can change the format to *.zip.
Then you can unzip it.
I'm assuming that you're really asking just how the image files are stored in .htm since html and css can easily be stored as text in htm.
It uses uuencode/uudecode to embed image files in the .htm file. More on that here:
https://en.wikipedia.org/wiki/Uuencoding
This is why changing the extension to .zip won't turn the file into a zip package that you can unzip.
Illustrative side-by-side screenshots of external vs. embedded image.
I found this article may help: http://www.techgainer.com/enable-single-file-mhtml-support-chrome/
On Chrome address bar, type chrome://flags, then hit enter. Now use Ctrl+F (Command+F on Mac) bring search bar and search for mhtml as I did below. Once you find the option, click on Enable link.

Quickly converting Word Doc into HTML

I am trying to convert a word document into html. I used an online converter http://word2cleanhtml.com/ but it does not keep the pictures I have in my file. From the html I will be making a nook and kindle ebook. Does anyone have a tool or suggestion for this project?
Using save as html in word doesn't keep images either.
Download the KindlePreviewer: http://www.amazon.com/gp/feature.html/?docId=1000765261
Then, save your file as HTML. Images will not be part of the html file, instead they are stored in a separate folder.
Open the resulting html file into the KindlePreviewer, it will find the images in the images folder and add them to your book.

permanent link to a single file in a folder that can be replaced and renamed

I tried to think about it but I can't find good answers for my website. Let say I have a folder (online) with one PDF file in it. I want to have a link to it, no problem.
Problem :
Now let say somebody else is going to change that pdf file with another one. The first pdf is deleted and the new pdf file has a different name... so my html link is broken.
Question :
How can i create a link that will open the single pdf file in that folder (no matter if the pdf file is replaced and renamed later) ?
I'm open to any solution even javascript or using google drive or don't know what other method. The best would be a link that works like http://mywebsite.com/folder/*.pdf or something like that.
THANK YOU & good luck to find the answer:)
Use a server-side redirect. This wiki page explains this and gives snippets for PHP, ASP.NET and JSP. Where you redirect to is an outcome of enumerating the PDF files in your folder.
The page that executes this code is the published URL to your PDF. E.g. http://mywebsite.com/folder/pdf.aspx.

Strange problem while compiling CHM file

I had to write some documentation. I wrote each page in MS Word and then save each *.docx as htm file. I'm using "HTML Help Workshop" (from microsoft) to compile a chm file.
I was able to sucessfully create a chm file but the problem is that not all images in chm file are displayed. I tried decompiling the *.chm file into another folder and opened each .htm file in web browser. All images are correctly displayed.
Then why aren't they displayed in chm file. Strangely, only some of them aren't displayed. I checked if image format is causing problem, but all images are of same format. I checked if file naming is a problem, but all images are named like image[001-100].jpg in their corresponding folders.
Any idea about whats going wrong?
HTML Help Workshop (HHW) is known to have problems with the HTML generated by Word (or better put: Word generates terrible HTML). Some versions put VML coding around the IMG tags that HHW cannot handle.
Possible solutions:
In Word: Deselect the option 'Rely on VML for displaying graphics in browsers' (Tools > Options > General > Web Options)
In Word: Save as 'filtered HTML'.
In HHW: Manually add the images to the project's [FILES] section.
Let me know if any of this helps.
More information can be found in the HTML Help 1.X FAQ