I want to show all kinds of document like doc,pdf,excel and also images like png or jpeg in popup using Angular js.
I found one solution in java script http://www.aspsnippets.com/demos/1261/ which does same but it not supports excel and doc files.
Is there any relevant way for angular js to do same for all kind images and files?
Related
I got a somewhat complex page I need to output to PDF format without forcing the user to use a print preview type screen to "Save as PDF". It's a Laravel web app that has a dedicated page formatted to be printed, but I need to generate a PDF without having to show the page. It uses bootstrap, css, a highcharts.js chart and a react component (already bundled).
Does anyone know of a way to turn this into a wysiwyg type PDF? I think I mainly need something that can take html, css, and js and be able to generate a PDF out of it but I haven't found anything.
I am creating a JavaScript with PHP Backend Media Manger Library.
Similar to WordPress media manger however there will be about 20 module/plugins for creating/adding new Media.
For example some of the modules:
Extract Frames from an Animated GIF image and upload any of the Frames as a new Image in your media library.
Scrape a webpage for images and upload any of the images to your media library.\
Canvas based Image annotation editor
Markdown File creator and reader
Create animated GIF images using multiple images.
CSS Sprite Image Generator
QRCode Generator
PDF File Viewer
PSD File Viewer
Upload from URL
Drag & Drop Uploader
Paste File Uploader
Upload From Base64 String
...and several more....
The Problem
Now obviously several of these modules will rely on using existing libraries.
In a users application where they are using my Media Manger library, I don't want to bog down the users computer by loading tons of 3rd party JS libraries that all the modules rely on all at once.
How to fix?
Is there a way to load and un-load libraries as they are needed?
My media manger lib will open up in an app as a popup modal. If I was to open the media manger modal as an Iframe, when the modal is closed I could remove the Iframe from the DOM, would this free up all the resources that alll the JS libraries previously loaded had consumed in the browser?
if you do something like delete window.myLibrary then it will delete any code or data present under the myLibrary object (because functions are objects too!), which will be garbage collected and removed. This of course assumes that the libraries you want to un-load are accessible in this way.
Is there a way to implement functionality so that a user can Right click a subsection of an Html page (say a DIV or other container element) so that that part can be saved as an image/pdf (using javascript)?
Alternatively (ideally) can this be done on the server side in ASP.NET?
The use case for this is the following:
I have some complex web pages generated in asp.NET and using the javscript Flot library for the graphs. I would like to reuse part of the html page to generate PDF reports or at least image snapshots which can easily be inserted into reports. I have looked around and it seems there is a tool wkhmltopdf which converts the entire page to PDF, however there are 2 issues:
This tool needs to be run separately, which is not friendly for end users
The tool extracts everything on the page, e.g. menus headers , footers etc.
For the second problem I could generate web pages without the headers/footers and menus, and then use the tool, but this does not solve problem 1. Ideally I would like to generate the report weekly and automatically so the user only needs to download it.
For this purpose what is really needed is some way to store as pdf or image a DIV (or other element) referenced by id. This way I would not need to write separate code to generate the reports. I realize there will be a loss of quality converting html to PDF, but for our purposes, this is not that important.
IECapt# is a new and experimental version of IECapt written in C# to render a web page into a BMP, JPEG or PNG image file.
see http://iecapt.sourceforge.net/
You will have to make some calculations, if you want to crop the captured image to your requirements, or give the tool the html u actually want as an image,instead of the whole page.
Hope this helps.
In case this can help others, I finally settled for the iTextSharp library which is very powerful and also handles svg. It does not do the general html5 to pdf dump but with a bit of code I can do most of what I need.
main website is:
http://itextpdf.com/
download:
http://sourceforge.net/projects/itextsharp/
Currently I am using Monocle javascript library in my project. The monocle library will load the HTML files in iframes. It uses the device width and height to crop the HTML contents and create pages based on these measurements.
I need to disable this property. I would like to display a single HTML file in a single iframe . That is, it should be the same as it was in the epub file. Any help is highly appreciated. Thanks in advance.
you could use http://sourceforge.net/projects/oplsepublibrary/ php epub reader to write the content of epub to a page
I'm looking to add a degree of interactivity to a set of PDF files that I have, and would like to embed a PDF document in a webpage, and then overlay touch targets to I can make a popop over them.
What would be the best way to make this happen? I briefly looked into Mozilla's pdf.js, but thats more focused on being a full on PDF reader, and has sluggish performance on tablets.
Are there any reliable PDF to HTML libraries/converters that could help me out? The PDF's are fairly basic. More or less just a bunch of images (which are individually selectable in the PDF) in a grid.
At the moment I am opening the PDF in Photoshop, slicing it up, and then exporting it as an HTML table, but I would love something a bit easier to do
I don't see a way around a server-side solution. Here is how I would do it in PHP using ImageMagick:
<?php
$someFile = $_GET['pdf'];
try
{
// Saving every page of a PDF separately as a JPG thumbnail
$images = new Imagick($someFile);
foreach($images as $i=>$image) {
$desiredWidth = 1024;
$image->thumbnailImage($desiredWidth,0);
// Save the file to disk
//$image->writeImage("page".$i.".jpg");
// Or display it from this script:
header('Content-Type: image/jpg');
echo $image;
}
$images->clear();
}
catch(Exception $e)
{
echo $e->getMessage();
}
?>
If your PDF is a single page then that script will just create a single file or if you echo the $image then it will just display that page as a JPG (or PNG or whatever you want). Then you can mark up your HTML around it as needed by including the script as an IMG:
<img src="myscript.php?pdf=somefile.pdf"/>
Now you can have whatever HTML you want over and around the PDF as an image.
I've implemented a commercial solution called PDFWebViewer.NET to view PDFs in the browser a couple of years ago. It uses server side image rendering (.NET) and nothing but HTML and javascript client side.
I think that's as close as you can get to viewing PDF in the browser without any plugins. Since it's all HTML you can overlay pages with divs and hook up actions to that using javascript. In fact, that's how the product renders out links in the PDF documents.
This works really well because by using relative positioning you can make sure the links stay in the right place while panning the document.
The project was recently open sourced but still relies on commercial components. It should not be a lot of work to replace that with open source PDF components.
The project is hosted on codeplex. PDFWebViewer 1 is the first generation, WebViewer 2 is the latest version.
I would advice you to use wkhtmltopdf. It allow you to work bassically with any web content whitch is on the fly converted to pdf format by taking a "snapshot of screen" (simple explanation). For example you can write your own html template just like you would on any website and than populate it with custom data. You can use it generate for example an invoice. Im using it for couple months now and without any single problem.
Its simple shell utility to convert html to pdf using the webkit rendering engine, and qt. And of cource its open source!
Example:
wkhtmltopdf www.myhomepage.com myhomepage.pdf