Silverlight rich text box - copy and paste html - html

I am using silverlight rich text box for capturing description for certain entities. One of the requirement is that user should be able to copy data from web pages (Internet) and paste inside the rich text box.
Rich text box in Silverlight uses XAML to format the data and there is no built in feature to convert HTML to XAML.
Please let me know if there is any such utility/control. Thanks.

Here's a good place to start. The converter mentioned there is not bullet proof but for simple conversions it's not bad.
It's a WPF utility, but IIRC, there was a source code for it (can't access the site right now), and I don't think there should be too much trouble to convert it to Silverlight.

Related

Angular Html + Css = PDF , problem to generate a proper PDF

I'm developing a web application using .Net core 3.0 (Back-end) and Angular 8 (Front-end).
The user completes a form and then I have to generate a PDF (with design & picture) with the data that he put. The PDF needs to be in high quality.
I have tried several libraries in both Front-end & Back-end.
I need to use a free library.
I think it will be easier and better to do it in the Front-end because the user will need to print it (directly most of the time).
And also, in case of high traffic generate it from the back-end will use too many resources.
Also, "print" the html page is not an option.
I've tried :
PdfMake,
kendo-angular-pdf-export,
Jspdf,
wkhtml,
and others...
The best ones:
Kendo UI
It was really the best one, easy to implement and doing exactly what I needed. But is not free and one license is like 900e/user
pdfMake
The problem with that was that I will have to do all the design with the library-style, So I will have some limitations.
I would like to be able to generate a pdf from an HTML page including the CSS.
I'm blocked with that pdf generation.
Did someone succeed to generate a proper pdf with a good design with pdfMake?
Thanks a lot in advance.
A solution I've used is to create a service which, on the back end, generates the HTML and uses headless Chrome to render the PDF. Stream that back to the client browser.

activeX/OCX simple HTML editor

I am looking for a simple HTML editor.
This package should fulfill the following:
Generates old type of HTML with no CSS
Fully supports Right-To-Left and Hebrew fonts
Must be an ActiveX / OCX component
Most editors in the market that I found so far, generate sophisticated HTML
What can you recommend?
EDITED
I need it for a desktop application. I want the user to be able to edit text like in HTML editor (font styles, alignment) etc.
One option which works well in desktop applications would be using a Richtext control, like TRichEdit or TRichView (commercial) for the editor.
RTF supports unicode and LTR and RTL (right-to-left) languages.
The generated RTF source can be exported to HTML, either with TRichView export functions or a converter library like my (commercial) ScroogeXHTML library.
nBit HTML Editor ActiveX/OCX (Commercial) seems to fit your requirements, except that the website does not state explicit support for hebrew/Right-to-left, so let's assume it doesn't support those, unless you can download a demo and try it. I have not used it so I cannot say.
It supports but does not seem to require CSS.
TRichView can import the HTML into RTF, then export it as HTML. I use it for a chat program message composer and a group chat message viewer by sending HTML between clients. I'm not sure about the span tag.
The TWebBrowser component used to allow editing; I haven't checked it lately but this is what I can find on Google:
How to enable editing of a document in TWebBrowser
Using it wasn't as straightforward as one would wish, but I remember doing pretty good things with it.

what would I have to do to get the new HTML Editor ajax control to work as a sharepoint content editor webpart?

Microsoft have just released a few new ajax controls including an ajaxed up HTML editor control.
http://www.asp.net/learn/Ajax-Control-Toolkit/tutorial-50-cs.aspx
I would like to try this in Sharepoint (as the built in Sharepoint one is awful (no cross browser at all and flaky on IE) I tried the Telerik free one but it was not very stable.
I guess that getting the control up on a page won't be too hard, but how do I make sure the resulting HTML is stored in the Sharepoint way(tm)?
Thanks
If you intend to replace the standard SharePoint rich text editor, you would likely find it much easier to use jQuery than the ajax control toolkit. The MS ajax controls have a server component - you may be able to get it into a custom column type, but it's going to be a lot easier if you just replace the textbox with something better clientside.
The standard control works in a similar way - a standard textbox containing html is created on the server, and javascript is used to hide that and connect it to the rich text editor.
There is really nothing you need to do to format the HTML for SharePoint. If you are working with a field control you can expect that SharePoint will strip out a lot of the HTML from your control.

PdfSharp, GDI+ and HTML printing

I currently have a "PrintingWebService" that I call from an AJAX page with all the information that is needed to construct a highly customized PDF printout using PDF Sharp and the PDFSharp's GDI+ mode, which takes DrawString and other commands that work basically just like GDI+ only they are drawn to the PDF.
I then save the PDF file to a location on the webserver and return the file name from the web service, and the AJAX page opens a new window with the pdf file.
So far, it works well, however, there is one part of my AJAX page that I want to printout and I haven't come up with a solution for yet. I've got a string of the HTML content of a TinyMCE editor that I want to dispay in the bottom part of the PDF page.
I'm looking for some sort of tool I could use for this purpose. Even something opensource that prints to GDI+ I could use by taking the source code and translating it to use PdfSharp's GDI+ (the class names are like XGraphics, with each class having X before the GDI+ name).
If I have to I will limit what HTML can be generated by TinyMCE and write my own renderer, but that will be a big challenge, so I'm looking for other solutions first.
I've stayed away from a printer-friendly page approach because I wanted to construct a page that was a near identical of an existing WinForms printout, using my existing code. With PdfSharp I was able to convert all the code except the text area stuff (which used the RichTextBox and RTF in the WinForms version).
Tony,
I personally have used WebSupergoo's ABCPdf library with much success. You can actually render HTML directly to the PDF and it does fairly well in regards to accuracy.
Another free software that will allow you the flexibility of writing HTML to PDF that I have used in the past with much success is iTextSharp.
Otherwise, I think you'll have to write something to render HTML to GDI.
Either way, you may want to consider using an HttpHandler that you map to using your web.config to generate the PDF file. This will allow for you to render the PDF to a bytestream and then dump it directly to the user (as opposed to having to save each PDF receipt to the web server). It will also allow for you to use the .pdf extension in the page that returns the receipt (PurchaseReceipt.pdf could be mapped to a HttpHandler)... making it more cross-browser friendly. Older versions of Adobe / Browsers will not display correctly if you start throwing a PDF byte stream from an ASPX page.
Hope this helps.

How can I capture rich text as input to a web form?

I need to have the user be able to cut-and-paste rich text into a big text box on my web page. How do I do that?
You can install a JavaScript editor like TinyMCE to allow for rich text. This particular WYSIWYG editor has a "Paste from Word" function that helps reduce all the nasty character encoding problems you typically have when users attempt to publish Word documents on the web.
I guess you can do it only by using IE/Windows/TinyMCE-like-widget set.
Here's some information about clipboards.