本文整理汇总了C#中iTextSharp.text.Chunk.setLocalDestination方法的典型用法代码示例。如果您正苦于以下问题:C# Chunk.setLocalDestination方法的具体用法?C# Chunk.setLocalDestination怎么用?C# Chunk.setLocalDestination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.Chunk
的用法示例。
在下文中一共展示了Chunk.setLocalDestination方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getPDF
public bool getPDF(ref MemoryStream mem, int quoteId, out string filename)
{
filename = "";
bool pass = false;
try
{
setDT(quoteId);
row = dt.Rows[0];
string extnumber = row["ExtNumber"].ToString();
if (row["ExtNumber"].ToString().IndexOf('-') > 0)
{
extnumber=row["ExtNumber"].ToString().Substring(0, row["ExtNumber"].ToString().IndexOf('-'));
}
filename = row["OEM"].ToString() + "_" +extnumber + "_" + row["CustomerPartNumber"].ToString().Trim();
filename = filename.Replace("\"", "").Replace("'", "").Replace(";", "").Replace(":", "") + "_" + DateTime.Now.ToString("mmssffff");
//filename = HttpUtility.HtmlEncode(filename) + "_"+DateTime.Now.ToString("mmss");///.Minute.ToString() + DateTime.Now.Second.ToString();
if (dt.Rows.Count > 0)
{
pass = true;
init();
PdfWriter writer = PdfWriter.getInstance(doc, mem);
doc.Open();
addHeader();
part1();
part2();
part3();
part4();
part5();
PdfContentByte cb = writer.DirectContent;
ColumnText ct1 = new ColumnText(cb);
ColumnText ct2 = new ColumnText(cb);
ColumnText ct3 = new ColumnText(cb);
Phrase p1 = new Phrase(10f, "Multek Warranty T&C ",pageFont());
Phrase p2 = new Phrase(10f, "1",pageFont());
Phrase p3 = new Phrase(10f, "Rev. B 11/10/2011",pageFont());
ct1.setSimpleColumn(p1, 65f, 35f, 595f, 0f,10f, Element.ALIGN_LEFT);
ct2.setSimpleColumn(p2, 380f, 35f, 240f, 0f, 10f, Element.ALIGN_CENTER);
ct3.setSimpleColumn(p3, 530f, 35f, 65f, 0f, 10f, Element.ALIGN_RIGHT);
//ct2.setSimpleColumn(p1, 300f, 36.23f, 363.22f, 36.23f, 10f, Element.ALIGN_CENTER);
//ct2.setSimpleColumn(p2, 350.22f, 36.23f, 239.22f, 36.23f, 10f, Element.ALIGN_CENTER);
//ct3.setSimpleColumn(p3, 550.02f, 36.23f, 510f, 36.23f,10f, Element.ALIGN_RIGHT);
//ct.SetSimpleColumn(dd,25,50,50,500,10,Element.ALIGN_CENTER);
ct1.go();
ct2.go();
ct3.go();
string file = HttpContext.Current.Server.MapPath("~/tmp/template_1.pdf");
PdfReader reader = new PdfReader(file);
for (int i = 2; i < reader.NumberOfPages + 1; i++)
{
doc.setPageSize(reader.getPageSizeWithRotation(1));
doc.newPage();
if (i == 1)
{
Chunk fileref = new Chunk(" ");
fileref.setLocalDestination(file);
doc.Add(fileref);
}
PdfImportedPage p = writer.getImportedPage(reader, i);
cb.addTemplate(p, 1f, 0, 0, 1f, 0, 0);
}
doc.Close();
}
dt.Dispose();
}
catch (Exception ex)
{
message = ex.ToString();
// throw ex;
}
finally
{
dt.Dispose();
}
return pass;
}