Skip to content
This repository has been archived by the owner on May 6, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Reorganised printing methods
Signed-off-by: Peter Nelson <peter@peterdn.com>
  • Loading branch information
peterdn committed Sep 23, 2010
1 parent 0bb7364 commit 7213306
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions WebKitCore/WebKitBrowserCore.cs
Expand Up @@ -918,17 +918,16 @@ public object GetGlobalScriptContext()
return null;
}

// printing methods
#endregion Public Methods

#region Printing Methods

/// <summary>
/// Prints the document using the current print and page settings.
/// </summary>
public void Print()
{
PrintDocument doc = new PrintDocument();
doc.DocumentName = this.DocumentTitle;
doc.DefaultPageSettings = PageSettings;
doc.OriginAtMargins = true;
PrintDocument doc = this.GetCommonPrintDocument();
PrintManager pm = new PrintManager(doc, this, false);
pm.Print();
}
Expand All @@ -953,10 +952,7 @@ public void ShowPageSetupDialog()
public void ShowPrintDialog()
{
PrintDialog printDlg = new PrintDialog();
PrintDocument doc = new PrintDocument();
doc.DocumentName = this.DocumentTitle;
doc.DefaultPageSettings = PageSettings;
doc.OriginAtMargins = true;
PrintDocument doc = this.GetCommonPrintDocument();
printDlg.Document = doc;

if (printDlg.ShowDialog() == DialogResult.OK)
Expand All @@ -973,17 +969,24 @@ public void ShowPrintPreviewDialog()
{
// TODO: find out why it apparently only shows the first page on the preview...
PrintPreviewDialog printDlg = new PrintPreviewDialog();
PrintDocument doc = new PrintDocument();
doc.DocumentName = this.DocumentTitle;
doc.DefaultPageSettings = PageSettings;
doc.OriginAtMargins = true;
PrintDocument doc = this.GetCommonPrintDocument();
printDlg.Document = doc;
PrintManager pm = new PrintManager(doc, this, true);
pm.Print();
printDlg.ShowDialog();
}

#endregion Public Methods
// Gets a PrintDocument with the current default settings.
private PrintDocument GetCommonPrintDocument()
{
PrintDocument doc = new PrintDocument();
doc.DocumentName = this.DocumentTitle;
doc.DefaultPageSettings = PageSettings;
doc.OriginAtMargins = true;
return doc;
}

#endregion

public void Dispose(bool disposing)
{
Expand Down

0 comments on commit 7213306

Please sign in to comment.