JavaScript 和 .NET 中的 JavaScript Object Notation (JSON) 简介
http://msdn.microsoft.com/zh-cn/library/bb299886.aspx#intro_to_json_topic5
如题
已经找到解决方法,一直没时间传上来和大家分享一下,
使用的是itextsharp
/// <summary>
/// 合并PDF文件
/// </summary>
/// <param name="lstFiles">要合并的文件列表</param>
/// <returns></returns>
private bool MergePDF(List<string> lstFiles)
{
bool bReturn = false;
try
{
int f = 1;
PdfReader reader = new PdfReader(lstFiles[f]);
int n = reader.NumberOfPages;
Document document = new Document(reader.GetPageSizeWithRotation(1));
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(lstFiles[0], FileMode.Create));
document.Open();
PdfContentByte cb = writer.DirectContent;
PdfImportedPage page;
int rotation;
while (f < lstFiles.Count)
{
int i = 0;
while (i < n)
{
i++;
document.SetPageSize(reader.GetPageSizeWithRotation(i));
document.NewPage();
page = writer.GetImportedPage(reader, i);
rotation = reader.GetPageRotation(i);
if (rotation == 90 || rotation == 270)
{
cb.AddTemplate(page, 0, -1f, 1f, 0, 0, reader.GetPageSizeWithRotation(i).Height);
}
else
{
cb.AddTemplate(page, 1f, 0, 0, 1f, 0, 0);
}
}
f++;
if (f < lstFiles.Count)
{
reader = new PdfReader(lstFiles[f]);
n = reader.NumberOfPages;
}
}
document.Close();
bReturn = true;
}
catch
{
bReturn = false;
}
return bReturn;
}
}
ReportDocument rptDocument;
rptDocument.SetDataSource(myDS);
CrystalDecisions.Shared.ReportPageRequestContext rprc
= new CrystalDecisions.Shared.ReportPageRequestContext();
int totalPCount = rptDocument.FormatEngine.GetLastPageNumber(rprc);
<!--
//学习一下如何利用js来操作cookie
//写入 cookie
//不区分 cookieName 的大小写
//不考虑子键
function WriteCookies(cookieName, cookieValue, expires)
{
if (expires)
{
//指定了 expires
document.cookie =
WriteCookies_GetCookieName(cookieName) + "=" + escape(cookieValue)
+ "; expires=" + xpires.toGMTString();
}
else
{
document.cookie = WriteCookies_GetCookieName(cookieName) + "=" + escape(cookieValue);
}
}
//获取并返回与 cookieName 同名的 cookie 名称,允许大小写不同
//如果不存在这样的 cookie,就返回 cookieName
function WriteCookies_GetCookieName(cookieName)
{
var lowerCookieName = cookieName.toLowerCase();
var cookieStr = document.cookie;
if (cookieStr == "")
{
return cookieName;
}
var cookieArr = cookieStr.split("; ");
var pos = -1;
for (var i=0; i<cookieArr.length; i++)
{
pos = cookieArr[i].indexOf("=");
if (pos > 0)
{
if (cookieArr[i].substring(0, pos).toLowerCase() == lowerCookieName)
{
return cookieArr[i].substring(0, pos);
}
}
}
return cookieName;
}
//获取并返回 cookie 值
//不区分 cookieName 的大小写
//dfltValue 为默认返回值
//不考虑子键
function ReadCookies(cookieName, dfltValue)
{
var lowerCookieName = cookieName.toLowerCase();
var cookieStr = document.cookie;
if (cookieStr == "")
{
return dfltValue;
}
var cookieArr = cookieStr.split("; ");
var pos = -1;
for (var i=0; i<cookieArr.length; i++)
{
pos = cookieArr[i].indexOf("=");
if (pos > 0)
{
if (cookieArr[i].substring(0, pos).toLowerCase() == lowerCookieName)
{
return unescape(cookieArr[i].substring(pos+1, cookieArr[i].length));
}
}
}
return dfltValue;
}
//test all the oper
document.write("写入名称为 cv 的 cookie...<br>");
WriteCookies("test", "test123", null);
document.write("写入名称为 Ab,带失效日期的 cookie...<br>");
var expires = new Date("December 11, 2010");
WriteCookies("singleblue", "test234", expires);
document.write("读取名称为 singleblue 的 cookie..." + ReadCookies("ab", ""));
-->
如题,也可以用现今较为流行的js框架来实现,会较为简单,现今的js框架大多数都有封装好支持多种浏览器的创建方式
var xmlHttp = false;
/*@cc_on @*/
/*@if(@_jscript_version>=5)
try
{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e2)
{
xmlHttp= false;
}
}
@end @*/
if(!xmlHttp && typeof XMLHttpRequest != 'undefined')
xmlHttp = new XMLHttpRequest();