Skip to main content
Inspiring
September 20, 2022
Answered

insert a non printing character like xml tag character '['

  • September 20, 2022
  • 3 replies
  • 3724 views

Hi All,

 

I need to insert a non printing character in a text box at caret position

so it would be great if somebody guide me how I could do this.

what area of sdk documentation/sample will help me.

 

Regards,

Alam

This topic has been closed for replies.
Correct answer alam_84

I could achieve the custom tagging with the help of text adornment (describe in basictextadornment sample plugin) and these adornment can be off when document is in preview/print mode.

with the help of answer given in post

https://community.adobe.com/t5/indesign-discussions/stop-text-adornments-from-coming-in-overprint-preview-and-pdf/td-p/7730998

 

Thanks to all for helping me.

3 replies

Community Expert
September 21, 2022

Hi @alam_84 ,

what you described is what e.g. a plug-in like EasyCatalog is doing. It adds visble tags like an XML workflow would do, but the tags do not show in the tags tree of InDesign. So it can be done. However I do not know how it is done programmatically.

 

Regards,

Uwe Laubender
( Adobe Community Expert )

Community Expert
September 22, 2022

The tag markers seem to be adornments. Adornment is somethnig that can't be created via the scripting interface so we need to dive into C++ SDK for it. I searched a bit, this is what I found.

  • The tag markers are probably implemented via kXMLMarkerAdornmentBoss
  • We probably would need to implement Global text adornments. These adornments can be switched on/off as per need something like we do for Showing/Hiding invisible characters, tag markers etc.

I haven't personally implemented text adornments so have no further insight on this matter as to how to go about implementing it etc.

-Manan

alam_84Author
Inspiring
September 22, 2022

Thanks Manan, Your answer is helpfull to me now I just needs to check how these adornment can be turn on/off.

m1b
Community Expert
September 20, 2022

Hi @alam_84, as @Willi Adelberger mentions it's hard to know what you need at this stage, but perhaps this little script will give you something to build on. It simply inserts an invisible character at the insertion point. You can pick any invisible character you like. I chose a zero-width-non-joiner.

- Mark

var zeroWidthNonJoiner = '\u200C',
    sel = app.activeDocument.selection;

if (
    sel.length == 1
    && sel[0].constructor.name == 'InsertionPoint'
)
    sel[0].contents = zeroWidthNonJoiner;

 

alam_84Author
Inspiring
September 21, 2022

Hi M1b your code works to insert a unicode non printing character, I looked into InDesign info panel to get unicode value for xml markup tag see attached screenshot and found its unicode value as FEFF but that does not work and instead of xml markup tag some other character gets inserted.  Can you help me to find correct unicode value for xml markup tag.?

Brainiac
September 21, 2022

FEFF is a Unicode byte order marker. It is invisible but should not be used in text except for its intended purpose and has nothing to do with XML tags, which as has been said are inserted with xml functions. As asked, please give more detail of your needs. 

Willi Adelberger
Community Expert
September 20, 2022

Non printing characters are inserted when you use specific functions, like xml.

Others are shown with different spaces and breaks, when the user switches to show invisible characters.

What is the purpose and which one will you use?