Did not resolve signature does not come in , not even a red X as if missing file.
Kevin N. Ingalls LTC, OD chief Manager
|
|
|
private byte[] Report(Stream objStream)
{
Pdf pdf1 = null;
try
{
pdf1 = new Pdf();
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
pdf1.HtmlInfo.PageHeight = PageSize.A4Height;
pdf1.HtmlInfo.PageWidth = PageSize.A4Width;
pdf1.HtmlInfo.Margin.Left = 20;
pdf1.HtmlInfo.Margin.Right= 20;
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();
//Add the image into paragraphs collection of the section
image1.ImageInfo.ImageFileType = ImageFileType.Jpeg;
image1.ImageInfo.ImageStream = objStream;
image1.ImageInfo.File = "/images/sigs/";
pdf1.HtmlInfo.ImgUrl = "/images/sigs/";
pdf1.IsAutoFontAdjusted = true;
pdf1.DefaultFontName = "Times New Roman";
pdf1.BindHTML(objStream);
}
catch (Exception e)
{
Response.Write("Report(): " + e.Message);
Response.End();
}
if (pdf1 != null)
return pdf1.GetBuffer();
return null;
}
private MemoryStream CreateHTMLStream()
{
string strOrderText = string.Empty;
MemoryStream objStream = null;
try
{
string theURL = Request.QueryString["url"];
string orderid = Request.QueryString["id"];
string conusaorder = Request.QueryString["conusaorder"];
string strParentDirectory = Request.ApplicationPath.ToString().ToLower();
string strImagePath = "/images/sigs/";
string strDataImagePath = strParentDirectory + strImagePath;
string strPath = Request.Url.AbsoluteUri.ToString().ToLower();
strParentDirectory = strPath.Substring(0, strPath.IndexOf(strParentDirectory, 0)) + strParentDirectory;
strImagePath = strParentDirectory + strImagePath;
strOrderText = GetOrderText(conusaorder, int.Parse(orderid));
//remove the following for formating
string[] strChunksArray = new string[] {
"
| ",
"
| ",
"
| ",
"
| "
};
foreach (string strItem in strChunksArray)
strOrderText = strOrderText.Replace(strItem, "");
string sdoctype ="";
string sdoctypeOld="";
sdoctype= " XHTML 1.0 Transitional//EN ";
sdoctype +="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
sdoctypeOld ="DTD HTML 4.0 Transitional"+"//EN";
sdoctypeOld +='"';
strOrderText = strOrderText.Replace(sdoctypeOld,sdoctype);
string sTemp = "
";
strOrderText = strOrderText.Replace(sTemp, "
"); //size=\"-2\"
sTemp = "
";
strOrderText = strOrderText.Replace(sTemp, " ");
sTemp = "
";
int iStart = strOrderText.IndexOf(sTemp.ToString());
strOrderText = strOrderText.Replace("/conusa_test", "/conusa");
sTemp = "
";
iStart = strOrderText.IndexOf(sTemp);
strOrderText = strOrderText.Remove(iStart + 3, sTemp.Length - 3 - 1);
objStream = new MemoryStream(ASCIIEncoding.UTF8.GetBytes(strOrderText));
}
catch (Exception ex)
{
Response.Write("CreateHTMLStream(): " + ex.Message);
Response.End();
}
return objStream;
}
protected void Page_Load(object sender, System.EventArgs e)
{
string strTemp;
Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense(AppDomain.CurrentDomain.BaseDirectory + @"\Aspose.Total.lic");
// TableDemo3();
// return;
// CreateHTMLFile();
MemoryStream objHTMLStream = CreateHTMLStream(); //CreateHTMLStream();
// StreamPDF(objHTMLStream);
strTemp = "File created | ";
try
{
byte[] theData = Report(objHTMLStream);
strTemp += "Report Complete | ";
Response.ContentType = "application/pdf";
Response.Charset = "UTF-8";
strTemp += "1 | ";
// string newfilename = "Output";
string newfilename = m_strFileName;
if (Request.Browser.Browser.ToString() == "IE")
Response.AddHeader("content-disposition", "attachment; filename=" + newfilename + ".PDF");
else
Response.AddHeader("content-disposition", "attachment; filename=\"" + newfilename + "\".PDF");
strTemp += "2 | ";
Response.AddHeader("content-length", theData.Length.ToString());
Response.BinaryWrite(theData);
strTemp += "3 | ";
}
catch (Exception ex)
{
Response.Write("Page_Load(): " + strTemp + ex.Message);
Response.End();
}
DeleteHTMLFile();
}
|