How to move a text on pdf? - wpf

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?

Related

Aspose PDF viewer

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.

Find out if the clipboard content comes from Internet Explorer

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

How do I display PDF Pages as thumbnails

I want to display each page in a PDF document as a thumbnail in an WPF list view as images
Any ideas?
You need a library that can render the PDF files into images for you.
If you can afford a commercial library, take a look at Amyuni PDF Creator .Net, the method IacDocument.ExportToJPeg_Method in particular will do what you need (usual disclaimer applies).
Just for the record, iTextSharp and PDFSharp will not be able to help you on this task, unless your PDF files are composed by raster images only.

Silverlight and XtraReports - opening generated PDF report in new tab in browser

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").

How to copy image of a chart from Silverlight application to clipboard?

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&param2=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

Resources