PDF Link Annotation unable to tag properly? - pdf

I am trying to tag link annotation using PDFBOX, Its tagging fine(refrence code). But after tagging if I open tag properties in adobe its empty.
Next after this annotation tagging the images also throwing some error (even though alt-text is there) like
Here the error file which is the first image right side one, Please let me know what I did wrong.

Related

Inksacpe: Is it possible to add relative links for multipage navigation

I try to create a multipage pdf with navigation from one page to the other using Inkscape 1.2.
Therefore I created an object A on Page 1 and an object B on Page 2. Object B has the id myId.
It is possible to add a link to object A with the Id myId in Inkscape by defining href="#myId" in the link-properties. The link in the resulting svg-file work at least if object B sits on page 1 (as normal browsers do not display two pages from the inkscape-svg).
However it does not work in the PDF-File, saved from Inkscape. The Link seems to point to a path {directory}file:\#myId where {directory} is the directory-path of the PDF-file, that also changes when the pdf-file is moved to another path. Maybe this is a bug in Inkscape and file:\ would have to be replaced by the actual current filename. Then the link would make sense again.
I found the project svgLinkify on github. But they say it is depreciated as inkscape enabled this functionality in version 1.2.
Am I missing something?

Tagged annotation link not reading properly in PDF with JAWS?

What is the problem?
By using PDFBOX I tried to tag a link which contains annotation. The PDF creating sample code is here. I tagged a nested paragraph link by using PDFBOX. The newly created tagged PDF is passing the Adobe checker.
What I observed?
After tagging pdf I tried to read it using JAWS. But unfortunately the jaws is not reading links in both "entire document mode" and "read currently visible page" mode. Then I jumped to StructTree Root and compared with adobe created tagged PDF vs our tagged PDF. The ParentTree(NUMTree) is not matching with adobe tagged pdf.
Tagged by me
Tagged by Adobe
What I Tried?
I tried to replicate the adobe numtree in my pdf. Almost I am able to create same but except one object.
Above image left side is adobe tagged and right side is created by me. I didn't understand the adobe why it is created entire structtree under this (142 O R) object? I am adding annotation object to TumTree by using this code
private void addWidgetContent(PDObjectReference objectReference, PDStructureElement fieldElem, String type, int pageIndex) {
COSDictionary annotDict = new COSDictionary();
COSArray annotArray = new COSArray();
annotArray.add(COSInteger.get(currentMCID));
annotArray.add(objectReference);
annotDict.setItem(COSName.K, annotArray);
annotDict.setString(COSName.LANG, "EN-US");
annotDict.setItem(COSName.P, currentElem.getCOSObject());
annotDict.setItem(COSName.PG, pages.get(pageIndex).getCOSObject());
annotDict.setName(COSName.S, type);
annotDicts.add(annotDict);
setNextMarkedContentDictionary();
numDictionaries.add(annotDict);
fieldElem.appendKid(objectReference);
currentElem.appendKid(fieldElem);
}
And one more bug I saw in Adobe preflight is
How can I fix these bugs and what is the correct way of tagging link annotation to be read by JAWS? Please help me .......
I got some update to share. Now I crated parent tree root without having any bugs. Here the file tagged pdf file.
Still this tagged pdf not reading links. Why ?????????

Unable to embed a screenshot to the SpecFlow html Report

I am executing my automation scenarios using SpecFlow with Visual Studio.
I want to Embed a custom image to the HTML report which was generated by SpecFlow. That image is a screenshot i am taking whenever scenario is failed in Hooks.
Please help me out.
This is what i am seeing in the html report - enter image description here
Take a look at the SeleniumWebTest sample project here. This sample project shows how to include a screenshot in your report. While the example is Selenium-based, the same principles apply to other frameworks.
A more in-depth explanation of how this works can be found here under "Including Screenshots". Essentially, you need to abuse the console and use it to output your images' file paths.
Any data written to the console is available in your report (this is how the trace details are received by the report). You will need to parse the data written to the console and strip out the file path you want to embed. Make sure that you strip the image path completely so that you don't output the file path as part of the other trace information received from the console.
Edit: I've since discovered that there seems to be an issue with the template in the sample project. The following section in the template is bugged:
class="log">#Raw(FormatTechMessages(traceEvent.TechMessages.TrimEnd()).Replace("SCREENSHOT[ <a href="http://specflow.org/plus/documentation/,-/" data-page=",-"<img width='1000' src=").Replace("</a> ]SCREENSHOT", "</img>"))</pre>
This is because the console no longer seems to be formatting the file as a hyperlink, so the replacement string is never found. Updating this line in ReportTemplate.cshtml seems to have done the trick:
<pre class="log">#Raw(FormatTechMessages(traceEvent.TechMessages.TrimEnd()).Replace("SCREENSHOT[ ", "<img width='1000' src=\"").Replace(" ]SCREENSHOT", "\"</img>"))</pre>
As the console is no longer formatting the file as a hyperlink, you only need to replace the padding (in this case the "SCREENSHOT[]SCREENSHOT") from the string and instead enclose the path with the <IMG> tag. You also need to add the quotes around the file path.

