当前位置: 首页>>代码示例>>C#>>正文


C# Doc.Dispose方法代码示例

本文整理汇总了C#中Doc.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Doc.Dispose方法的具体用法?C# Doc.Dispose怎么用?C# Doc.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doc的用法示例。


在下文中一共展示了Doc.Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Control

        public void Control()
        {
            var connectionString = ConfigurationManager.ConnectionStrings["LicenseKey"].ConnectionString;
            XSettings.InstallLicense(connectionString);
            var theDoc = new Doc { FontSize = 96 };

            theDoc.AddText("Control");
            Response.ContentType = "application/pdf";
            theDoc.Save(Response.OutputStream);
            theDoc.Clear();
            theDoc.Dispose();
        }
开发者ID:hurricanepkt,项目名称:ABCPDF-AzureWebsites,代码行数:12,代码来源:HomeController.cs

示例2: CreateTestDoc

		private Doc CreateTestDoc(int assessmentID, List<AssessmentPrintBatchHelper> assessmentPrintBatchHelpers, Doc doc, string imagesUrl,bool isAdminInst=false)
        {
            /*  Modified to add uploaded document */
            int userID = SessionObject.LoggedInUser.Page;
            var assessmentInfo = Assessment.GetConfigurationInformation(assessmentID, userID);
            var contentType = assessmentInfo.ContentType;
            bool stringCompareResult = contentType.Equals(_externalTestType, StringComparison.OrdinalIgnoreCase);
            bool noDataFlag = true;

            if (!contentType.Equals(_externalTestType, StringComparison.OrdinalIgnoreCase))    // Is this an External Test
            {
                doc = Assessment.RenderAssessmentToPdf_Batch(assessmentID, assessmentPrintBatchHelpers, imagesUrl, isAdminInst); // Not an External Document
                noDataFlag = false;
            }
            else
            {
                foreach (var assessmentPrintBatchHelper in assessmentPrintBatchHelpers)  //Test Can have multiple Forms (Example: Form 201, Form 101, form 301, etc.)
                {
                    DataTable tbl = Assessment.GetDocs(assessmentID);
                    string tempFile = string.Empty;
                    string AnswerKeyTempFile = tbl.Rows[0][_answerKeyFile].ToString();
                    string[] attachmentTypes = { _assementFile, _reviewerFile, _answerKeyFile };  //rename formNames Attacment types
                   
                    /** Print Uploaded Assessment file **/
                    foreach (string attachmentType in attachmentTypes)
                    {
                        if (!string.IsNullOrEmpty(tbl.Rows[0][attachmentType].ToString()))
                        {
                            tempFile = tbl.Rows[0][attachmentType].ToString();
                            using (Doc externalDoc = new Doc())
                            {
                                int docCount = 0;
                                switch (attachmentType)
                                {
                                    case _assementFile:
                                        docCount = assessmentPrintBatchHelper.AssessmentCount;
                                        break;
                                    case _reviewerFile:
                                        docCount = assessmentPrintBatchHelper.AssessmentCount;
                                        break;
                                    case _answerKeyFile:
                                        docCount = assessmentPrintBatchHelper.AnswerKeyCount;
                                        break;
                                }
                                externalDoc.Read(Server.MapPath("~/upload/" + tempFile));

                                for (int j = 0; j < docCount; j++)
                                {
                                    doc.Append(externalDoc);
                                    noDataFlag = false;
                                }
                            }
                             
                        }                        
                    }


                    //Ashley Reeves said that the Answer Key must Print if there is no enternal file loaded - Reference TFS Bug 1350
                    if (string.IsNullOrEmpty(AnswerKeyTempFile) && assessmentPrintBatchHelper.AnswerKeyCount > 0)
                    {
                        Doc answerKeyDoc = new Doc();
                        answerKeyDoc = Assessment.RenderAssessmentToPdf(assessmentID, assessmentPrintBatchHelper.FormID, PdfRenderSettings.PrintTypes.AnswerKey, isAdminInst);
                        //answerKeyDoc = Assessment.RenderAssessmentAnswerKeyToPdf_Batch(assessmentID, assessmentPrintBatchHelpers); // Not an External Document
                        for (int j = 0; j < assessmentPrintBatchHelper.AnswerKeyCount; j++)
                        {
                            doc.Append(answerKeyDoc);
                            noDataFlag = false;
                        }
                        answerKeyDoc.Dispose();
                    }
                    //1-30-2014 Bug 13579:Print on External Assessment with Rubric should print Rubric and not blank pdf
                    if (assessmentPrintBatchHelper.RubricCount > 0)
                    {
                        Doc RubricDoc = new Doc();
                        RubricDoc = Assessment.RenderAssessmentToPdf(assessmentID, assessmentPrintBatchHelper.FormID, PdfRenderSettings.PrintTypes.Rubric, isAdminInst);
                        for (int j = 0; j < assessmentPrintBatchHelper.RubricCount; j++)
                        {
                            doc.Append(RubricDoc);
                            noDataFlag = false;
                        }
                        RubricDoc.Dispose();
                    }
                    //END 1-30-2014 Bug 13579
                }
                #region JavaScript
                //string scriptName = "MasterJavaScript";
                //string myScriptName = "CustomMessage";
                //if (noDataFlag && !ClientScript.IsClientScriptBlockRegistered(scriptName) && !ClientScript.IsClientScriptBlockRegistered(myScriptName))  //Verify script isn't already registered
                //{

                //    string masterJavaScriptText = string.Empty;
                //    string filePath = Server.MapPath("~/Scripts/master.js");
                //    using (StreamReader MasterJavaScriptFile = new StreamReader(filePath))
                //    {
                //        masterJavaScriptText = MasterJavaScriptFile.ReadToEnd();
                //    }
                //    if (!string.IsNullOrEmpty(masterJavaScriptText))
                //    {
                //        ClientScript.RegisterClientScriptBlock(this.GetType(), scriptName, masterJavaScriptText);

//.........这里部分代码省略.........
开发者ID:ezimaxtechnologies,项目名称:ASP.Net,代码行数:101,代码来源:RenderAssessmentAsPDF.aspx.cs


注:本文中的Doc.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。