Ejemplo n.º 1
0
		public string PrintRange(WorkbookItem wi, PageSelection PageSelection)
		{
			IApplicationPrinterController controller = GetInstance(wi.TempCopy);
			try
			{
				return controller.PrintRange(wi, PageSelection);
			}
			catch (System.Exception)
			{
				throw;
			}
			finally
			{
				if (controller.Visible)
					controller.Visible = false;
			}
		}
Ejemplo n.º 2
0
		public override string PrintRange(WorkbookItem wi, PageSelection PageSelection)
		{
			throw new NotImplementedException("Printing page ranges not supported by Outlook object model");
		}
Ejemplo n.º 3
0
		public override string PrintRange(WorkbookItem wi, PageSelection range)
		{
			using (new WsActivationContext())
			{
				string PageSelection = "";
				int pageOption = 0;

				if (range != null)
				{
					PageSelection = range.Range;
					pageOption = (int)range.Type;
				}

				string destination = Workshare.Pdf.Combine.Coordinator.Utilities.GetTemporaryFileWithPdfExtension();
				Publisher.PublishWithWord(wi.TempCopy, destination, HostApplication, PageSelection, pageOption);
				return destination;
			}
		}
Ejemplo n.º 4
0
 public override string PrintRange(WorkbookItem wi, PageSelection PageSelection)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Ejemplo n.º 5
0
        public SavePdfRusult SavePdf(List<WorkbookItem> workbookItems, string outputFilePath, ProgressCallback progress)
		{
			try
			{
				Dictionary<string, PageSelection> PageSelectionSelection = CreateInterimPdfs(workbookItems, progress);

				if (PageSelectionSelection.Count > 0)
				{
                    if (PageSelectionSelection.ContainsKey(string.Empty)) // 
                    {
                        return SavePdfRusult.Cancel;
                    }

                    Dictionary<string, WorkbookItemInfo> workbookDictionary = new Dictionary<string, WorkbookItemInfo>(PageSelectionSelection.Count);

                    foreach (WorkbookItem item in workbookItems)
                    {
                        // only add the document to the list for finally combining
                        // if it has been successfully converted to PDF
                        if (item.Status != WorkbookItem.itemStatus.Converted)
                        {
                            continue;
                        }

                        if (workbookDictionary.ContainsKey(item.DocumentId))
                        {
                            continue;
                        }

                        PageSelection ps = item.PageSelection;
                        if (ps == null)
                        {
                            ps = new PageSelection() 
                                {
                                    Range = String.Empty,
                                    Type = PageSelectionType.All                                  
                                };
                        }

                        WorkbookItemInfo wii = new WorkbookItemInfo()
                            {
                                InterimPdfPath = item.Pdf,
                                OriginalFilePath = item.FileName,
                                PageSelection = ps
                            };

                        workbookDictionary.Add(item.DocumentId, wii);
                    }

					// can use 0 as all copiesd to each other for 
					// SHOULD: Split clean off to per doc and have a global security dlg
                    if (CreateFinalPdf(workbookDictionary, outputFilePath, workbookItems[0].PdfSecurityOptions))
					{
                        AddDocumentHistory(workbookItems);
                        return SavePdfRusult.Success;
					}

                    return SavePdfRusult.Error;
                }

				//WsMessage.ShowMessage(IntPtr.Zero, "No interim pdfs have been created", MessageButtons.WsOK, MessageBranding.WsDefault, MessageType.WsWarnIcon, "", -1);
			}
			catch (Exception ex)
			{
				WsMessage.ShowMessage(IntPtr.Zero, "Failed to create combined PDF: " + Environment.NewLine + "[" + ex.Message + "]", MessageButtons.WsOK, MessageBranding.WsDefault, MessageType.WsWarnIcon, "", -1);
			}

            return SavePdfRusult.Error;
		}
		public abstract string PrintRange(WorkbookItem wi, PageSelection PageSelection);