当前位置: 首页>>代码示例>>C#>>正文


C# Document.SetAccessibleAttribute方法代码示例

本文整理汇总了C#中iTextSharp.text.Document.SetAccessibleAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# Document.SetAccessibleAttribute方法的具体用法?C# Document.SetAccessibleAttribute怎么用?C# Document.SetAccessibleAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iTextSharp.text.Document的用法示例。


在下文中一共展示了Document.SetAccessibleAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateTagedPdf25

        public virtual void CreateTagedPdf25() {
            Document document = new Document();
            MemoryStream baos = new MemoryStream();

            PdfWriter writer = PdfWriter.GetInstance(document, baos);

            writer.ViewerPreferences = PdfWriter.DisplayDocTitle;

            writer.PdfVersion = PdfWriter.VERSION_1_7;
            writer.SetTagged();
            PdfDictionary info = writer.Info;
            info.Put(PdfName.TITLE, new PdfString("Testing"));
            writer.CreateXmpMetadata();

            document.Open();
            document.AddLanguage("en_US");
            document.SetAccessibleAttribute(PdfName.LANG, new PdfString("en_US"));

            string longParagraphString = "Long teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeext Paragraph testing testing";
            BaseFont bFont = BaseFont.CreateFont(RESOURCES + @"..\FreeMonoBold.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED);
            Font font = new Font(bFont, 12);
            Paragraph p = new Paragraph(longParagraphString, font);
            document.Add(p);

            string longChunkString = "Long teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeext Span testing testing";
            Chunk ck = new Chunk(longChunkString, font);
            p = new Paragraph(ck);
            document.Add(p);

            document.Close();
            FileStream fos = new FileStream("TaggedPdfTest/pdf/out25.pdf", FileMode.Create);
            byte[] buff = baos.ToArray();
            fos.Write(buff, 0, buff.Length);
            fos.Flush();
            fos.Close();
            CompareResults("25");

            CompareTool compareTool = new CompareTool();
            string cmpFile = RESOURCES + @"out25.pdf";
            string errorMessage = compareTool.CompareByContent("TaggedPdfTest/pdf/out25.pdf", cmpFile,
                "TaggedPdfTest/pdf/", "diff_");
            if (errorMessage != null) {
                Assert.Fail(errorMessage);
            }

        }
开发者ID:newlysoft,项目名称:itextsharp,代码行数:46,代码来源:TaggedPdfTest.cs


注:本文中的iTextSharp.text.Document.SetAccessibleAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。