Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Jun 17, 2024 10:02 am

I am trying to build a PDF that is accessible. One of the requirements, is that in the document structure, a link annotation is nested inside a link structure element.
I test this by using the PAC accessibility checker (you can search for "PAC 2021", it should be the first result).

The following code results in a PDF with a link, but I can't seem to do the right thing to resolve the error the PAC checker shows. It says ""Link" annotation is not nested inside a "Link" structure element".

Code: Select all
FileStream to_stream = new FileStream(@"Output\Testfile.pdf", FileMode.OpenOrCreate);

var pdf = new PdfDocument();
pdf.PageSettings.Size = PdfPageSize.A4;
pdf.PageSettings.Margins.All = 0;

string fontFileName = @"Resources\Font\Linotype - Helvetica LT Pro.ttf";
var helveticaRegular = new PdfTrueTypeFont(fontFileName, 11f);

PdfSection section = pdf.Sections.Add();
PdfPageBase page = section.Pages.Add();

var taggedContent = new PdfTaggedContent(pdf);
var documentStructure = taggedContent.StructureTreeRoot.AppendChildElement(PdfStandardStructTypes.Document);
var divStructure = documentStructure.AppendChildElement(PdfStandardStructTypes.Division);
var linkStructure = divStructure.AppendChildElement(PdfStandardStructTypes.Link);
var annotationStructure = linkStructure.AppendChildElement(PdfStandardStructTypes.Annotation);
annotationStructure.Title = "Annotation";
               
linkStructure.BeginMarkedContent(page);

var text = "Text";
var destination = new PdfDestination(page, new PointF(10, 200));
var bookmark = pdf.Bookmarks.Add("bookmark");
bookmark.Action = new PdfGoToAction(destination);
var linkAnnotation = new PdfActionAnnotation(new RectangleF(10, 10, 23, 10), bookmark.Action);
linkAnnotation.Text = "Link to bookmark";
page.Annotations.Add(linkAnnotation);

PdfBrush brush = new PdfSolidBrush(new PdfRGBColor(Color.Black));
PdfUnitConvertor convertor = new PdfUnitConvertor();
page.Canvas.DrawString(text, helveticaRegular, brush, 10, 10);

linkStructure.EndMarkedContent(page);

pdf.SaveToStream(to_stream);
pdf.Close();


Can you tell me how I can nest the link annotation inside the Link structure element?

berrydictu
 
Posts: 10
Joined: Fri Dec 15, 2023 12:58 pm

Tue Jun 18, 2024 6:47 am

Hello,

Thanks for your inquiry.
Regarding the issue you mentioned, I have posted it to our dev team, and they will further investigate whether it can be achieved. I will inform you in time if there is any progress. Thank you for your understanding.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 454
Joined: Mon Dec 27, 2021 2:23 am

Fri Jun 21, 2024 8:28 am

Can you tell me how long you expect the developers to take to figure some things out? Will that be hours, days, weeks?

berrydictu
 
Posts: 10
Joined: Fri Dec 15, 2023 12:58 pm

Fri Jun 21, 2024 9:21 am

Hello,

Thanks for your following up.
Regarding your issue, I have confirmed with our dev team that they have investigated the cause of the issue, but it will take time to adjust the code, and we will also need time to test it after the adjustment. Therefore, we cannot estimate the specific time at present, but if there is any progress, we will inform you as soon as possible. Thank you for your understanding.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 454
Joined: Mon Dec 27, 2021 2:23 am

Mon Jul 15, 2024 2:19 pm

Hello,

Just to check: is there an estimation of when this will be fixed yet?

In the context of accessibility, I two other questions.

1. When text is formatting with PdfTextAlignment.Justify, the text seems to lose the spaces between words. Screenreaders see a full sentence as one word and will try to read it out loud as such. Another way to see this behavior is to select and copy the text and paste it in a flat text editor like Notepad. This doesn't do good for accessibility. Is there a way to solve this?
2. How can we work with artifacts? We have a PDF that has some drawn lines and rectangles, and those should marked as an artifact. We can do that by calling something like
Code: Select all
pdfStructureElement.AppendChildItem("Artifact")
but then the element is also marked as a tag, which causes the tags to appear as invalid tags ("non-standard structure type "artifact" is neither mapped to a standard structure type nor to another non-standard structure type"). So I think the document should have a collection of tags and a collection of artifacts, which work a little different from each other. Spire doesn't seem te support this yet.

berrydictu
 
Posts: 10
Joined: Fri Dec 15, 2023 12:58 pm

Tue Jul 16, 2024 9:29 am

Hello,

