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


C# Chunk.SetAccessibleAttribute方法代码示例

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


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

示例1: CreateTaggedPdf8

        public void CreateTaggedPdf8() {
            InitializeDocument("8");

            ColumnText columnText = new ColumnText(writer.DirectContent);

            List list = new List(true);
            try {
                list = new List(true);
                ListItem listItem =
                    new ListItem(
                        new Chunk(
                            "Quick brown fox jumped over a lazy dog. A very long line appears here because we need new line."));
                list.Add(listItem);
                Image i = Image.GetInstance(RESOURCES + "img\\fox.bmp");
                Chunk c = new Chunk(i, 0, 0);
                c.SetAccessibleAttribute(PdfName.ALT, new PdfString("Fox image"));
                listItem = new ListItem(c);
                list.Add(listItem);
                listItem = new ListItem(new Chunk("jumped over a lazy"));
                list.Add(listItem);
                i = Image.GetInstance(RESOURCES + "img\\dog.bmp");
                c = new Chunk(i, 0, 0);
                c.SetAccessibleAttribute(PdfName.ALT, new PdfString("Dog image"));
                listItem = new ListItem(c);
                list.Add(listItem);
                listItem = new ListItem(new Paragraph(text));
                list.Add(listItem);
            }
            catch (Exception) {
            }
            columnText.SetSimpleColumn(36, 36, 400, 800);
            columnText.AddElement(h1);
            columnText.AddElement(list);
            columnText.Go();
            document.NewPage();
            columnText.SetSimpleColumn(36, 36, 400, 800);
            columnText.Go();
            document.Close();

            int[] nums = new int[] {64, 35};
            CheckNums(nums);
            CompareResults("8");
        }
开发者ID:,项目名称:,代码行数:43,代码来源:

示例2: CreateTaggedPdf7

        public void CreateTaggedPdf7() {
            InitializeDocument("7");
            List list = new List(true);
            try {
                list = new List(true);
                ListItem listItem =
                    new ListItem(
                        new Chunk(
                            "Quick brown fox jumped over a lazy dog. A very long line appears here because we need new line."));
                list.Add(listItem);
                Image i = Image.GetInstance(RESOURCES + "img\\fox.bmp");
                Chunk c = new Chunk(i, 0, 0);
                c.SetAccessibleAttribute(PdfName.ALT, new PdfString("Fox image"));
                listItem = new ListItem(c);
                list.Add(listItem);
                listItem = new ListItem(new Chunk("jumped over a lazy"));
                list.Add(listItem);
                i = Image.GetInstance(RESOURCES + "img\\dog.bmp");
                c = new Chunk(i, 0, 0);
                c.SetAccessibleAttribute(PdfName.ALT, new PdfString("Dog image"));
                listItem = new ListItem(c);
                list.Add(listItem);
                listItem = new ListItem(new Paragraph(text));
                list.Add(listItem);
            }
            catch (Exception) {
            }
            document.Add(h1);
            document.Add(list);
            document.Close();

            int[] nums = new int[] {63, 14};
            CheckNums(nums);
            CompareResults("7");
        }
开发者ID:,项目名称:,代码行数:35,代码来源:

示例3: CreateTaggedPdf24

        public virtual void CreateTaggedPdf24() {
            Document document = new Document(PageSize.LETTER);

            MemoryStream baos = new MemoryStream();

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

            writer.ViewerPreferences = PdfWriter.DisplayDocTitle;

//set more document properties

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

            writer.CreateXmpMetadata();


// step 3

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

// step 4

            Paragraph p = new Paragraph("Paragraph testing testing");
            p.SetAccessibleAttribute(PdfName.ACTUALTEXT, new PdfString("Paragraph ALT Text"));
            p.SetAccessibleAttribute(PdfName.ALT, new PdfString("Paragraph ALT Text"));
            document.Add(p);


            Chunk ck = new Chunk("Span testing testing", FontFactory.GetFont(RESOURCES + @"..\FreeMonoBold.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED, 12));
            ck.SetAccessibleAttribute(PdfName.ACTUALTEXT, new PdfString("Span ALT Text"));
            ck.SetAccessibleAttribute(PdfName.ALT, new PdfString("Span ALT Text"));
            p = new Paragraph(ck);

            document.Add(p);

// step 5
            document.Close();

            FileStream fos = new FileStream("TaggedPdfTest/pdf/out24.pdf", FileMode.Create);

            byte[] buff = baos.ToArray();
            fos.Write(buff, 0, buff.Length);

            fos.Flush();

            fos.Close();
            CompareResults("24");
        }
开发者ID:,项目名称:,代码行数:53,代码来源:

示例4: CreateTaggedPdf4

        public void CreateTaggedPdf4() {
            InitializeDocument("4");
            Paragraph p = new Paragraph();
            PdfName nParagraph = new PdfName("Paragraph");
            p.Role = nParagraph;
            writer.StructureTreeRoot.MapRole(nParagraph, PdfName.P);

            try {
                Chunk c = new Chunk("Quick brown ");
                PdfName nTextBlock = new PdfName("TextBlock");
                c.Role = nTextBlock;
                writer.StructureTreeRoot.MapRole(nTextBlock, PdfName.SPAN);
                p.Add(c);
                Image i = Image.GetInstance(RESOURCES + "img\\fox.bmp");
                c = new Chunk(i, 0, 0);
                PdfName nImage = new PdfName("Image");
                c.Role = nImage;
                writer.StructureTreeRoot.MapRole(nImage, PdfName.FIGURE);
                c.SetAccessibleAttribute(PdfName.ALT, new PdfString("Fox image"));
                p.Add(c);
                p.Add(new Chunk(" jumped over a lazy "));
                i = Image.GetInstance(RESOURCES + "img\\dog.bmp");
                c = new Chunk(i, 0, 0);
                c.SetAccessibleAttribute(PdfName.ALT, new PdfString("Dog image"));
                p.Add(c);
            }
            catch (Exception) {
            }
            document.Add(h1);
            document.Add(p);
            document.Close();
            int[] nums = new int[] {7};
            CheckNums(nums);
            CompareResults("4");
        }
开发者ID:,项目名称:,代码行数:35,代码来源:

示例5: createPdf

        /**
         * Creates an accessible PDF with images and text.
         */
        public void createPdf(String dest)
        {
            Document document = new Document(PageSize.A4.Rotate());
            PdfWriter writer = PdfWriter.GetInstance(document, File.OpenRead(dest));
            writer.PdfVersion = PdfWriter.VERSION_1_7;
            //TAGGED PDF
            //Make document tagged
            writer.SetTagged();
            //===============
            //PDF/UA
            //Set document metadata
            writer.ViewerPreferences = PdfWriter.DisplayDocTitle;
            document.AddLanguage("en-US");
            document.AddTitle("English pangram");
            writer.CreateXmpMetadata();
            //=====================
            document.Open();

            Paragraph p = new Paragraph();
            //PDF/UA
            //Embed font
            Font font = FontFactory.GetFont(FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 20);
            p.Font = font;
            //==================
            Chunk c = new Chunk("The quick brown ");
            p.Add(c);
            Image i = Image.GetInstance(FOX);
            c = new Chunk(i, 0, -24);
            //PDF/UA
            //Set alt text
            c.SetAccessibleAttribute(PdfName.ALT, new PdfString("Fox"));
            //==============
            p.Add(c);
            p.Add(new Chunk(" jumps over the lazy "));
            i = Image.GetInstance(DOG);
            c = new Chunk(i, 0, -24);
            //PDF/UA
            //Set alt text
            c.SetAccessibleAttribute(PdfName.ALT, new PdfString("Dog"));
            //==================
            p.Add(c);
            document.Add(p);

            p = new Paragraph("\n\n\n\n\n\n\n\n\n\n\n\n", font);
            document.Add(p);
            List list = new List(true);
            list.Add(new ListItem("quick", font));
            list.Add(new ListItem("brown", font));
            list.Add(new ListItem("fox", font));
            list.Add(new ListItem("jumps", font));
            list.Add(new ListItem("over", font));
            list.Add(new ListItem("the", font));
            list.Add(new ListItem("lazy", font));
            list.Add(new ListItem("dog", font));
            document.Add(list);
            document.Close();
        }
开发者ID:sensusaps,项目名称:RoboBraille.Web.API,代码行数:60,代码来源:DacChecker.cs


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