本文整理汇总了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();
}
示例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);
//.........这里部分代码省略.........