Skip to content

Commit

Permalink
Added: Options to open an exported PDF or HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
Savas Ziplies committed Mar 6, 2017
1 parent 9329f1b commit f82e0d3
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 99 deletions.
11 changes: 11 additions & 0 deletions MarkdownViewerPlusPlus/Forms/AbstractRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ protected virtual void exportAsHTMLMenuItem_Click(object sender, EventArgs e)
catch { }
sw.WriteLine(html);
}
//Open if requested
if (this.markdownViewer.Options.htmlOpenExport)
{
Process.Start(saveFileDialog.FileName);
}
}
}

Expand Down Expand Up @@ -293,6 +298,12 @@ protected virtual void exportAsPDFMenuItem_Click(object sender, EventArgs e)
//Generate PDF and save
PdfDocument pdf = PdfGenerator.GeneratePdf(BuildHtml(ConvertedText, FileName), pdfConfig, PdfGenerator.ParseStyleSheet(Resources.MarkdownViewerHTML));
pdf.Save(saveFileDialog.FileName);

//Open if requested
if (this.markdownViewer.Options.pdfOpenExport)
{
Process.Start(saveFileDialog.FileName);
}
}
}

Expand Down
30 changes: 30 additions & 0 deletions MarkdownViewerPlusPlus/Forms/OptionsPanelHTML.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions MarkdownViewerPlusPlus/Forms/OptionsPanelHTML.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public partial class OptionsPanelHTML : AbstractOptionsPanel
public override void LoadOptions(Options options)
{
this.txtCssStyles.Text = options.HtmlCssStyle;
this.chkOpenHTMLExport.Checked = options.htmlOpenExport;
}

/// <summary>
Expand All @@ -25,6 +26,7 @@ public override void LoadOptions(Options options)
public override void SaveOptions(ref Options options)
{
options.HtmlCssStyle = this.txtCssStyles.Text;
options.htmlOpenExport = this.chkOpenHTMLExport.Checked;
}
}
}
207 changes: 110 additions & 97 deletions MarkdownViewerPlusPlus/Forms/OptionsPanelPDF.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions MarkdownViewerPlusPlus/Forms/OptionsPanelPDF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public override void LoadOptions(Options options)
this.numMarginTop.Value = margins[1];
this.numMarginRight.Value = margins[2];
this.numMarginBottom.Value = margins[3];
//
this.chkOpenPDFExport.Checked = options.pdfOpenExport;
}

/// <summary>
Expand All @@ -56,6 +58,8 @@ public override void SaveOptions(ref Options options)
}
//Save margins
options.margins = this.numMarginLeft.Value + "," + this.numMarginTop.Value + "," + this.numMarginRight.Value + "," + this.numMarginBottom.Value;
//
options.pdfOpenExport = this.chkOpenPDFExport.Checked;
}
}
}
Loading

0 comments on commit f82e0d3

Please sign in to comment.