net系统开发示例代码(编辑修改稿)内容摘要:

Stream(, ))。 // step 3: we open the document ()。 // step 4: we Add some paragraphs to the document for (int i = 0。 i 5。 i++) { (new Paragraph(Hello World))。 } } catch(DocumentException de) { ()。 6 } catch(IOException ioe) { ()。 } // step 5: we close the document ()。 } } 7 示例代码 0103 using System。 using。 using。 using。 using。 public class Chap0103 { public static void Main() { (Chapter 1 example 3: PageSize)。 // step 1: creation of a documentobject Document document = new Document(())。 try { // step 2: // we create a writer that listens to the document // and directs a PDFstream to a file (document, new FileStream(, ))。 // step 3: we open the document ()。 // step 4: we add some phrases to the document for (int i = 0。 i 20。 i++) { (new Phrase(Hello World, Hello Sun, Hello Moon, Hello Stars, Hello Sea, Hello Land, Hello People. ))。 } } catch(DocumentException de) { ()。 8 } catch(IOException ioe) { ()。 } // step 5: we close the document ()。 } } 9 示例代码 0104 using System。 using。 using。 using。 using。 public class Chap0104 { public static void Main() { (Chapter 1 example 4: Margins)。 // step 1: creation of a documentobject Document document = new Document(, 36, 72, 108, 180)。 try { // step 2: // we create a writer that listens to the document // and directs a PDFstream to a file (document, new FileStream(, ))。 // step 3: we open the document ()。 // step 4: we Add a paragraph to the document Paragraph paragraph = new Paragraph()。 =。 for (int i = 0。 i 20。 i++) { (Hello World, Hello Sun, Hello Moon, Hello Stars, Hello Sea, Hello Land, Hello People. )。 } (paragraph)。 } 10 catch(DocumentException de) { ()。 } catch(IOException ioe) { ()。 } // step 5: we close the document ()。 } } 11 示例代码 0105 using System。 using。 using。 using。 using。 using。 using。 using。 using。 using。 using。 using。 using。 /// summary /// Summary description for Chap0501. /// /summary public class Chap0501 : { private void Page_Load(object sender, e) { // step 1 // need to write to memory first due to IE wanting // to know the length of the pdf beforehand MemoryStream m = new MemoryStream()。 Document document = new Document()。 try { // step 2: we set the ContentType and create an instance of the Writer = application/pdf。 (document, m)。 // step 3 ()。 // step 4 (new Paragraph(()))。 } catch (DocumentException ex) { 12 ()。 ()。 } // step 5: Close document ()。 // step 6: Write pdf bytes to outputstream ((), 0, ().Length)。 ()。 ()。 } region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the Web Form Designer. // InitializeComponent()。 (e)。 } /// summary /// Required method for Designer support do not modify /// the contents of this method with the code editor. /// /summary private void InitializeComponent() { += new ()。 } endregion } 13 示例代码 0106 using System。 using。 using。 using。 public class Chap0106 { public static void Main() { (Chapter 1 example 6: Meta Information)。 // step 1: creation of a documentobject Document document = new Document()。 try { // step 2: // we create a writer that listens to the document // and directs a PDFstream to a file (document, new FileStream(, ))。 // step 3: we add some metadata and open the document (Hello World example)。 (This example explains step 6 in Chapter 1)。 (Metadata, iText, step 6, tutorial)。 (My program using iText)。 (Bruno Lowagie)。 (Expires, 0)。 ()。 // step 4: we add a paragraph to the document (new Paragraph(Hello World))。 } 14 catch(DocumentException de) { ()。 } catch(IOException ioe) { ()。 } // step 5: we close the document ()。 } } 15 示例代码 0107 using System。 using。 using。 using。 public class Chap0107 { public static void Main() { (Chapter 1 example 7: newPage())。 // step 1: creation of a documentobject Document document = new Document()。 try { // step 2: // we create a writer that listens to the document // and directs a PDFstream to a file (document, new FileStream(, ))。 // step 3: // we Add a Watermark that will show up on PAGE 1 try { Watermark watermark = new Watermark((), 200, 420)。 (watermark)。 } catch { (Are you sure you have the file 39。 39。 in the right path?)。 } 16 // we Add a Header that will show up on PAGE 1 HeaderFooter header = new HeaderFooter(new Phrase(This is a header), false)。 = header。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。