protected virtual void OnQueryPageSettings(QueryPageSettingsEventArgs e) { if (this.queryHandler != null) { this.queryHandler(this, e); } }
void fPrintDocument_QueryPageSettings(object sender, QueryPageSettingsEventArgs e) { int pageIndex = fPrintCurrentPage - 1; Page page = fDocument.GetPage(pageIndex); SizeInches pageSize = page.Size; int pageWidth = (int)(100 * pageSize.Width); // Convert to Hundreth of Inch int pageHeight = (int)(100 * pageSize.Height); // Convert to Hundreth of Inch e.PageSettings.PaperSize = new PaperSize("Custom", pageWidth, pageHeight); }
protected override void OnQueryPageSettings(System.Drawing.Printing.QueryPageSettingsEventArgs e) { base.OnQueryPageSettings(e); DomDocument doc2 = (DomDocument)this.CurrentPrintingPage.Document; //if (doc2.MainDocument != null) // doc2 = doc2.MainDocument; //doc2.RawPageIndex = doc2.Pages.IndexOf(this.CurrentPrintPage); //doc2.ScriptRunner.ExecutePropertyScriptBlock(doc2, ReportConsts.ScriptOnQueryPageSettings); }
private void HandleQueryPageSettings( object Sender, System.Drawing.Printing.QueryPageSettingsEventArgs args) { XPrintDocument doc = (XPrintDocument)Sender; DomDocument doc2 = (DomDocument)doc.CurrentPrintingPage.Document; //if (doc2.MainDocument != null) // doc2 = doc2.MainDocument; //doc2.RawPageIndex = doc2.Pages.IndexOf(doc.CurrentPrintPage); //doc2.ScriptRunner.ExecutePropertyScriptBlock(doc2, ReportConsts.ScriptOnQueryPageSettings); }
protected override void OnQueryPageSettings(QueryPageSettingsEventArgs e) { if (_currentPage < _document.PageCount) { // Some printers misreport landscape. The below check verifies // whether the page rotation matches the landscape setting. bool inverseLandscape = e.PageSettings.Bounds.Width > e.PageSettings.Bounds.Height != e.PageSettings.Landscape; bool landscape = GetOrientation(_document.PageSizes[_currentPage]) == Orientation.Landscape; if (inverseLandscape) landscape = !landscape; e.PageSettings.Landscape = landscape; } }
/// <summary> /// 已重载:查询页面设置 /// </summary> /// <param name="e">事件参数</param> protected override void OnQueryPageSettings(System.Drawing.Printing.QueryPageSettingsEventArgs e) { if (myDocument != null) { System.Drawing.Printing.PageSettings ps = myDocument.Pages.PageSettings.StdPageSettings; foreach (System.Drawing.Printing.PaperSize mySize in this.PrinterSettings.PaperSizes) { if (ps.PaperSize.PaperName == mySize.PaperName) { ps.PaperSize = mySize; break; } } e.PageSettings = ps; if (myDocument.Pages.PrinterSettings != null) { this.PrinterSettings = myDocument.Pages.PrinterSettings; } } base.OnQueryPageSettings(e); }
protected override void OnQueryPageSettings(QueryPageSettingsEventArgs e) { e.PageSettings = (PageSettings)m_pageSettings.Clone(); //e.PageSettings.PrinterSettings.PrintRange = PrintRange.SomePages; //e.PageSettings.PrinterSettings.FromPage = 1; //e.PageSettings.PrinterSettings.ToPage = 1; }
internal override void ReportQueryPage(object sender, QueryPageSettingsEventArgs qpea) { base.ReportQueryPage(sender, qpea); base.SinglePage.IDataNavigator = this.dataNavigator; }
/// <summary> /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed. /// <example> /// querypagesettingseventhandler.BeginInvoke(sender, e, callback); /// </example> /// </summary> public static IAsyncResult BeginInvoke(this QueryPageSettingsEventHandler querypagesettingseventhandler, Object sender, QueryPageSettingsEventArgs e, AsyncCallback callback) { if(querypagesettingseventhandler == null) throw new ArgumentNullException("querypagesettingseventhandler"); return querypagesettingseventhandler.BeginInvoke(sender, e, callback, null); }
private void Document_QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e) { }
private void QueryPageSettings(object sender, QueryPageSettingsEventArgs e) { //e.PageSettings.Landscape = true; }
internal override void ReportQueryPage(object sender, QueryPageSettingsEventArgs qpea) { qpea.PageSettings.Landscape = base.ReportSettings.Landscape; base.ReportQueryPage (sender,qpea); }
private void printDocument3_QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e) { e.PageSettings.PaperSize = new System.Drawing.Printing.PaperSize("A4 (210 x 297 mm)", 827, 1157); e.PageSettings.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); }
/// <summary> /// Infrastructure. Don't use in your own projects. Will be called by PrintDocument during the printing process. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void EhQueryPageSettings(object sender, QueryPageSettingsEventArgs e) { if (_printOptions.RotatePageAutomatically) { bool needLandscape = false; if (_layers.Size.X > _layers.Size.Y) needLandscape = true; e.PageSettings.Landscape = needLandscape; } }
/// <summary> /// Called before each page is printed. /// </summary> protected override void OnQueryPageSettings(QueryPageSettingsEventArgs e) { base.OnQueryPageSettings(e); // A single Word document can have multiple sections that specify pages with different sizes, // orientation and paper trays. This code is called by the .NET printing framework before // each page is printed and we get a chance to specify how the page is to be printed. PageInfo pageInfo = mDocument.GetPageInfo(mCurrentPage - 1); e.PageSettings.PaperSize = pageInfo.GetDotNetPaperSize(PrinterSettings); // MS Word stores the paper source (printer tray) for each section as a printer-specfic value. // To obtain the correct tray value you will need to use the RawKindValue returned // by .NET for your printer. e.PageSettings.PaperSource.RawKind = pageInfo.PaperTray; e.PageSettings.Landscape = pageInfo.Landscape; }
protected override void OnQueryPageSettings(QueryPageSettingsEventArgs e) { e.PageSettings = _documents[_docIndex].DefaultPageSettings; CallMethod(_documents[_docIndex], "OnQueryPageSettings", e); base.OnQueryPageSettings(e); }
private bool PrintLoopOptimized(PrintDocument document) { PrintPageEventArgs? pageEvent = null; PageSettings documentPageSettings = (PageSettings)document.DefaultPageSettings.Clone(); QueryPageSettingsEventArgs queryEvent = new QueryPageSettingsEventArgs(documentPageSettings); while (true) { queryEvent.PageSettingsChanged = false; document.OnQueryPageSettings(queryEvent); if (queryEvent.Cancel) { return(true); } if (!queryEvent.PageSettingsChanged) { // QueryPageSettings event handler did not change the page settings, // thus we use default page settings from the document object. if (pageEvent == null) { pageEvent = CreatePrintPageEvent(queryEvent.PageSettings); } else { // This is not the first page and the settings had not changed since the previous page, // thus don't re-apply them. pageEvent.CopySettingsToDevMode = false; } Graphics?graphics = OnStartPage(document, pageEvent); pageEvent.SetGraphics(graphics); } else { // Page settings were customized, so use the customized ones in the start page event. pageEvent = CreatePrintPageEvent(queryEvent.PageSettings); Graphics?graphics = OnStartPage(document, pageEvent); pageEvent.SetGraphics(graphics); } try { document.OnPrintPage(pageEvent); OnEndPage(document, pageEvent); } finally { pageEvent.Graphics !.Dispose(); pageEvent.SetGraphics(null); } if (pageEvent.Cancel) { return(true); } else if (!pageEvent.HasMorePages) { return(false); } } }
private void pdQueryTextPageSettingsEvent(object sender, QueryPageSettingsEventArgs ev) { if (string.IsNullOrEmpty(this.mPaperSize)) { foreach (System.Drawing.Printing.PaperSize size in ev.PageSettings.PrinterSettings.PaperSizes) { if (size.Kind == PaperKind.A4) { ev.PageSettings.PaperSize = size; break; } } } else { foreach (System.Drawing.Printing.PaperSize size2 in ev.PageSettings.PrinterSettings.PaperSizes) { if (size2.PaperName == this.mPaperSize) { ev.PageSettings.PaperSize = size2; break; } } } if (string.IsNullOrEmpty(this.mOrientation)) { ev.PageSettings.Landscape = false; } else { ev.PageSettings.Landscape = this.mOrientation == Resources.ResourceManager.GetString("MSG0207"); } ev.PageSettings.Margins.Left = (int) Math.Round((double) 39.370077483689094); ev.PageSettings.Margins.Top = (int) Math.Round((double) 39.370077483689094); ev.PageSettings.Margins.Right = (int) Math.Round((double) 39.370077483689094); ev.PageSettings.Margins.Bottom = (int) Math.Round((double) 39.370077483689094); }
private void OnQueryPageSettings(object sender, QueryPageSettingsEventArgs e) { DcmFilmBox filmBox = _filmBoxes[_current]; e.PageSettings.Landscape = (filmBox.FilmOrientation == "LANDSCAPE"); }
// methods public void Print(){ PrintEventArgs printArgs = new PrintEventArgs(); this.OnBeginPrint(printArgs); if (printArgs.Cancel) return; PrintController.OnStartPrint(this, printArgs); if (printArgs.Cancel) return; Graphics g = null; if (printArgs.GraphicsContext != null) { g = Graphics.FromHdc (printArgs.GraphicsContext.Hdc); printArgs.GraphicsContext.Graphics = g; } // while there are more pages PrintPageEventArgs printPageArgs; do { QueryPageSettingsEventArgs queryPageSettingsArgs = new QueryPageSettingsEventArgs ( DefaultPageSettings.Clone () as PageSettings); OnQueryPageSettings (queryPageSettingsArgs); PageSettings pageSettings = queryPageSettingsArgs.PageSettings; printPageArgs = new PrintPageEventArgs( g, pageSettings.Bounds, new Rectangle(0, 0, pageSettings.PaperSize.Width, pageSettings.PaperSize.Height), pageSettings); // TODO: We should create a graphics context for each page since they can have diferent paper // size, orientation, etc. We use a single graphic for now to keep Cairo using a single PDF file. printPageArgs.GraphicsContext = printArgs.GraphicsContext; Graphics pg = PrintController.OnStartPage(this, printPageArgs); // assign Graphics in printPageArgs printPageArgs.SetGraphics(pg); if (!printPageArgs.Cancel) this.OnPrintPage(printPageArgs); PrintController.OnEndPage(this, printPageArgs); if (printPageArgs.Cancel) break; } while (printPageArgs.HasMorePages); this.OnEndPrint(printArgs); PrintController.OnEndPrint(this, printArgs); }
private void document_QueryPageSettings(object sender, QueryPageSettingsEventArgs e) { // throw new NotImplementedException(); }
protected virtual void OnQueryPageSettings(QueryPageSettingsEventArgs e){ //fire the event if (QueryPageSettings != null) QueryPageSettings(this, e); }
protected virtual void OnQueryPageSettings(QueryPageSettingsEventArgs e) { throw null; }
private void printDocument1_QueryPageSettings( object sender, QueryPageSettingsEventArgs e) { }
protected override void OnQueryPageSettings(QueryPageSettingsEventArgs e) { e.PageSettings = (PageSettings)m_pageSettings.Clone(); }
/// <summary> /// Setup page settings /// </summary> protected abstract void QueryPageSettings(object sender, QueryPageSettingsEventArgs e);
// methods public void Print() { PrintEventArgs printArgs = new PrintEventArgs(); this.OnBeginPrint(printArgs); if (printArgs.Cancel) { return; } PrintController.OnStartPrint(this, printArgs); if (printArgs.Cancel) { return; } Graphics g = null; if (printArgs.GraphicsContext != null) { g = Graphics.FromHdc(printArgs.GraphicsContext.Hdc); printArgs.GraphicsContext.Graphics = g; } // while there are more pages PrintPageEventArgs printPageArgs; do { QueryPageSettingsEventArgs queryPageSettingsArgs = new QueryPageSettingsEventArgs( DefaultPageSettings.Clone() as PageSettings); OnQueryPageSettings(queryPageSettingsArgs); PageSettings pageSettings = queryPageSettingsArgs.PageSettings; printPageArgs = new PrintPageEventArgs( g, pageSettings.Bounds, new Rectangle(0, 0, pageSettings.PaperSize.Width, pageSettings.PaperSize.Height), pageSettings); // TODO: We should create a graphics context for each page since they can have diferent paper // size, orientation, etc. We use a single graphic for now to keep Cairo using a single PDF file. printPageArgs.GraphicsContext = printArgs.GraphicsContext; Graphics pg = PrintController.OnStartPage(this, printPageArgs); // assign Graphics in printPageArgs printPageArgs.SetGraphics(pg); if (!printPageArgs.Cancel) { this.OnPrintPage(printPageArgs); } PrintController.OnEndPage(this, printPageArgs); if (printPageArgs.Cancel) { break; } } while (printPageArgs.HasMorePages); this.OnEndPrint(printArgs); PrintController.OnEndPrint(this, printArgs); }
private void pD_QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e) { e.PageSettings.PaperSize = new System.Drawing.Printing.PaperSize("", 850, 552); e.PageSettings.Margins = new Margins(0, 0, 0, 0); }
public void QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e) { // Set margins to .5" all the way around //e.PageSettings.Margins = new Margins(50, 50, 50, 50); }
// Print the document. public void Print() { PrintController controller = PrintController; PrintEventArgs printArgs; QueryPageSettingsEventArgs queryArgs; PrintPageEventArgs pageArgs; Graphics graphics; // Begin the printing process. printArgs = new PrintEventArgs(); OnBeginPrint(printArgs); #if CONFIG_COMPONENT_MODEL if(printArgs.Cancel) { return; } #endif controller.OnStartPrint(this, printArgs); // Wrap the rest in a "try" block so that the controller // will be properly shut down if an exception occurs. try { queryArgs = new QueryPageSettingsEventArgs ((PageSettings)(DefaultPageSettings.Clone())); do { // Query the page settings for the next page. OnQueryPageSettings(queryArgs); #if CONFIG_COMPONENT_MODEL if(queryArgs.Cancel) { break; } #endif // Create the page argument structure. pageArgs = new PrintPageEventArgs (queryArgs.PageSettings); // Get the graphics object to use to draw the page. graphics = controller.OnStartPage(this, pageArgs); pageArgs.graphics = graphics; // Print the page. try { OnPrintPage(pageArgs); controller.OnEndPage(this, pageArgs); } finally { graphics.Dispose(); } } while(!(pageArgs.Cancel) && pageArgs.HasMorePages); } finally { try { OnEndPrint(printArgs); } finally { controller.OnEndPrint(this, printArgs); } } }
private bool PrintLoop(PrintDocument document) { PrintPageEventArgs args2; QueryPageSettingsEventArgs e = new QueryPageSettingsEventArgs((PageSettings) document.DefaultPageSettings.Clone()); do { document._OnQueryPageSettings(e); if (e.Cancel) { return true; } args2 = this.CreatePrintPageEvent(e.PageSettings); Graphics graphics = this.OnStartPage(document, args2); args2.SetGraphics(graphics); try { document._OnPrintPage(args2); this.OnEndPage(document, args2); } finally { args2.Dispose(); } if (args2.Cancel) { return true; } } while (args2.HasMorePages); return false; }
// Raise the "QueryPageSettings" event. protected virtual void OnQueryPageSettings(QueryPageSettingsEventArgs e) { if(QueryPageSettings != null) { QueryPageSettings(this, e); } }
private void pdQueryPageSettingsEvent(object sender, QueryPageSettingsEventArgs ev) { if (string.IsNullOrEmpty(this.mPaperSize)) { ev.PageSettings.PaperSize = this.getPaperSizeAttribute(this.mPageList[this.mDrawPage]); } else { foreach (System.Drawing.Printing.PaperSize size in this.mPaperSizes) { if (size.PaperName == this.mPaperSize) { ev.PageSettings.PaperSize = size; break; } } } if (string.IsNullOrEmpty(this.mOrientation)) { ev.PageSettings.Landscape = this.getBoolAttribute(this.mPageList[this.mDrawPage], "LandScape"); } else { ev.PageSettings.Landscape = this.mOrientation == Resources.ResourceManager.GetString("MSG0207"); } ev.PageSettings.Margins = this.getPrinterMarginAttribute(this.mPageList[this.mDrawPage]); }
/// <summary> /// 已重载:查询页面设置 /// </summary> /// <param name="e">事件参数</param> protected override void OnQueryPageSettings(System.Drawing.Printing.QueryPageSettingsEventArgs e) { base.OnQueryPageSettings(e); if (CheckContent()) { //string printerNameBack = this.CurrentPrintPage.PageSettings.PrinterName; //this.CurrentPrintPage.PageSettings.PrinterName = // e.PageSettings.PrinterSettings.PrinterName; XPageSettings ps = this.CurrentPrintingPage.PageSettings.Clone(); ps.PrinterName = e.PageSettings.PrinterSettings.PrinterName; // 指定打印机 string printerName = ps.PrinterName; if (printerName != null && printerName.Trim().Length > 0) { printerName = printerName.Trim(); foreach (string name in PrinterSettings.InstalledPrinters) { if (string.Compare(printerName, name, true) == 0) { //this.PrinterSettings.PrinterName = name; e.PageSettings.PrinterSettings.PrinterName = name; base.PrinterSettings.PrinterName = name; break; } } } // 指定纸张设置 string paperSource = ps.PaperSource; if (paperSource != null && paperSource.Trim().Length > 0) { foreach (System.Drawing.Printing.PaperSource source in e.PageSettings.PrinterSettings.PaperSources) { if (string.Compare(source.SourceName, paperSource, true) == 0) { e.PageSettings.PaperSource = source; break; } } //e.PageSettings.PaperSource.SourceName = paperSource; } //if (ps.StickToPageSize) //{ if (ps.PaperKind == PaperKind.Custom) { System.Drawing.Printing.PaperSize newSize = new PaperSize("Custom", ps.PaperWidth, ps.PaperHeight); //System.Drawing.Printing.PaperSize newSize = new PaperSize( mySize.PaperName, ps.PaperWidth, ps.PaperHeight); newSize.Width = ps.PaperWidth; newSize.Height = ps.PaperHeight; //newSize.RawKind = mySize.RawKind; e.PageSettings.PaperSize = newSize; } //if (ps.PaperKind != PaperKind.Custom) else { foreach (System.Drawing.Printing.PaperSize mySize in e.PageSettings.PrinterSettings.PaperSizes) { if (ps.PaperKind == mySize.Kind) { e.PageSettings.PaperSize = mySize; break; } } } //} e.PageSettings.Margins = ps.Margins; e.PageSettings.Landscape = ps.Landscape; } }
private void printDocument1_QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e) { //e.PageSettings.Landscape = true; }
private void printDocument1_QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e) { e.PageSettings.PaperSize = new System.Drawing.Printing.PaperSize("A4 (210 x 297 mm)", 827, 1155);//(60 + dataGridView1.Rows.Count * 10) * 4 e.PageSettings.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); }
/// <summary> /// Setup page settings /// </summary> protected override void QueryPageSettings(object sender, QueryPageSettingsEventArgs e) { MetricHInch hInch = new MetricHInch(); e.PageSettings.PaperSize = paperSize; e.PageSettings.Margins.Left = (int) Math.Round(hInch.Reverse(marginLeft)); e.PageSettings.Margins.Top = (int) Math.Round(hInch.Reverse(marginTop)); //e.PageSettings.Margins.Right = (int) Math.Round(hInch.Reverse(marginRight)); //e.PageSettings.Margins.Bottom = (int) Math.Round(hInch.Reverse(marginBottom)); }
private void OnQueryPageSettings(object sender, QueryPageSettingsEventArgs e) { OnStatusUpdate(string.Format("Printing film {0} of {1}", _currentPage + 1, FilmBoxFolderList.Count)); var filmBoxFolder = string.Format("{0}\\{1}", FullPrintJobFolder, FilmBoxFolderList[_currentPage]); var filmSession = FilmSession.Load(string.Format("{0}\\FilmSession.dcm", filmBoxFolder)); _currentFilmBox = FilmBox.Load(filmSession, filmBoxFolder); e.PageSettings.Margins.Left = 25; e.PageSettings.Margins.Right = 25; e.PageSettings.Margins.Top = 25; e.PageSettings.Margins.Bottom = 25; e.PageSettings.Landscape = _currentFilmBox.FilmOrienation == "LANDSCAPE"; }
internal void _OnQueryPageSettings(QueryPageSettingsEventArgs e) { OnQueryPageSettings(e); }
// Query page settings is called for each print or print preview task. // For every MyGridPrintDocument created the initial page settings is the base DefaultPageSettings. /// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnQueryPageSettings(QueryPageSettingsEventArgs e) { e.PageSettings = m_documentPageSettings; base.OnQueryPageSettings(e); }
/// <summary> /// Raises the <see cref="E:System.Drawing.Printing.PrintDocument.QueryPageSettings"/> event. It is called immediately before each <see cref="E:System.Drawing.Printing.PrintDocument.PrintPage"/> event. /// </summary> /// <param name="e">A <see cref="T:System.Drawing.Printing.QueryPageSettingsEventArgs"/> that contains the event data.</param> protected override void OnQueryPageSettings(QueryPageSettingsEventArgs e) { base.OnQueryPageSettings(e); if (!e.Cancel) { PageSettings settings = e.PageSettings; PageInfo pageInfo = this.renderer.FormattedDocument.GetPageInfo(this.pageNumber); // set portrait/landscape settings.Landscape = pageInfo.Orientation == PdfSharp.PageOrientation.Landscape; } }
private void pdocCalendar_QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e) { e.PageSettings.Landscape = true; }
protected override void OnQueryPageSettings(QueryPageSettingsEventArgs e){ base.OnQueryPageSettings(e); }
internal override void ReportQueryPage(object sender, QueryPageSettingsEventArgs qpea) { base.ReportQueryPage (sender,qpea); }
/// <summary> /// Raises the <see cref='QueryPageSettings'/> event. /// </summary> protected internal virtual void OnQueryPageSettings(QueryPageSettingsEventArgs e) { _queryHandler?.Invoke(this, e); }