private void AddDocumentToRequest(AssociatedDoc assDoc, FaxRequest request) { var originalSelection = ImagesEventManager.Instance.CurrentSelected; var associatedDocsDto = originalSelection; bool wasChanged = false; try { if (originalSelection.DocsId != assDoc.Id || originalSelection.Type != ImagesDtoType.Associated) { associatedDocsDto = imagesDal.GetByDocId(assDoc.Id, ImagesDtoType.Associated); ImagesEventManager.Instance.Raise(new ImagesSelectedEventArgs(associatedDocsDto, false)); wasChanged = true; } var currentEditor = TifEditor.GetCurrentEditor(); var publishToBytes = currentEditor.PublishToBytes(); associatedDocsDto.MarkupImage = publishToBytes; imagesDal.Update(associatedDocsDto); vaulter.VaultAssociatedDoc(assDoc.Id, null); request.AddDocument(assDoc.FileName, currentEditor.TotalPages, publishToBytes); } finally { if (wasChanged) { ImagesEventManager.Instance.Raise(new ImagesSelectedEventArgs(originalSelection, false)); } } }
public void PrintDocument() { foreach (Control control in this.Controls) { if ((control is TifEditor)) { TifEditor editor = (TifEditor)control; editor.PrintImage(); } else if (control is VaultRTFEditor) { if (printDialog1.ShowDialog() == DialogResult.OK) { richTextBoxPrintCtrl1.Rtf = ((VaultRTFEditor)control).Rtf; checkPrint = 0; printDocument1.Print(); } } else if (control is WebBrowser) { ((WebBrowser)control).ShowPrintDialog(); } } }
private void AddDocViewer(byte[] docStream) { DocType fileDocType = GetDocumentType(docStream); switch (fileDocType) { case DocType.TIF: { try { TifEditor editor = new TifEditor(); editor.Dock = System.Windows.Forms.DockStyle.Fill; editor.Edit = false; editor.ExitDelegate = null; editor.ImageFileName = null; editor.Location = new System.Drawing.Point(0, 0); editor.SaveAsFileName = null; editor.ScaleFactor = 1; editor.Size = new System.Drawing.Size(1148, 422); editor.TabIndex = 0; editor.TransDelegate = null; editor.UserName = null; editor.LoadImage(new MemoryStream(docStream)); this.Controls.Add(editor); } catch (Exception ex) { XtraMessageBox.Show("An error occurred while loading file: " + fileName + "." + Environment.NewLine + "Error CNF-547 in " + PROJ_FILE_NAME + ".AddDocViewer(): " + ex.Message, "Inbound Tab Page", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; } case DocType.HTML: { WebBrowser webBrowser = new WebBrowser(); webBrowser.Dock = System.Windows.Forms.DockStyle.Fill; webBrowser.TabIndex = 0; this.Controls.Add(webBrowser); StringBuilder contents = new StringBuilder(); char[] str = new char[docStream.Length]; for (int i = 0; i < docStream.Length; i++) { str[i] = (char)docStream[i]; } contents.Append(str); webBrowser.Navigate("about:blank"); webBrowser.Document.Write(contents.ToString()); webBrowser.Refresh(); break; } case DocType.RTF: { VaultRTFEditor richTextBox = new VaultRTFEditor(); richTextBox.Dock = System.Windows.Forms.DockStyle.Fill; richTextBox.LoadFile(new MemoryStream(docStream), RichTextBoxStreamType.RichText); this.Controls.Add(richTextBox); break; } } }