string filename = DateTime.Now.ToString("yyyyMMddHHmmss").ToString() + ".pdf";
站在用戶的角度思考問題,與客戶深入溝通,找到埇橋區(qū)網(wǎng)站設(shè)計(jì)與埇橋區(qū)網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類型包括:成都做網(wǎng)站、成都網(wǎng)站設(shè)計(jì)、成都外貿(mào)網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、域名注冊、雅安服務(wù)器托管、企業(yè)郵箱。業(yè)務(wù)覆蓋埇橋區(qū)地區(qū)。
float w = PageSize.A4.Width;
float h = PageSize.A4.Height;
Rectangle rect = new Rectangle(0, 0, w, 3 * h);
Document document = new Document(rect);
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(Server.MapPath(filename), FileMode.Create));
Rectangle crop = new Rectangle(0, 2 * h, w, 3 * h);
writer.CropBoxSize = crop;
document.Open();
PdfContentByte content = writer.DirectContent;
PdfTemplate template = content.CreateTemplate(rect.Width, rect.Height);
template.SaveState();
template.SetColorFill(Color.RED);
template.Rectangle(0, 0, w, h);
template.FillStroke();
template.RestoreState();
template.SaveState();
template.SetColorFill(Color.BLUE);
template.Rectangle(0, h, w, h);
template.FillStroke();
template.RestoreState();
template.SaveState();
template.SetColorFill(Color.BLACK);
template.Rectangle(0, 2 * h, w, h/2 );
template.FillStroke();
template.RestoreState();
content.AddTemplate(template, 1, 0, 0, -1, 0, rect.Height);
crop = new Rectangle(0, h, w, 2 * h);
writer.CropBoxSize = crop;
document.NewPage();
content.AddTemplate(template, 1, 0, 0, -1, 0, rect.Height);
crop = new Rectangle(0, 0, w, h);
writer.CropBoxSize = crop;
document.NewPage();
content.AddTemplate(template, 1, 0, 0, -1, 0, rect.Height);
document.Close();