I'm trying to allow the user to view a PDF from a webpage, but disable them to download or print said PDF. I keep running into problems with flash or chromes built in PDF viewer. I've tried Iframe, normal embed, PDF security, adobeJS or w/e it's called but no luck.
Anybody have a universal suggestion on how I can get this to work?
1a. You can not send content to a user that they won't be able to print, or save... The closest you can come, would be to show the equivalent content in Flash, and then they can only print the "visible" portion in the flash viewer.
1b. If it goes over the wire, it can be captured.
What are you using to generate the PDFs? You should be able to do a "write-only" PDF, and YMMV even on that.
After 8+ hours of trying many different approaches to the problem we ended up going with a paid option of Scribd which works in all browsers and looks decent enough for us to use. That is our solution.
Related
I noticed today that the PDF viewer within Microsoft's Edge browser is not allowing iTextSharp's PdfAction(PdfAction.PRINTDIALOG) command to work. I create my PDFs in code and add this action call to the PDF so the print dialog window will appear after opening the PDF. It works fine in Adobe Acrobat, IE & Chrome. Here is an example of the PDF I created which you can open to test the various PDF viewers:
PDF Example
Let me know if anyone else has experienced this issue and if there is any way around it. I'd much prefer not to have to move away from iTextSharp's library just to resolve this.
PdfAction.PRINTDIALOG is a JavaScript action and apparently Edge doesn't support it and/or general JS commands. (I haven't confirmed the lack of JS support yet bu I'm seeing rumblings about it.) If you look at the source you'll see that iText is just injecting the simplest of JS code possible into the document's open action:
this.print(true);
So this isn't a problem with iText in any way, this is just a limitation of Microsoft's Edge PDF renderer. Switching to another PDF library wouldn't solve this problem, either.
(Go Jacks!)
I got an AJAX function that loads a png from a canvas graph element and does (per user choice) open the image in a new browser window or force a download.
While the first works without a problem, I got a problem with adding the file extension to the download. Currently I simply get none, using the following HttpHeaders: image/octet-stream, application/download(force-download, x-download)
Gladly some SO user put a JsFiddle together. 1)
Question: How could I go and append a file extension (.png/.jpeg) to the forced download as seen in the JsFiddle example?
1) Sry, but I donĀ“t know the User name anymore.
Unfortunately, with data uris, it is not possible to supply filenames. You should probably look at the HTML5 BlobBuilder API - http://blogs.msdn.com/b/ie/archive/2012/01/27/creating-files-through-blobbuilder.aspx
Even with BlobBuilder, I've found that only Chrome acknowledges the filenames you supply, not Firefox.
I am somewhat familiar with HTML and Javascript (I have had a few classes covering these in college and dabbled a little on my own). What I would like to do is create a desktop wallpaper on my Windows 7 x64 machine that uses HTML (or whatever I need to use) that runs only on my machine and allows me to use images as links to a few websites(have that working) and shortcuts to run applications that are on my machine. This is the part I am having problems with. I tried using an anchor tag and just placing the file path of the executable but when it is clicked my browser is opened and I am prompted to download the executable. Is there a way to run an executable using HTML, Javascript or something else on my local machine this way.
Also, I have read that this feature has been disabled on Windows 7. I found an application, AveDesktopSites from brothersoft.com that I think may allow me to use an html file as my wallpaper but I have not tried it. Any confirmation or recommendations for other software to do this would be appreciated.
Here is what I have so far(its very simple):
<body>
<a id="StackOverflow" href="websiteURL"> </a>
<a id="Excel" href="filepath to Excel Executable"> </a>
</body>
Then in the CSS file this HTML is using I adjusted the size of each of these anchor tags using their IDs to be the same size as the image and positioned them absolutely over the images to make the images appear to be clickable. I have only tested in my browser at this point.
Thanks in advance.
In windows XP and maybe even in versions before that it was possible to have a website as wallpaper.
You could just have a small block(resizable) with a custom given URL and it would stay on there you could just browse it like it was just another window.
However this option has been removed for Windows Vista and Windows 7.
So what you want now is not possible.
If you use Mozilla Firefox try downloading the addon "Speed dial."
It allows you to have a raster of 3x3 as your home page(you can create several groups all containing 3x3 or any other amount till a certain amount)
And every block in that raster can be a different website.
Gives you the same idea but not as wallpaper.
Its almost the same as bookmarks but just way faster.
I really dont know about any other software but they would have to do things to your windows that shouldnt be possible anymore. So im not sure if that really is what you want. There is probably a reason why Microsoft took it out.
Hope I could be of any help.
http://support.microsoft.com/default.aspx?scid=kb;EN-GB;q232077
I found a similar post containing this link. This looks like it could solve your dilemma if you never found a way.
Is there some way to preview documents in browser? Specifically in say an iframe within a page, as opposed to opening the doc in a new tab? I have a list of files of any type and when a user clicks on one, want to open it in a readonly format. If that file is a video or audio file, that's easy enough, but I'd like to be able to also do pdfs, word docs, maybe excel. Preferably it would be in a cross browser friendly way but if I need to do detection for a plugin (I've seen Google Docs Viewer for FF) I can live with that.
UPDATE:
ShaneC's answer is great and will work well in general. The one hitch I see is that for html5 devices (think ipad), I need to convert the document into a series of images. Is there any way for me to do this in an automated fashion? I need to be able to do this automatically when a new document is uploaded.
You'll want to integrate a cross-browser cross-type document viewer. Google will give you some good sites, personally I've had good experiences with Flex Paper.
For demos, see here: http://flexpaper.devaldi.com/demo/
There is another approach that can be used to view images/pdf/xlsx/docx etc.
You can use iframe and google's gview in the following way:
const YOUR_URL = https://calibre-ebook.com/downloads/demos/demo.docx;
<iframe
className="doc"
src={`https://docs.google.com/gview?url=${YOUR_URL}&embedded=true`}
/>
There is the Javascript ViewerJs. An open source tool which allows a website to display PDF and open standard for office documents. It will display the documents inline and without browser plugins.
As a web systems programmer, I'd like to generate some reports and be able to send it to the printer directly from my user's browser, wich is in the client side, not needing to generate PDFs or something like this.
I would like to be able to:
Print user friendly paging, something like "Page 1 of 3"
Print some things in the bottom of every page, like "Generated in 2009-02-20"
not printing the URL
Is all this possible? Javascript? CSS? What are the best practices here?
All those things are controlled exclusively through browser preferences. If you want to be able to specify that, then you probably should be looking at PDF instead of HTML.
You're out of luck using the browser there... I think it is impossible to not print in the corners the URL, Date/Time Accessed etc.
However, Page 1 or 3 etc is generally always printed somewhere (bottom right corner I believe in FireFox)
Printing a 'Generated in 2009-02-20' is easy enough, however printing it at the bottom of every page will be difficult. Most browsers, IIRC, display the date and time accessed in a corner (though not in that format, in a more readily human readable format).
Anything you want to appear in print but not in the normal screen view, will need to be shown using a print stylesheet.
For what you want here (complete control of the printing output), I'd recommend generating a PDF. Perhaps if this is an internal tool, you might be able to program a plugin for Firefox that may print your pdfs automatically, but I'm not that familiar with the capabilities of Firefox plugins so you'd need to experiment.
Support from different browsers is surely lacking, but css has a media type called print, to use it, just define a section in your css file or tag like this:
#media print{
/* normal style declarations
but you probably want to hide menus
and other navigation, also use black on white, etc.
*/
}
#media screen{
/* your current stylesheet */
}
This List Apart article covers the basics.
And here's an entry point to the wc3 specification.
you might be able to use SQL reporting services to generate your reports. It uses its own client print control activex though, but the results are good.