We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Using TextAlign in accessible PDFs

Hi,

Can anyone help me with using Aspose.Pdf.LogicalStructure.AttributeKey.TextAlign to set the horizontal alignment of ParagraphElement in an accessible PDF ?

Thanks

@dushanrs

Would you please share the complete code snippet that you have tried so far along with a sample expected output PDF so that we can try to generate similar PDF while testing the scenario in our environment and share our feedback with you accordingly.

This is a code sample from the Aspose documentation. How do you center or align the text of
paragraphElement ?

private static void CreateTaggedPdfDocument01()
{
    // Create PDF Document
    var document = new Document();

    // Get Content for work with TaggedPdf
    ITaggedContent taggedContent = document.TaggedContent;
    var rootElement = taggedContent.RootElement;
    // Set Title and Language for Document
    taggedContent.SetTitle("Tagged Pdf Document");
    taggedContent.SetLanguage("en-US");

    // 
    HeaderElement mainHeader = taggedContent.CreateHeaderElement();
    mainHeader.SetText("Main Header");

    ParagraphElement paragraphElement = taggedContent.CreateParagraphElement();
    paragraphElement.SetText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. " +
    "Aenean nec lectus ac sem faucibus imperdiet. Sed ut erat ac magna ullamcorper hendrerit. " +
    "Cras pellentesque libero semper, gravida magna sed, luctus leo. Fusce lectus odio, laoreet" +
    "nec ullamcorper ut, molestie eu elit. Interdum et malesuada fames ac ante ipsum primis in faucibus." +
    "Aliquam lacinia sit amet elit ac consectetur. Donec cursus condimentum ligula, vitae volutpat" +
    "sem tristique eget. Nulla in consectetur massa. Vestibulum vitae lobortis ante. Nulla ullamcorper" +
    "pellentesque justo rhoncus accumsan. Mauris ornare eu odio non lacinia. Aliquam massa leo, rhoncus" +
    "ac iaculis eget, tempus et magna. Sed non consectetur elit. Sed vulputate, quam sed lacinia luctus," +
    "ipsum nibh fringilla purus, vitae posuere risus odio id massa. Cras sed venenatis lacus.");

    rootElement.AppendChild(mainHeader);
    rootElement.AppendChild(paragraphElement);

    // Save Tagged Pdf Document
    document.Save("C:\\Samples\\TaggedPDF\\Sample1.pdf");
}

@dushanrs

Unfortunately, this area of the functionality needs more investigation at our end and it needs to be properly documented as well. For the sake, a task has been logged in our issue tracking system.

Issue ID(s): PDFNET-53571

We have linked the task with this forum thread so that you will receive a notification as soon as it is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.