Q: We’re still trying to get the structure tree worked out in our
PDF. We have used your example to create a structure tree but are
still confused how to reference our existing Image as Marked Content.
We’ve implemented the code below and additionally see a structure tree
being added when viewing the resulting PDF in CosEdit. Yet, we don’t
see association between the image and the STree. When we spoke
earlier you mentioned using ObjectRef to create the reference,
additionally you referenced section 14.7.4.2. Unfortunately we are
unable to track down any more information about these items.
I’ve attached the pdf file we’ve created the structure tree for
although we assume the image isn’t “Marked Content”.
Here is the method we use to create the structure tree, how do we
associate the image?
Public Function CreateTree(ByVal doc As pdftron.PDF.PDFDoc, ByVal page
As
pdftron.PDF.Page) As SElement
Dim SRoot As STree = STree_Create(doc)
Dim p1 As SElement = SElement_Create(doc, "P")
STree_Insert(SRoot, p1, 0)
Return p1
Dim mcid1 As Integer = ContentItem_Create(doc, p1,
page.GetSDFObj())
Dim prop1 As Obj = doc.CreateIndirectDict()
prop1.PutNumber("MCID", mcid1)
End Function
Thanks for your time, we are happy to investigate the pdf spec in more
detail but aren’t too familiar with the file formats. If you have
advice on specific sections we’re happy to dig at that also.
----------------------
A: We were hoping that Acrobat would display alternate text from the
OBJR (object reference). The OBJR is recognized, however for some
reason the tooltip is not show. In case you need to compatible with
Acrobat you will probably need to use MCID reference. This means that
you would need to edit the page content stream (similar to ElementEdit
sample -
http://www.pdftron.com/pdfnet/samplecode.html#ElementEdit)
and inject the following string just before image element is written
out:
element_writer.WriteString("/Figure <</MCID 0 >> BDC");
element_writer.WriteElement(image_element);
element_writer.WriteString("EMC");
This way you will surround a given image element in a 'marked content
block', which will be linked to your SElement with alternate text.
> > the equivalent of SetAlt?- Hide quoted text -
>
> - Show quoted text -