Thanks for your message.
Regarding the previous "link annotation" issue, the solution our development team found previously does not work, and they are looking for a new solution. Sorry, we cannot estimate the resolution time for this issue at this time.

Regarding the first new issue you mentioned, to help us investigate further, please provide us with your test code and input files (if any), and some screenshots may help us locate your problem more quickly. Thanks in advance.

Regarding the second new issue you mentioned, we currently do not support adding "Artifacts" to elements in PDF files. I will add this as a new feature to our update list, and I will notify you as soon as it is implemented in the future.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 454
Joined: Mon Dec 27, 2021 2:23 am

Thu Jul 18, 2024 10:00 am

Regarding the disappearing spaces, we just found out that both the font and marking the content (with tags) have an effect on the outcome. I added an attachment with a piece of code to test this.

The example shows:
When we use our own font file and we mark the content in a paragraph structure, all spaces, line endings, etc. are removed from the content.
When we use basic Verdana as our font, but still mark our content in a paragraph structure, only line endings are removed from the content.
When we do not mark our content, line endings and spaces are not removed from the content, no matter which font we use.

berrydictu
 
Posts: 10
Joined: Fri Dec 15, 2023 12:58 pm

Fri Jul 19, 2024 9:53 am

Hello,

Thanks for your reply.
Could you please provide us a screenshot of your problem? Thanks a lot.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 454
Joined: Mon Dec 27, 2021 2:23 am

Fri Jul 19, 2024 2:58 pm

It is about how a screen reader reads the text out loud and how the text is structured underneath.
The best way to "see" the problem, is selecting the text in the resulting PDF file, copying it and pasting it in a text editor, for example notepad. Then, you can see that the first part of the text has absolutely no spaces or line breaks, all characters are behind each other without any spacing, like it is one word. And a screen reader reads that out loud as one word.
In the second part of the text, all line endings are removed, which concatenates every line after the previous, without a space between the words on which it breaks.
The third and fourth part have the exact same structure as the text in the PDF have.

I added a screenshot of my text editor and the result of the code i added earlier, that's all I can do, I guess.

berrydictu
 
Posts: 10
Joined: Fri Dec 15, 2023 12:58 pm

Mon Jul 22, 2024 11:15 am

Hello,

Thanks for more information.
Yes, I understand the issue you mentioned and have reproduced it. I have logged this to our tracking system with ticket SPIREPDF-6925. Our development team will investigate further and I will inform you as soon as there is any progress. Sorry for the inconvenience.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 454
Joined: Mon Dec 27, 2021 2:23 am

Wed Aug 21, 2024 7:06 am

Hello,

Could you update us on the progress of the 3 issues?
1. Link annotations in link structure elements
2. Disappearing space characters when aligning text with PdfTextAlignment.Justify
3. Supporting Artifacts

Is there another way to have some more insight in what you/the development team are planning to do, except waiting for a message on this forum?

Kind regards,
Berry de Groot

berrydictu
 
Posts: 10
Joined: Fri Dec 15, 2023 12:58 pm

Wed Aug 21, 2024 7:59 am

Hello,

Thanks for your following up.
Since customer issues are recorded in our internal tracking system, the only way to learn about the progress of problem repairs is to send us a message on the forum, and we will feedback the progress to the customer.
Regarding issue1 and issue 3, sorry, there is no breakthrough progress at present. Our dev team will further investigate and find solutions.
Regarding issue2, the latest Spire.PDF Pack (Hot Fix) Version: 10.8.1 we just released fixes this issue. Please update to test.
Web link: https://www.e-iceblue.com/Download/download-pdf-for-net-now.html
Nuget link: https://www.nuget.org/packages/Spire.PDF/

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 454
Joined: Mon Dec 27, 2021 2:23 am

Wed Aug 28, 2024 3:10 pm

Hello William,

The hot fix (10.8.1) solved issue 2! Now we wait for a solution for issue 1 an 3.

Kind regards,
Berry de Groot

berrydictu
 
Posts: 10
Joined: Fri Dec 15, 2023 12:58 pm

Fri Aug 30, 2024 6:08 am

Hello,

Thanks for your feedback.
Sorry, we have not yet found a suitable solution for issues 2 and 3. Our development team will further address thoes issues, and I will notify you as soon as there is any progress. Thank you for your understanding.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 454
Joined: Mon Dec 27, 2021 2:23 am

Mon Oct 14, 2024 11:50 am

Hello William,

Is there anything you can tell about the progress or planning on issues 2 and 3?

Kind regards,
Berry de Groot

berrydictu
 
Posts: 10
Joined: Fri Dec 15, 2023 12:58 pm

Return to Spire.PDF