private void buttonHTML_HandleActivated(object sender, EventArgs e) { // Load the HTML document string html_path = Path.Combine(NSBundle.MainBundle.ResourcePath, "result-png.template.html"); //webViewMarkUp.MainFrame.LoadRequest(new NSUrlRequest (new NSUrl (htmlPath))); global::PoorMansEditor.Common.TextParser parser = null; parser = new global::PoorMansEditor.Common.TextParser(); string html_converted = parser.PoorManEditorText2Html(text); string placeholder = "<div>$content$</div>"; string html_content = System.IO.File.ReadAllText(html_path); html_content = html_content.Replace(placeholder, html_converted); // load WebView control // javascript not triggered?!?!? png does not appear at the bottom?!?! webViewMarkUp.MainFrame.LoadHtmlString(html_content, null); string html_result_path = Path.Combine(NSBundle.MainBundle.ResourcePath, "result-png.html"); System.IO.File.WriteAllText(html_result_path, html_content); // open in browser to see png at the bottom System.Diagnostics.Process.Start(html_result_path); return; }
static void Main(string[] args) { string text = @" .large My First Document .normal .paragraph This is my .italics very first .regular document, and I am very proud that I am getting this on the string. While this paragraph is not filled, the following one has automatic filling set: .paragraph .indent +2 .fill Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. .nofill .indent -2 Well, that was .bold exciting .regular good luck! "; global::PoorMansEditor.Common.TextParser parser = null; parser = new global::PoorMansEditor.Common.TextParser(); parser.PoorManEditorText2Html(text); return; }
private void buttonPDF_HandleActivated(object sender, EventArgs e) { // Load the HTML document string html_path = Path.Combine(NSBundle.MainBundle.ResourcePath, "result.template.html"); //webViewMarkUp.MainFrame.LoadRequest(new NSUrlRequest (new NSUrl (htmlPath))); global::PoorMansEditor.Common.TextParser parser = null; parser = new global::PoorMansEditor.Common.TextParser(); string html_converted = parser.PoorManEditorText2Html(text); string placeholder = "<div>$content$</div>"; string html_content = System.IO.File.ReadAllText(html_path); html_content = html_content.Replace(placeholder, html_converted); string html_result_path = Path.Combine(NSBundle.MainBundle.ResourcePath, "result.html"); System.IO.File.WriteAllText(html_result_path, html_content); // open in browser to see png at the bottom System.Diagnostics.Process.Start(html_result_path); string htmldoc_path = Path.Combine(NSBundle.MainBundle.ResourcePath, "htmldoc"); // open in browser to see png at the bottom string result_pdf_path = Path.Combine(NSBundle.MainBundle.ResourcePath, "result.pdf"); System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(); psi.FileName = htmldoc_path; psi.Arguments = " -f " + result_pdf_path + " " + Path.Combine(NSBundle.MainBundle.ResourcePath, "result.html") ; System.Diagnostics.Process.Start(psi); System.Diagnostics.Process.Start(result_pdf_path); return; }