Universal document viewer in browser - without server side conversion - javascript

I want to embed a document viewer in my webpage, which should support all microsoft office formats, pdf, images, etc.
I don't want file conversion to happen on server side and then send it back to html viewer.
Is there a way to instantly view the file with original format directly in browser? Or is there a way to convert files to browser supported formats on fly in frontend (using Javascript) and show it instantly? Is there any product that does it now?

A quick google search shows there are a few javascript libraries out there that can deal with MS Office docs, e.g. DOCX.js, although they may not cover all your use cases.

Related

Google Drive API -- get direct video download for different formats

It's known that by simply retrieving a Google API key that one can download any file (of any size) directly (and even embed a video to a website etc...), the problem is: when using the standard Google API URL in the form:
https://www.googleapis.com/drive/v3/files/### fileId ###?alt=media&key=### API key ### inserting the file ID and API key in place.
This works if I want to embed, lets say, a video already in .mp4 format, but lets say if I want to embed a .mpg video to an HTMLwebsite: by default, the .mpg format is not embeddable, but its known that Google Drive automatically converts all of its video files into various formats that cna be played in the browser, so:
How can I access the different video formats of a video in Google Drive? Preferably, I'm looking for a programmatic way to get it (like Node.js or PHP).
You need to integrate your Google Drive with Cloud Convert (this is a manual job)
https://zapier.com/apps/cloudconvert/integrations/google-drive
OR
You can make use of Integromat to do it for you (it comes with various automation scripts)
https://www.integromat.com/en/integrations/cloudconvert/google-drive
Once done - you can consume Cloud Convert's APIs using nodejs, php, python, angular etc.
https://cloudconvert.com/api/v1/
(The free plan supports max 1GB file conversion per session)
Most Important - The API has Google Cloud Integration
https://cloudconvert.com/api/v1/googlecloud
Converters:
Cloud Convert for php
https://github.com/cloudconvert/cloudconvert-php
Cloud Convert for nodejs
https://github.com/cloudconvert/cloudconvert-node
Hope that's a good starting point for you..
I think this is a classic x\y problem. https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem You want access to auto converted, embeddable videos AND you want it using a specific tool -- but the tool isn't the right tool because it doesn't do that.
So, forget about the tool, and focus on the problem: there are two other Google services that auto convert video and allow embedding: YouTube, and Google photos.
Photos is interesting because if you can choose "high quality" or original storage, where high quality converts almost anything to an embeddable, web friendly format. YouTube, of course, also makes it easy to convert and embed.
On the photos side, downloading is natively available, and on the YouTube side, there are numerous sites that will provide a download link to your video in a variety of formats.
So, if you really don't want to use ffmpeg* or other standard conversion tools, I'd look into the APIs of the other two mentioned services.
*Unless you are doing a large volume of conversions, you could do this via a free tier node\firebase project.

ways to open large-sized pdf without downloading (using open on javascript)

Good day,
I have a system that renders large amount of data through pdf ( 30mb + ). Now I want the user to view pdf first so he can either download it or just print it right away. as of the moment I am forcing the user to download the file since open( 'datauri here' ) wont work with larger files.. the problem with downloading is that files are multiplying and consumes space over time and also its not necessary for me to download all files that that they want to print right away.
I need a functionality that is similar to chrome's preview when using windows.print
can you please suggest any ideas or other things to do this?
I am currently using javascript library to create pdf (pdfmake). I am also using chrome as my main browser
You would have to make sure that the PDF is optimized for fast web view, and that your server is using the byteserving protocol for serving the file.
If that is the case, a useful PDF viewer (such as the web browser component provided by Acrobat/Reader) understands this protocol and requests (after the first page plus overhead of the PDF) only the data for the pages which are to be displayed.
A quick search did, however, not reveal whether the Chrome PDF viewing component is smart enough to understand the byteserving protocol.

How to convert a single page webapp into an offline format

I created a single page application using AngularJS. Is there a way to automatically convert it to an offline format like pdf or chm? The website contains multimedia content such as webms and ideally those should be preserved. Although having a single file (like a chm), would be preferable it would be sufficient to be able to view the contents of the website locally without having to use a web server.
Solutions like saving webpage as MHTML, HTML Help Workshop and WEB to CHM don't generate useful output. Allowing users to download the website and open the files directly doesn't work because of this error.

Automate conversion of Html Page to MS Word Document, save, then load on client machine

I’ve been assigned a task, one which I’ve never done before, to generate a resume using data from our online job application web site, which a user client can display as a web page and then save to their local system in one of two formats, MS Word or PDF. The resume web page is a fixed layout which contains the clients contact information, education, work history and other relevant stuff. I already have a JavaScript plug-in for generating a PDF file on the client side, I’m now looking for a solution to create the MS word document on the client side and save either one to the client file system. The resume page is a single page with a fixed layout, customized only by data stored in the system for the user.
To see other details on the web applications follow this link: Express Professionals
Here are some of the more important requirements I have to take into consideration:
We are a Microsoft shop and use 3rd party solutions which adhere to those standards.
Windows Server 2012 R2 and IIS 8.5 - Forms Authentication - SQL Server 2012 backend
MVC4 internet application with Razor web pages
Bootstrap 3.0, JQuery 1.11, JQuery UI 1.8.24, OData 5.2
The application must be responsive from desktop to hand held devices
Target client browsers are IE 9.0 and up, Chrome 42.0 and up, Safari for MAC 8.0.6 and up - No commercial or 3rd party paid libraries or paid plug-ins. If I can’t find a free solution; I need to invent my own
No popup windows or other web pages to collect user input on where to store the finished document on the client machine
A single button click, one for PDF and one for MS Word, will take the Html resume page displayed, convert it, then save it, to the client’s machine in the chosen format, then launch the client app and load the document
The user can then decided where they want to save the file
If the resume page can’t be converted to the native client application file format, it can be saved to the file system in the next best compatible file format which the client application can read
Saving the converted file is OK, but it is preferred to launch the client application and load the converted file on the client machine as part of a complete process
SharePoint services or SharePoint Server are not available for use in solving this problem.
As I stated, I have found a JavaScript plug-in for creating the PDF, but for the MS Word document, I have only found bits and pieces which are unrelated, nothing in part or as a whole, which can be cobbled together into a working solution using our development stack.
Any references or links that match the requirements or suggestions which get me closer to an end solution are welcomed.
Thanks in advance….
After evaluating several open source solutions, the final choice was OpenXML for MS Word conversions. An MS Word template was created with the basic framework and then the OpenXML utility was used to create the class that builds the word doc. That class was customized to allow a data source to be added to the constructors and data added to tables in the document. DevExpress was used for the PDF conversions, since I don't know this tool the last part was handed off to another developer.

Save HTML5 page as PDF

On click of a button, without doing a round trip to the server, can we save a HTML5 page on clients machine as PDF.
Check out PDF.js. This lib can create pdf in the browser (or serverside on node.js).
Using chrome you can print the page to a pdf file.
You need something like this, maybe server-side you can start a browser and print the content to a pdf file and send this to the client.
Disclaimer: i work for ByteScout
If you have simple HTML formatting and want to generate PDF on client side and if you have non-commercial project, check BytescoutPDF.js - it supports simple HTML formatting for text (font name, size, color) plus simple drawings and images, should be enough for simple reports

Categories