Strongname Signing IKVM PDFBox for Word Addin

for a Word Addin I am using PDFBox to manipulate PDFs. Or rather I would like to use it. I used it before with a self-created Desktop App. PDFBox is a Java Library that can be made usable as DLLs with IKVM (like here: http://www.squarepdf.net/pdfbox-in-net ). The problem that I experience is that all libraries for Wordaddins must be strongnamed. I tried to strongname sign but then I get an exception that a part of apache common logging (in directory MANIFEST.MF) cannot be found.
I know this is pretty vague so far and I will post more details later on, but maybe someone already went through this and has an idea on how to do this right or can point me to some place where there is already a strongnamed version of PDFBox.
Thanks in advance!
I will give some more information to this question, because my colleague is in holiday. I have strong named all pdfbox-dlls and on the try to open a pdf, i will get the first FileNotFoundException. The File $(PrjectDir)\bin\x86\Debug\commons-logging.properties could not be found.
All following Exceptions has the same problem. As a sample the next exception is a DirectoryNotFoundException. It could not find \bin\x86\Debug\META-INF\services\org.apache.commons.logging.LogFactory . There are more than 10 FileNotFoundExceptions only at the opening of my PDF:
doc = PDDocument.load(new File(inputFile));
All of Them can't find something of the Logger.
In the next Step, i try to make a content Stream from the first page of that pdf:
contentStream = new PDPageContentStream(doc, (PDPage)doc.getDocumentCatalog().getAllPages().get(0), true, false);
The first Exception, i will become there is another FileNotFoundException for C:\Users(user).accessibility.properties or $(ProjectDir)\bin\x86\Debug\META-INF\services\java.text.spi.NumberFormatProvider
Until this point, i have 20 Exceptions or so. The most of them can't find something of the logger. But i can write the opened pdf to the harddisk. If i try to insert some text into contentstream, i get a harder Exception at the point i have to set the font:
PDFont font = PDType1Font.HELVETICA;
contentStream.setFont(font, 10);
At this point i get following Exception:
An exception (first chance) of type "System.TypeInitializationException" occurred in fontbox-1.8.12.dll.
Additional information: The type initializer for "org.apache.fontbox.cmap.CMap" generated an exception.
I think the references has a problem, if pdfbox is strong named. Has anybody an idea, what is to do? Thank you very much.

iText - Create link to embedded image in PDF/A-3

I've created a PDF/A-3 document with attached image files using iText 5.5.4. What I need is to add links in the body of the document to directly open the images.
I tried this to create the links :
PdfAnnotation linktoimg = PdfAnnotation.createFileAttachment
(writer, rectangle, "Open picture", fileSpec);
writer.addAnnotation(linktoimg);
Compilation is OK but at run time I get a PdfAConformanceException :
Annotation type /FileAttachment not allowed
I also tried to add an anchor to open the images but I've found that ISO-32000-1 specification doesn't support it. And the gotoEmbedded functions only works for attached PDF files.
So is there a way to achieve this or am I facing a limitation with PDF/A?
This is not a limitation of PDF/A-3 (or PDF/A-2). In fact, you have uncovered a bug in the iText PDF/A implementation. FileAttachment annotations are disallowed in PDF/A-1, but not in PDF/A-2 and PDF/A-3.
I have pushed a fix. It will be available in the develop branch of iText repository on GitHub soon. Alternatively, if you don't want to build from source, you can download a snapshot build from the iText repository