Rich Contents attributes

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

DanielG
User
Posts: 34
Joined: Wed Oct 09, 2013 5:58 pm

Rich Contents attributes

Post by DanielG »

Hello,

I am trying to save the attributes for all annotations and I've come across some odd behavior when it comes to a FreeText annotation. In order to get of the font attributes, I discovered I need to access the richContents property and then access each object in the Span array. However, it seems like the strikethrough, subscript, superscript, and underline aren't being returned.

Here is the JavaScript I am running:
var annot = this.getAnnot(0, "<my annotation>");
var output;
for (var i = 0; i < annot.richContents.length; i++) {
output += "RichContents[" + i + "].Alignment=" + annot.richContents.alignment + ";";
output += "RichContents[" + i + "].FontFamily=" + annot.richContents.fontFamily + ";";
output += "RichContents[" + i + "].FontStyle=" + annot.richContents.fontStyle + ";";
output += "RichContents[" + i + "].FontWeight=" + annot.richContents.fontWeight + ";";
output += "RichContents[" + i + "].Strikethrough=" + annot.richContents.strikethrough + ";";
output += "RichContents[" + i + "].Subscript=" + annot.richContents.subscript + ";";
output += "RichContents[" + i + "].Superscript=" + annot.richContents.superscript + ";";
output += "RichContents[" + i + "].Text=" + annot.richContents.text + ";";
output += "RichContents[" + i + "].TextColor=" + annot.richContents.textColor + ";";
output += "RichContents[" + i + "].TextSize=" + annot.richContents.textSize + ";";
output += "RichContents[" + i + "].Underline=" + annot.richContents[i].underline + ";";
}
this.Results = output;


When I run this using the RunJavaScript command, this is what I am getting back:

RichContents[0].Alignment=left;
RichContents[0].FontFamily=Algerian;
RichContents[0].FontStyle=normal;
RichContents[0].FontWeight=400;
RichContents[0].Strikethrough=undefined;
RichContents[0].Subscript=undefined;
RichContents[0].Superscript=undefined;
RichContents[0].Text=abcdefg;
RichContents[0].TextColor=RGB,0,0,0;
RichContents[0].TextSize=12;
RichContents[0].Underline=undefined;

I have verified that all but strikethrough, subscript, superscript, and underline work as expected. Do you know why those 4 attributes return undefined instead of either 'true' or 'false'?

Thanks
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3586
Joined: Thu Jul 08, 2004 10:36 pm

Re: Rich Contents attributes

Post by Ivan - Tracker Software »

I fixed the issue. The fix will be available in the next build of the Viewer.
PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.