public static void Run() { // ExStart:CreateStructureElements // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments(); // Create Pdf Document Document document = new Document(); // Get Content for work with TaggedPdf ITaggedContent taggedContent = document.TaggedContent; // Set Title and Language for Documnet taggedContent.SetTitle("Tagged Pdf Document"); taggedContent.SetLanguage("en-US"); // Create Grouping Elements PartElement partElement = taggedContent.CreatePartElement(); ArtElement artElement = taggedContent.CreateArtElement(); SectElement sectElement = taggedContent.CreateSectElement(); DivElement divElement = taggedContent.CreateDivElement(); BlockQuoteElement blockQuoteElement = taggedContent.CreateBlockQuoteElement(); CaptionElement captionElement = taggedContent.CreateCaptionElement(); TOCElement tocElement = taggedContent.CreateTOCElement(); TOCIElement tociElement = taggedContent.CreateTOCIElement(); IndexElement indexElement = taggedContent.CreateIndexElement(); NonStructElement nonStructElement = taggedContent.CreateNonStructElement(); PrivateElement privateElement = taggedContent.CreatePrivateElement(); // Create Text Block-Level Structure Elements ParagraphElement paragraphElement = taggedContent.CreateParagraphElement(); HeaderElement headerElement = taggedContent.CreateHeaderElement(); HeaderElement h1Element = taggedContent.CreateHeaderElement(1); // Create Text Inline-Level Structure Elements SpanElement spanElement = taggedContent.CreateSpanElement(); QuoteElement quoteElement = taggedContent.CreateQuoteElement(); NoteElement noteElement = taggedContent.CreateNoteElement(); // Create Illustration Structure Elements FigureElement figureElement = taggedContent.CreateFigureElement(); FormulaElement formulaElement = taggedContent.CreateFormulaElement(); // Methods are under development ListElement listElement = taggedContent.CreateListElement(); TableElement tableElement = taggedContent.CreateTableElement(); ReferenceElement referenceElement = taggedContent.CreateReferenceElement(); BibEntryElement bibEntryElement = taggedContent.CreateBibEntryElement(); CodeElement codeElement = taggedContent.CreateCodeElement(); LinkElement linkElement = taggedContent.CreateLinkElement(); AnnotElement annotElement = taggedContent.CreateAnnotElement(); RubyElement rubyElement = taggedContent.CreateRubyElement(); WarichuElement warichuElement = taggedContent.CreateWarichuElement(); FormElement formElement = taggedContent.CreateFormElement(); // Save Tagged Pdf Document document.Save(dataDir + "StructureElements.pdf"); // ExEnd:CreateStructureElements }
public static void Run() { // ExStart:StructureElementsProperties // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments(); // Create Pdf Document Document document = new Document(); // Get Content for work with TaggedPdf ITaggedContent taggedContent = document.TaggedContent; // Set Title and Language for Documnet taggedContent.SetTitle("Tagged Pdf Document"); taggedContent.SetLanguage("en-US"); // Create Structure Elements StructureElement rootElement = taggedContent.RootElement; SectElement sect = taggedContent.CreateSectElement(); rootElement.AppendChild(sect); HeaderElement h1 = taggedContent.CreateHeaderElement(1); sect.AppendChild(h1); h1.SetText("The Header"); h1.Title = "Title"; h1.Language = "en-US"; h1.AlternativeText = "Alternative Text"; h1.ExpansionText = "Expansion Text"; h1.ActualText = "Actual Text"; // Save Tagged Pdf Document document.Save(dataDir + "StructureElementsProperties.pdf"); // ExEnd:StructureElementsProperties }
public static void Run() { // ExStart:CustomTagName // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments(); // Create Pdf Document Document document = new Document(); // Get Content for work with TaggedPdf ITaggedContent taggedContent = document.TaggedContent; // Set Title and Language for Documnet taggedContent.SetTitle("Tagged Pdf Document"); taggedContent.SetLanguage("en-US"); // Create Logical Structure Elements SectElement sect = taggedContent.CreateSectElement(); taggedContent.RootElement.AppendChild(sect); ParagraphElement p1 = taggedContent.CreateParagraphElement(); ParagraphElement p2 = taggedContent.CreateParagraphElement(); ParagraphElement p3 = taggedContent.CreateParagraphElement(); ParagraphElement p4 = taggedContent.CreateParagraphElement(); p1.SetText("P1. "); p2.SetText("P2. "); p3.SetText("P3. "); p4.SetText("P4. "); p1.SetTag("P1"); p2.SetTag("Para"); p3.SetTag("Para"); p4.SetTag("Paragraph"); sect.AppendChild(p1); sect.AppendChild(p2); sect.AppendChild(p3); sect.AppendChild(p4); SpanElement span1 = taggedContent.CreateSpanElement(); SpanElement span2 = taggedContent.CreateSpanElement(); SpanElement span3 = taggedContent.CreateSpanElement(); SpanElement span4 = taggedContent.CreateSpanElement(); span1.SetText("Span 1."); span2.SetText("Span 2."); span3.SetText("Span 3."); span4.SetText("Span 4."); span1.SetTag("SPAN"); span2.SetTag("Sp"); span3.SetTag("Sp"); span4.SetTag("TheSpan"); p1.AppendChild(span1); p2.AppendChild(span2); p3.AppendChild(span3); p4.AppendChild(span4); // Save Tagged Pdf Document document.Save(dataDir + "CustomTag.pdf"); // ExEnd:CustomTagName }
public static void Run() { // ExStart:CreateStructureElementsTree // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments(); // Create Pdf Document Document document = new Document(); // Get Content for work with TaggedPdf ITaggedContent taggedContent = document.TaggedContent; // Set Title and Language for Documnet taggedContent.SetTitle("Tagged Pdf Document"); taggedContent.SetLanguage("en-US"); // Get root structure element (Document) StructureElement rootElement = taggedContent.RootElement; // Create Logical Structure SectElement sect1 = taggedContent.CreateSectElement(); rootElement.AppendChild(sect1); SectElement sect2 = taggedContent.CreateSectElement(); rootElement.AppendChild(sect2); DivElement div11 = taggedContent.CreateDivElement(); sect1.AppendChild(div11); DivElement div12 = taggedContent.CreateDivElement(); sect1.AppendChild(div12); ArtElement art21 = taggedContent.CreateArtElement(); sect2.AppendChild(art21); ArtElement art22 = taggedContent.CreateArtElement(); sect2.AppendChild(art22); DivElement div211 = taggedContent.CreateDivElement(); art21.AppendChild(div211); DivElement div212 = taggedContent.CreateDivElement(); art21.AppendChild(div212); DivElement div221 = taggedContent.CreateDivElement(); art22.AppendChild(div221); DivElement div222 = taggedContent.CreateDivElement(); art22.AppendChild(div222); SectElement sect3 = taggedContent.CreateSectElement(); rootElement.AppendChild(sect3); DivElement div31 = taggedContent.CreateDivElement(); sect3.AppendChild(div31); // Save Tagged Pdf Document document.Save(dataDir + "StructureElementsTree.pdf"); // ExEnd:CreateStructureElementsTree }