Skip to content

Commit f82e0d3

Browse files
author
Savas Ziplies
committed
Added: Options to open an exported PDF or HTML
1 parent 9329f1b commit f82e0d3

File tree

7 files changed

+172
-99
lines changed

7 files changed

+172
-99
lines changed

MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ protected virtual void exportAsHTMLMenuItem_Click(object sender, EventArgs e)
259259
catch { }
260260
sw.WriteLine(html);
261261
}
262+
//Open if requested
263+
if (this.markdownViewer.Options.htmlOpenExport)
264+
{
265+
Process.Start(saveFileDialog.FileName);
266+
}
262267
}
263268
}
264269

@@ -293,6 +298,12 @@ protected virtual void exportAsPDFMenuItem_Click(object sender, EventArgs e)
293298
//Generate PDF and save
294299
PdfDocument pdf = PdfGenerator.GeneratePdf(BuildHtml(ConvertedText, FileName), pdfConfig, PdfGenerator.ParseStyleSheet(Resources.MarkdownViewerHTML));
295300
pdf.Save(saveFileDialog.FileName);
301+
302+
//Open if requested
303+
if (this.markdownViewer.Options.pdfOpenExport)
304+
{
305+
Process.Start(saveFileDialog.FileName);
306+
}
296307
}
297308
}
298309

MarkdownViewerPlusPlus/Forms/OptionsPanelHTML.Designer.cs

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MarkdownViewerPlusPlus/Forms/OptionsPanelHTML.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public partial class OptionsPanelHTML : AbstractOptionsPanel
1616
public override void LoadOptions(Options options)
1717
{
1818
this.txtCssStyles.Text = options.HtmlCssStyle;
19+
this.chkOpenHTMLExport.Checked = options.htmlOpenExport;
1920
}
2021

2122
/// <summary>
@@ -25,6 +26,7 @@ public override void LoadOptions(Options options)
2526
public override void SaveOptions(ref Options options)
2627
{
2728
options.HtmlCssStyle = this.txtCssStyles.Text;
29+
options.htmlOpenExport = this.chkOpenHTMLExport.Checked;
2830
}
2931
}
3032
}

MarkdownViewerPlusPlus/Forms/OptionsPanelPDF.Designer.cs

Lines changed: 110 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MarkdownViewerPlusPlus/Forms/OptionsPanelPDF.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public override void LoadOptions(Options options)
3636
this.numMarginTop.Value = margins[1];
3737
this.numMarginRight.Value = margins[2];
3838
this.numMarginBottom.Value = margins[3];
39+
//
40+
this.chkOpenPDFExport.Checked = options.pdfOpenExport;
3941
}
4042

4143
/// <summary>
@@ -56,6 +58,8 @@ public override void SaveOptions(ref Options options)
5658
}
5759
//Save margins
5860
options.margins = this.numMarginLeft.Value + "," + this.numMarginTop.Value + "," + this.numMarginRight.Value + "," + this.numMarginBottom.Value;
61+
//
62+
options.pdfOpenExport = this.chkOpenPDFExport.Checked;
5963
}
6064
}
6165
}

0 commit comments

Comments
 (0)