Flex: Load PDF into Sprite for printing - apache-flex

I have pre-existing PDF files which I would like to send to a PrintJob in Flex 3. I can load the files fine with UrlRequest, but I need to somehow get the data into a Sprite to be included into a PrintJob.
Is there a way to do this, or should I go another route? (I've seen the hidden iFrame example, but I was hoping for a way to do this without JavaScript.)
Thanks

If you're using Aodbe AIR, then you'll be able to load the PDF into an HTML View.
Flex (and The Flash Player) does not have any native support for displaying (or creatging) PDFs, though.
Most people will just pass the generated PDF to the browser and let it handle it. You can do this w/ navigateToURL. The iFrame trick can work, although the actual display of the PDF may depend upon browser settings.
Here is another StackOverflow Post on a similar topic. It links to this site http://www.devaldi.com/?p=212 which provides one alternative.

Related

How to Open PDF in Browser and modify it and save it?

I am thinking about opening a PDF file with some editable fields in the browser , by which i can modify the PDF file / fill information etc and then save that PDF FORM
Please guide me in a right direction ?
I think in your case Rad PDF can work. It is a PDF Viewer and Editor for ASP.NET by which you can open the PDF with editable fields in browser and can even modify the PDF and save it.
Check the link:- https://www.radpdf.com/demo/easy-integration/
and another one is below:-
https://code.msdn.microsoft.com/PDF-Editor-to-Edit-PDF-5fb73b8d
Hope it will work in your case.
Thanks
You cannot. Simple.
PDFs are edited by the native app, in your case may be Chrome, Safari and Internet Explorer. You do not have control on anything that happens when the user edits the PDF in a native app context.
Pdf documents come in many flavors (standards). One of them (FDF) matches your usecase very closely. This particular standard allows you to edit a pdf form, on completion (or some other event) it would send the data back to a server, collect a response, and modify the pdf with the incoming data.
Keep in mind though that this standard is not often used. There may be a good reason for that (not a lot of libraries support it).

Change html in all frames in QWebEngineView

I have a simple browser based on Qt5 QWebEngineView on which user can load different urls. I need to implement "disable sound on videos" feature. One way is to execute JS and set .muted=true for all video elements, but according to [1] runJavaScript can run only in mainFrame, so if page will contain iframe with video tag sound will still play. Another way is to replace html code that comes into QWebEngineView, e.g.
"<video>"->"<video muted>"
But it this way possible to implement? Is there any other ways?
[1] https://wiki.qt.io/QtWebEnginePortingFromQtWebKit

How to edit images using javascript in real time and save the edited image on the server?

Is it possible to edit images using a javascript library and then send the edited image to the server for saving.
Edits will be in real time, means the user can see the edit result in the same time he is editing without the need to refresh the page.
I want a javascript library to do some edits on an image on a webpage 'such as crop, resize, rotate,...' and send send the edited result to the server.
How this can be done or if there any smart work around to something like this.
The libraries mentioned don't seem to be fully cross browser. As far as I know there is no fully cross browser compliant way to edit pixel data on the client.
The current best approach would be to do these manipulations on the server. You can still do this real time using a web service.
As an example see the image editor in TinyMCE which supports crop, rotate, resize, flip, all from the client without a page refresh.
Pixastic is an image manipulation library; once you've modified the image, some sort of post back / upload call from the script will be able to upload the image provided you've implemented the needed functionality to do so.
An incomplete list to be sure, but these are two that come to mind which allow you do a wide variety of editing on the client side and push back to the server.
PIxastic
AIE
And there are numerous less complete image editing tools for simply cropping or adjusting contrast as well.
jcrop is what you are looking for .

Multiple file upload with preview

Is there any good control or plug-in for uploading multiple photos with preview? As far as I understand it is impossible to preview photo on local computer using just JavaScript. So it has to use Flash or Java.
Thanks, also, I use ASP.NET.
Wait, do you mean show it in a browser window before starting the upload? So does the file have a URI? (Hint: file:///c/users/public/somefile.png is a URI) You can always just link it into an image tag on their browser session.
Now, will a browser let you link a file:/// for image? That I've not tried, but you should; at least you'll learn something from it when you do try.
But using this, there's no reason you can't use a lightbox style image viewer with the local URI.
You could also make use of silverlight 4. If you're looking for something already written you might try using the upload control from gallery which much require some hackery or if you have money to burn then telerik have an upload control but I don't believe it supports previews. This http://www.aurigma.com/Products/ImageUploader/ also looks nifty.

Embed a PowerPoint presentation into HTML

Is it possible to embed a PowerPoint presentation (.ppt) into a webpage (.xhtml)?
This will be used on a local intranet where there is a mix of Internet Explorer 6 and Internet Explorer 7 only, so no need to consider other browsers.
I've given up... I guess Flash is the way forward.
Google Docs can serve up PowerPoint (and PDF) documents in it's document viewer. You don't have to sign up for Google Docs, just upload it to your website, and call it from your page:
<iframe src="//docs.google.com/gview?url=https://www.yourwebsite.com/powerpoint.ppt&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>
I got so sick of trying all of the different options to web host a power point that were flaky or required flash so I rolled my own.
My solution uses a very simple javascript function to simply scroll / replace a image tag with GIFs that I saved from the Power Point presentation itself.
In the power point presentation click Save As and select GIF. Pick the quality you want to display the presentation at. Power Point will save one GIF image for each slide and name them Slide1.GIF, Slide2.GIF, etc.....
Create a HTML page and add a image tag to display the Power point GIF images.
<img src="Slide1.GIF" id="mainImage" name="mainImage" width="100%" height="100%" alt="">
Add some first, previous, next and last clickable objects with the onClick action as below:
<img src="/images/first.png" border=0 alt="First">
<img src="/images/left.png" border=0 alt="Back">
<img src="/images/right.png" border=0 alt="Next">
<img src="/images/last.png" border=0 alt="Last">
Finally, add the below javascript function that when called grabs the next Slide.GIF image and displays it to the img tag.
<script type="text/javascript">
//Initilize start value to 1 'For Slide1.GIF'
var currentIndex = 1;
//NOTE: Set this value to the number of slides you have in the presentation.
var maxIndex=12;
function swapImage(imageIndex){
//Check if we are at the last image already, return if we are.
if(imageIndex>maxIndex){
currentIndex=maxIndex;
return;
}
//Check if we are at the first image already, return if we are.
if(imageIndex<1){
currentIndex=1;
return;
}
currentIndex=imageIndex;
//Otherwise update mainImage
document.getElementById("mainImage").src='Slide' + currentIndex + '.GIF';
return;
}
</script>
Make sure the GIFs are reachable from the HTMl page. They are by default expected to be in the same directory but you should be able to see the logic and how to set to a image directory if required
I have training material up for my company that uses this technique at http://www.vanguarddata.com.au so before you spend any time trying it out you are welcome to look at in action.
I hope this helps someone else out there who is having as much headaches with this as I did.....
Id recommend the official View Office documents online
link
for embeding you can simply use
<iframe src='https://view.officeapps.live.com/op/embed.aspx?src={urlencode(site-to-ppt)}' width='962px' height='565px' frameborder='0'></iframe>
DocStoc.com and Scribd.com both work well with Internet Explorer 6 and Internet Explorer 7. They'll show a variety of document types, including PowerPoint files (.ppt). I use these services for my intranet here at work. Of course, just remember to mark your documents as 'private' after you upload them.
besides, if you save ppt as .pps format using microsoft powerpoint, you can use the following code:
<iframe src="file.pps" width="800px" heigt="600px"></iframe>
Another common way to do it is to convert ppt/doc to pdf,
then use swftool(http://www.swftools.org) to convert it to swf
finally, take FlexPaper(http://flexpaper.devaldi.com) as document viewer.
I don't know of a way to embed PowerPoint slides directly into HTML. However, there are a number of solutions online for converting a PPT file into a SWF, which can be embedded into HTML just like any other Flash movie.
Googling for 'ppt to swf' seems to give a lot of hits. Some are free, others aren't. Some handle things like animations, others just do still images. There's got to be one out there that does what you need. :)
You can use Microsoft Office Web Apps to embed PowerPoint and Excel Files. See Say more in your blog with embedded PowerPoint and Excel files.
I ended up going for screenshooting each slide, and using two different tabs to navigate, this was put into an . this gives high-res, but you sacrifice animations and interactivity, the only thing the user can do is read and change slide. heres an example off my website: http://deepschool.jaberwokkee.kodingen.com/~/Miss%20Necchi%27s%20powerpoints/Volume%20of%20prisms%20powerpoint/slide1.htm
Google Docs allows you to upload a PowerPoint document, you can then 'Share' it with everyone then you can 'Publish' it and this will provide code to embed it in your site or you can use a direct link which runs at the full size of the browser window. The conversion is pretty good and scales well because the text is retained rather than converted to an image. The conversion is pretty good and the whole thing is free. Definitely worth a go.
Tried all of the options in this stack and couldn't reach something that loaded swiftly, used PPT. file directly, and scaled easily. Saved out my ppt. as .gif and opted for "Infinite Carousel" (javascript) that I can drop images into easily. Has left right controls, play option, all the same stuff you find in ppt. presenter mode...
http://www.catchmyfame.com/2009/12/30/huge-updates-to-jquery-infinite-carousel-version-2-released/
The 'actual answer' is that you cannot do it directly. You have to convert your PowerPoint presentation to something that the browser can process. You can save each page of the PowerPoint presentation as a JPEG image and then display as a series of images. You can save the PowerPoint presentation as HTML. Both of these solutions will render only static pages, without any of the animations of PowerPoint. You can use a tool to convert your PowerPoint presentation to Flash (.swf) and embed it that way. This will preserve any animations and presumably allow you to do an automatic slideshow without the need for writing special code to change the images.
Power point supports converting to mp4 which can be posted using a html5 video tag.
Save As > MPEG-4 Video (*.mp4)
<video controls autoplay reload="none" style="width:1000px;">
<source src="my_power_point.mp4" type="video/mp4" />
</video>
As an alternate solution, you can convert PPT/PPTX to JPG/SVG images and display them with revealjs. See example code here.
PS. I am working as SW developer at Aspose.
The first few results on Google all sound like good options:
http://www.pptfaq.com/FAQ00708.htm
http://www.webdeveloper.com/forum/showthread.php?t=86212
Some Flash tool that can convert the PowerPoint file to Flash could be helpful. Slide share is also helpful. For me, I will take something like PPT2Flash Pro or things like that.
Well, I think you get to convert the powerpoint to flash first. PowerPoint is not a sharable format on Internet. Some tool like PowerPoint to Flash could be helpful for you.
Try PowerPoint ActiveX 2.4. This is an ActiveX component that embeds PowerPoint into an OCX.
Since you are using just Internet Explorer 6 and Internet Explorer 7 you can embed this component into the HTML.
As a side note: If your intranet users also have access to the Internet, you can use the SlideShare widget to embed your PowerPoint presentations in your website.
(Remember to mark your presentation as private!)
I spent a while looking into this and pretty much all of the freeware and shareware on the web sucked. This included software to directly convert the .ppt file to Flash or some sort of video format and also software to record your desktop screen. Software was clunky, and the quality was poor.
The solution we eventually came up with is a little bit manual, but it gave by far the best quality results:
Export the .ppt file into some sort of image format (.bmp, .jpeg, .png, .tif) - it writes out one file per slide
Import all the slide image files into Google Picasa and use them to create a video. You can add in some nice simple transitions (it hasn't got some of the horrific .ppt one's, but who cares) and it dumps out a WMV file of your specified resolution.
Saving out as .wmv isn't perfect, but I'm sure it's probably quite straightforward to convert that to some other format or Flash. We were looking to get them up on YouTube and this did the trick.
An easy (and free) way is to download OpenOffice and use Impress to open the PowerPoint presentation. Then export into a separate folder as HTML. Your presentation will consist of separate HTML files and images for each PowerPoint slide. Link to the title page, and you're done.
I was looking for a solution for similar problem.
I looked into http://phppowerpoint.codeplex.com/
But they have no better documentation, and even no demo page I could see over there and it was seemingly difficult.
What I came up with is: SkyDrive by Microsoft. https://skydrive.live.com
All you need is an account with them and upload your PPT and embed them straightaway. PPT player is quite clean to use and I like it.
I've noticed people recommending some PPT-to-Flash solutions, but Flash doesn't work on mobile devices. There's a hosting service called iSpring Cloud that automatically converts your PPT to combined Flash+HTML5 format and lets you generate an embed code for your website or blog. Full instructions can be found on their website.
Another option is to use Apple Keynote on a Mac (Libre Office couldn't event open a pptx I had) to save the presentation to HTML5. It does a pretty good job to produce exactly what it displays in keynote, e.g. it includes animations and video. Compatibility of keynote to powerpoint has it's limits though (independent of the export).

Resources