private void SldImgWidth_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { if (!(page is null)) { while (page.CanPrev) { currpg--; page.PrevPage(); } page.ImgSize = e.NewValue; page.UndoFirma(); if (!page.CanNext) { page.DoFirmas(); } } }
private void BtnPrint_Click(object sender, RoutedEventArgs e) { PrintDialog dialog = new PrintDialog(); if (!dialog.ShowDialog() ?? true) { return; } var sz = new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight); var document = new FixedDocument(); document.DocumentPaginator.PageSize = sz; for (int c = 1; c <= page.PgCount; c++) { var p = new FormPage(page.Data, page.Imgs, sz, page.Lang, false) { ImgSize = page.ImgSize, TextSize = page.TextSize }; if (c == page.PgCount) { p.DoFirmas(); } p.GotoPage(c); p.ShowPager(c, page.PgCount); p.Measure(sz); p.Arrange(new Rect(sz)); p.UpdateLayout(); p.FdpwContent.UpdateLayout(); if (c == page.PgCount) { MessageBox.Show("Imprimiendo documento...", "Imprimir", MessageBoxButton.OK, MessageBoxImage.Information); } Grid pc = p.RootContent; p.Content = null; p = null; pc.Measure(sz); pc.Arrange(new Rect(sz)); pc.UpdateLayout(); var fixedPage = new FixedPage { Width = sz.Width, Height = sz.Height }; fixedPage.Children.Add(pc); var pageContent = new PageContent(); ((IAddChild)pageContent).AddChild(fixedPage); document.Pages.Add(pageContent); } dialog.PrintDocument(document.DocumentPaginator, $"Biopsia {page.TxtBiop.Text}"); }