I want to convert ppt to images on the client machine and zip all the images and send it to the server.
I've read on many forums and found that it's not possible to convert ppt to images on the server where Office is not installed.
So, I had this thought if the conversion could be done in the client browser and sent to the server, using JQuery or any other client side technology.
Any example would be appreciated.
Thanks
Aspose.Slides for .NET allows you to convert the PPT slides to images on the server, without the need for Microsoft Office installed. You might want to give it a try, if that helps. It is a standard .NET assembly which can be used on the server, in your application. The conversion is simple, here is the sample code:
//Instantiate a Presentation object that represents a PPT file
Presentation pres = new Presentation("demo.ppt");
//Accessing a slide using its slide position
Slide slide = pres.GetSlideByPosition(1);
//Getting the thumbnail image of the slide of a specified size
Image image = slide.GetThumbnail(new Size(290, 230));
//Saving the thumbnail image in jpeg format
image.Save("C:\\thumbnail.jpg", ImageFormat.Jpeg);
Disclosure: I work as developer evangelist at Aspose.
Javascript generally doesn't have the capacity to modify files on the client machine and can't automate a file upload. You may be able to get the desired effect with a Java applet, I'm not sure. The alternative is to provide a stand-alone application that will do the conversion and zipping, then have the user upload the file manually.
Edit: As an afterthought, any reason you can't simply install Office on your server and do it there?
You have no control over the client machine once your html has been rendered and so you cannot achieve this. The user would have to do it manually.
Related
I'm working on a twitch.tv overlay that generates a word cloud live on-screen based on what I've been saying on stream.
I'm currently using Visual Studio Code with Live Server to display a file via an HTML file alongside a Python script that generates a new png file of the word cloud, using the same filename.
Using the Live Server extension is nice, but I can't help but feel like it's sort of a dirty solution. Any ideas on something more formal?
NodeJs and Express could be a good option. The server could be written in Javascript and you could use a sub-process to call your python script on an interval.
I have a requirement where I want to show the file preview to the users.
There are various file types which are supported like; .pdf, .xlsx, .doc, .rar, .jpeg, .png and many more.
When user clicks on the preview it should open the file in popup where preview of the file is shown to him. User can Zoom-in, Zoom-out, Download the file. Just as you can see into gmail for attachment preview.
Please, can anyone guide me to any relevant library or helpful resource for the same.
Thanks in advance
There are two main ways you can do this.
1) Server-side: Render previews once server-side (on file upload) into jpg/png images, and store the previews on the server. This is the easiest to implement on the client side, but requires extra storage on the server.
2) Client-side: Render the previews 'live' with javascript in browser, this reduces the amount the server has to do/store, but does require the client to fully download the file in-memory before it can render the preview, which for large files could be an issue. Also, you would need javascript libraries included for likely each individual file type, since most libraries will target one specific file format.
Server-Side is probably the recommended way to go. What are you using for your web server?
You are looking at creating document viewer.
Belive me its big work as browser does not understand these formats. Browser can render images directly on canvas but it does not know how to render the other files. So, any file other than image formats, one need to save them temporarily on server and then stream on the browser and show them using the respective file viewer.
You can convert doc and xlsx files to pdf and show these files using pdf viewer (http://ngmodules.org/modules/ng-pdfviewer). There are plenty of document converters available on internet (however you will need to check the licensing terms as most of them are GPL licensed, hense can not be used in commercial projects).
If you want to save this work then go for third party server those take all paint to convert documents in html5 such as https://crocodoc.com/why-crocodoc/
You can also try using google doc viewer google doc veiwer
This question is fairly broad. I'm not going through all the steps of how to implement an attachment viewer directive, but here are some pointers you might find useful.
To allow the user to download the file, you simply put a download link somewhere. If you are hosting the attachment on Amazon S3, Google Cloud Storage or some other cloud storage service, check their documentation. If you're downloading the files from your own server, make sure to set the Content-Disposition HTTP response header to attachment; filename="ORIGINAL_FILENAME", where ORIGINAL_FILENAME is the file name you want to user to see in the save dialog that appears when they click the download link.
Now on to the viewer.
For PDF files, I'd use pdfJS. There's an angular directive for it here.
You could look at something like CloudConvert for other files, to convert ehm to a PDF, and then displaying them in pdfJS, but then you probably want to store the PDF on your server as well, in addition to the original files, which requires extra storage. You might also be able to use the Google Docs viewer, or Office 365 viewer, as described in this answer.
Is it possible to send a images to the Pebble watch using PebbleKit Javascript sendAppMessage.
My idea is to load an image from the web and send it to the watch and display them there. If an image is not possible directly then I was thinking of drawing the image to a canvas and trying to get bitmap data from the canvas to send to the watch.
Is any of this possible now or am I thinking of things that have not been done yet. If possible how? If not done yet how might you do it?
Looking to brainstorm and share possible code ideas.
I should also mention that I do not want to use an iOS or Android app, only the PebbleKit JS.
There is a complete example of an app that uses JavaScript to download images in the pebble-hacks Github repository. This github projects hosts different non-official yet written by team pebble.
The one you are looking for is pebble-faces. The image download part is built in a separate source file to be easily re-used in your own project.
I also added a PHP port for the Python script here
https://github.com/logbon72/pebblebitmap
It might come in handy if your run PHP applications that need to do conversion on the fly.
The upload part is OK!
My problem is open that PPT file and show like a presentation.
I have no idea how can I do that. My server side language is PHP.
Thanks
Your client needs to have MS-Powerpoint, or at least MS Powerpoint Viewer, installed
Your browser needs to be capable of ActiveX
Ideally, you can also configure your server to send the file as MIME-type:
"application/vnd.ms-powerpoint":
Is it possible to dynamically create and modify images on a per pixel level in JavaScript (on client side)? Or has this to be done with server based languaged, such as PHP?
My use case is as follows:
The user opens webpage and loads locally stored image
A preview of the image is displayed
The user can modify the image with a set of sliders (pixel level operations)
In the end he can download the image to his local HDD
When searching in the web I just found posts about using IE's filtering method, but didn't find anything about image editing functions in JavaScript.
Some browsers support the canvas:
http://developer.mozilla.org/En/Drawing_Graphics_with_Canvas
This has to be done on the server side. One thing you might look at doing is allowing all the editing to go on client side, and then in the end POST the final image (via AJAX) to the server to allow it to return it to you as the correct MIME type, and correctly packed.
You may want to check out Processing.js. John Resig of jQuery fame wrote it. It supports pixel processing, unfortunately only Firefox 3 can handle it sufficiently.
Also look at data URIs (though IE versions below 8 don't support them, unfortunately!)
You can imagine a set of JS tools that will allow the user to define what kind of transformation he wants to do, but the final work of transformation MUST be done on a server side. JS on the client side is unable to create a file, for security reason.
Try Allicorn's Image Retargetter - it sounds like that's what you're looking for.
Local image manipulation in JavaScript should be possible - have a look at Defender of the Favicon. ;-) The question is how to get the original image from the file system into your page (I don't know of any other way than doing a HTTP upload to the server first).