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!)
Related
I have a chrome extension which allows to write on screen in chrome tabs. The default behaviour looks like :
It works be simply inserting a canvas tag in the DOM and doing all the stuff in it. It works well in all sites. However, chrome PDF viewer behaves strangely when I use it :
Before -
After -
I don't think there is any issue with the extension because it works on all other sites. I think there is an issue with chrome PDF viewer itself.
I can attach the code here if asked in comments.
Ok, so I tried to replace all innerHTML += <value>; by insertAdjacentHTML("afterbegin",<value>); And now it's working fine.
It's because your canvas must be on top to ensure it will works on every website.
The z-index propery is not enough for that.
Hope that helped !
Most tutorials on javascript drag and drop explain how to handle file drops into the browser and how to drag data out of the browser. But I have seen almost nothing about draging a file out of the browser.
For example, you start a drag on a div element, drop it on the desktop and a file appears there.
What I have found is this: (from this example)
e.dataTransfer.setData('DownloadURL', `image/png:Luigi.png:${e.target.href}`);
However, as far as I can see, setting using DownloadURL this causes errors in chrome, a crash report in edge and doesn't do anything in firefox.
Is there a standard way to download a file through drag and drop, preferably from a url?
Ok, the problem in the example seems to be that Chrome now requires same origin on the DownloadURL.
At least that's what the Firefox developers believe that have had an issue to replicate this feature for 11 years now: https://bugzilla.mozilla.org/show_bug.cgi?id=570164
Safari doesn't seem to support it either
The iOS safari browser has a handy option that appears whenever you open a PDF page in the browser
If you have Adobe Reader installed, a button will appear that says:
Open in "Adobe Reader"...
However, if you open up the PDF document where the HUD (address bar, etc) is hidden, like in a phone gap application, or a quick and dirty "Add to Home Screen app" using the following meta:
<meta name="apple-mobile-web-app-capable" content="yes" />
then, obviously, the button will not appear.
I want to still open the PDF document in Adobe Reader. Does anyone know a way to do this programmatically?
I want to include jsPDF in a phonegap application, and save the results, and this would be the easiest way to do that.
Thanks in advance!
With some fantastic help from Vince Parsons (and others), I've solved this problem.
Using a PhoneGap Plugin, you can create / expose a JavaScript call, which is then processed in Objective-c.
Here's the two lines you need (yes, only two lines!), and a subsequent explanation:
self.docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:myDocumentPath]];
[self.docInteractionController presentOpenInMenuFromRect:CGRectMake(0,100,1,1) inView:UIApplication.sharedApplication.keyWindow animated:YES];
Explanation
Your input will be the file location.
In my case it's inside the app sandbox, so it looks something like:
/var/mobile/Applications/B16-HU83-GU1D-1D3NT1F13R/Documents/DocumentToExport.pdf
If you want to use an external URL, you can (with adjustments), but for my purposes it was internal.
So, with my file location as an input (let's call my input variable myDocumentPath), you just need to declare a document controller:
self.docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:myDocumentPath]];
this creates a UIDocumentInteractionController using the interactionControllerWithURL method, which needs an NSURL variable.
We create that NSURL variable using the fileURLWithPath method, passing it our myDocumentPath.
The next line calls presentOpenInMenuFromRect Which takes a rectangle and a viewport:
[self.docInteractionController presentOpenInMenuFromRect:CGRectMake(0,0,1,1) inView:UIApplication.sharedApplication.keyWindow animated:YES];
the rectangle is created at position 0,0 with a width and height of 0,0 (GCRectMake(0,0,1,1))
and the viewport is taken from the PhoneGap application: UIApplication.sharedApplication.keyWindow
I'm reeling with joy and amazement that this only took two lines of code to fix. Granted, there's not a way to do it with JavaScript only, but it's still pretty elegant, and works great.
You can open your PDF using PhoneGap InAppBrowser(http://docs.phonegap.com/en/2.5.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser) if the PDF is opend from the server using a URL or if its from local device, you can use the PDFViewer plugin: https://github.com/phonegap/phonegap-plugins/tree/master/iOS/PDFViewer.
Bothways the native default PDF reader will be used to open the PDF.
I really searched for an ready-to-use solution and gave up at one point. There are a few old repositories on GitHub and some articles building on the two lines of the green marked answer - but nothing works satisfying for me.
That's why i forked the cordova-plugin-file-opener2 to change the iOS behavior and this works perfect for me. To allow also parallel usage of the forked plugin, i've renamed it creatively to cordova-plugin-file-opener3. It provides the same features as version 2.0.1 of the forked plugin except that on iOS the "Open In"-Dialog is shown.
The change to the plugin was trivial. Just replaced one method call and did some renaming. Don't know why it was so hard to find a working solution - but maybe that i didn't search the right way.
You can find the repository here:
https://github.com/napolitano/cordova-plugin-file-opener3
Feel free to use it.
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.
I'm working on a file upload utility based on Valum's Ajax-Uploader. The idea is similar to the Gmail attachment process. The user should be able to drag a file from the desktop into the browser window and onto the file upload area to get it to upload. This works fine in the browsers that support this functionality (Firefox 3.6+, Chrome 7+).
The problem I'm running into are the styles that should be re-drawn when the user:
Drags the file anywhere in the browser
Drags the file into the upload area
I have tested in the exact same browser versions on WinXP, Vista, and Win7. The appropriate styles are redrawn. However, in Windows Server 2003, they do not.
In Win2003, when I inspect the div that should be redrawn via Firebug, the "drop-area" and "drop-area-active" classes are applied correctly. Firebug even shows the correct style declarations, but the changes are never visible.
The only difference between FF and Chrome that I'm able to spot is that in Chrome, the "drop-area-active" style is displayed for a split second when the user drops the file.
I'm not positive that it is a Windows2003 issue, but that's the only OS in which I'm able to recreate the bug.
Edit:
If you're running Win2k3, try the Gmail drag'n'drop functionality. I can see the alternate styles in other OS's, but not Win2k3.
Edit #2:
Still seeing this issue in many different places. Anyone have any suggestions? I have submitted this as a bug to the Chromium Project. Issue 68632.
http://code.google.com/p/chromium/issues/detail?id=68632