コード例 #1
0
        /// -----------------------------------------------------------------------------
        /// 
        public static void processDocument(_Document doc)
        {
            CustomiseRegionalSetting custom = new CustomiseRegionalSetting();
            try
            {
                PolicyResponseProcessor.process(doc.PolicyList);
            }
            finally
            {
                custom.RestoreCulture();
            }

            PolicyResponseProcessor._RiskElements.Document = doc;

            string xmlContent = PolicyResponseProcessor._RiskElements.GetXml();
            string htmContent = PolicyResponseProcessor._RiskElements.GetHtml();

            doc.XmlContent = xmlContent;
            doc.HtmlContent = htmContent;
        }
コード例 #2
0
ファイル: PDFUserAction.cs プロジェクト: killbug2004/WSProf
		private void InternalExecute(object threadstate)
		{
			IDocumentPublisher8 publisher = null;
			ThreadState Result = threadstate as ThreadState;

			CustomiseRegionalSetting convert = new CustomiseRegionalSetting();
			try
			{
				PerformanceCounters.Instance.StartTimer(PerformanceCounters.CounterType.PDF);

				using (WsActivationContext wsac = new WsActivationContext())
				{
					publisher = new CDocumentPublisherClass();
					m_outputFile = GetPdfFilename(m_streamProperties["FileName"]);

					Publish(publisher, m_inputFile, m_outputFile);

					if ((bool)m_actionPropertySet[PdfActionStringTable.ConvertToPDFA].Value)
						publisher.ConvertPDFToPDFA(m_outputFile);
					else
						publisher.SetPermission(m_outputFile, (string) m_actionPropertySet[PdfActionStringTable.Password].Value,
														  (bool) m_actionPropertySet[PdfActionStringTable.ProhibitPrinting].Value,
														  (bool) m_actionPropertySet[PdfActionStringTable.ProhibitEdit].Value,
														  (bool) m_actionPropertySet[PdfActionStringTable.ProhibitCopy].Value,
														  (bool) m_actionPropertySet[PdfActionStringTable.ProhibitComments].Value);

					m_streamProperties["FileName"] = m_outputFile;

					// Can't just assign the DisplayName property, PDFAction removes any path info from it, 
					// we need to keep the path info because it describes the structure of zip files, ie if its in a folder in a zip its DisplayName would be "SomeFolder\\Document.docx"
					// If we loose "somefolder\\" we loose where in the zip the file came from.
					string newOutputPath = Path.Combine(Path.GetDirectoryName(m_streamProperties["DisplayName"]), Path.GetFileName(m_outputFile));
					m_streamProperties["DisplayName"] = newOutputPath;

					TryDeleteFiles(m_inputFile);

					if (Result != null)
						Result.ThreadStateResult = true;
				}
			}
			catch (COMException ex)
			{
				Logger.LogError(ex);
				if (Result != null)
					Result.ExceptionCaught = ex;
			}
			catch (Exception ex)
			{
				Logger.LogError(ex);
				if (Result != null)
					Result.ExceptionCaught = ex;
			}
			finally
			{
				convert.RestoreCulture();
				if (null != publisher)
				{
					Marshal.ReleaseComObject(publisher);
				}
			}
		}