本文整理匯總了C#中iTextSharp.text.Paragraph.SetAccessibleAttribute方法的典型用法代碼示例。如果您正苦於以下問題:C# Paragraph.SetAccessibleAttribute方法的具體用法?C# Paragraph.SetAccessibleAttribute怎麽用?C# Paragraph.SetAccessibleAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.Paragraph
的用法示例。
在下文中一共展示了Paragraph.SetAccessibleAttribute方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: 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");
}