I have a Silverlight 3.0 applications with some custom graphics and some charts. I need to find the best way to transfer these graphics to a PowerPoint presentation.
I've read that Silverlight 4.0 offers a Clipboard API, but there is only support for Unicode-text, not images.
Is there a way to achieve this task without forcing users to manually PrtSc and than paste to other applicatons?
There's no simple way to do this in SL3. My recommendation would be to use a WriteableBitmap and save that to IsolatedStorage and then prompt the user with a FileSave Dialog to save to their box (and then they would have to put it in PowerPoint). The only problem with that Dialog in SL3 is that it doesn't allow you to set the extention type so they would need to type in the PNG or JPG extention. Both this and the PrtSc, Ctrl+P require multi-step user action and that is always a point of failure.
In SL4 there are more choices - you don't even need the Clipboard in an SLOOB. You can just use AutomationFactory to automate PowerPoint.
If True = HtmlPage.IsPopupWindowAllowed Then
HtmlPage.PopupWindow(New Uri("http://www.yourdomain.com/chartgenerator.ashx?param1=value1¶m2=value2"), "new", options)
End If
chartgenerator.aspx can either display an image:
' tell the browser to display inline
context.Response.AddHeader("Content-Disposition", "inline; filename=" & FilenameWithExt)
or display an Open, Save, Cancel dialog:
' tell the browser to save rather than display inline
context.Response.AddHeader("Content-Disposition", "attachment; filename=" & FilenameWithExt)
quoted from http://vbcity.com/blogs/mike-mcintyre/archive/2010/02/28/silverlight-3-pop-up-new-browser-window.aspx
Related
I want to create application in .NET, which will generate PDFs. This application should enable any movement of text, which an user will want set in the PDF.
I use in my project library PDFSharp. Could you suggest me how to display a preview of PDF, and how to enable move the one string within page? Do you have any ideas?
Regarding display the PDF, currently I use:
WebBrowser1.Navigate(new System.Uri(#"c:\firstpage.pdf"));
Is this good solution?
I am using the Aspose PDF tools and have successfully got it to print the pdf which is great, but ideally I want to be able to add a wpf control to display this as well.
I would have assumed that the PdfViewer class would have something, but I can't tell.
So far I have needed to use a different control MoonPdfPanel which is annoying as I would have preferred 1 tool to do both jobs.
Does anyone know of a control I can use to hook into the aspose?
Thanks
We have developed an HTML5 PDF Editor application using Aspose.Pdf for .NET API which you can use in your application as a PDF Viewer as well. You can get the details and complete source code here. You can use the source code to edit the viewer as per your requirement.
P.S. I am working as social media developer at Aspose.
Well, if you are interesting in viewing the PDF file, you may convert the file to HTML and display it using an IFrame in your application. I have developed a sample application which performs different operations including viewing a PDF file in IFrame. Download it and try it at your end. Another option is that you can convert the PDF file to images and display in Imageviewer in your application (Code is available in the above application).
P.S. I am working as social media developer at Aspose.
I want to be able to paste clipboard contents with functional hyperlinks to my Winform controls. In order for this to work I tried to check if the Clipboard contains HTML and no RTF and then I could parse the HTML content accordingly. Unfortunately the Internet Explorer generates RTF and HTML in the clipboard content and that way I can't really tell that the content is comming from a browser. Microsoft word for example does the same thing and the only way I found so far to differenciate office products from IE is to check for the namespace xmlns:o"urn:schemas-microsoft-com:office:office" in the HTML content of the clipboard. I can't simply use HTML in all cases, because I prefer the RTF or simply the unicode content from other sources than browsers.
Is there a way to determine that the clipboard content comes from a specific application? In my case from IE? So far I only used Clipboard.Contains(TextDataFormat.HTML) and Clipboard.GetDataObject().GetFormats() but I can't find anything else.
You can use P/Invoke class to get the calling applications window title using http://pinvoke.net/default.aspx/user32/GetWindowText.html. For IE the title is the name of the page and suffixed with - Microsoft Internet Explorer, default title for this IE.
This is sample code how to use GetWindowsText
C# how to use WM_GETTEXT / GetWindowText API
I'm trying to send a PDF file from a WCF to silverlight client. PDF is generated by DevExpress XtraReports (in method XtraReport CreateReport(string reportTypeName, RootGenericReportParameterContainer reportInformation)).
Acually PDF is saved somewhere on clients computer after choosing save path in file save dialog - DevExpress takes care of everything - but I don't have a clue how to open the PDF in new tab in browser.
And here is another problem. Silverlight 4 has no access to local file system right? So information about local PDF location is useless. Maybe it would be better to save the PDF in WCF and send a link to it to the client - but how?
I would first question why you need to send the file to the Silverlight client. Get rid of that requirement and the solution becomes much simpler. Silverlight can provide a link that opens a new browser tab. That link would be handled by the web domain, processing it as an HttpHandler, generating the PDF file for the browser. Your PDF url doesn't have to reference a physical file, you can still generate it on request, handle querystring values, etc... Lots of different ways to do this.
Seems that the question isn't really about DevExpress or Silverlight - you're just looking to open a [document of some kind] in a new tab. Each browser natively handles things differently, and users can change tab handling to whatever they want. And (as you mentioned) once the user has downloaded the file, you no longer control it.
Your best bet (and the way I do it) is probably to have a link pointing to a handler/file using "target='_blank' " in the anchor tag on the webpage. From the server side, you would want to set the "Content-Disposition" header to "Inline" to indicate to the browser that the document should be displayed in place instead of downloaded ("Attachment").
I want to show the result of a WebClient-Postback in an new Browser-Popup-Window. As the "Navigate" and "Popup" methods of HtmlPage only support Get-requests, I issued an POST-request to an REST-Service via WebClient. But now I want to show the result (e.g. application/ms-excel or application/pdf) in an new Browser-Window.
Therefore, can I open an new BrowserWindow and set its contents as well as some corresponding http-headers with on-board means of Silverlight 4? Or even better, is an easier way to trigger the browser to do the POST-request to the service?
Best Regards
I tried going this route but the WebBrowser control is not opened to the developer. What I did as a temporary workaround was to open my webpage http://www.xyz.com/default.aspx inside the WebControl and let the page drive the rest.
Mike Taulty had an example for somthing like this, how you can use javascript to communicate back to the silverlight app through InvokeScript:
http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2009/11/18/silverlight-4-rough-notes-html-hosting-in-the-webbrowser-control.aspx
I hope it helps!