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.
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?
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.
var zeroWidthNonJoiner = '\u200C', sel = app.activeDocument.selection; if ( sel.length == 1 && sel.constructor.name == 'InsertionPoint' ) sel.contents = zeroWidthNonJoiner;
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.?
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.
My requirement is to insert xml marker character '[' at caret position and it should be non printable.
Does InDesign insert this xml marker as a character or graphic if it is a character then what is its unicode value and if it is a graphic then how it gets hide when doing print preview or pdf/jpg/xml export.
You can't insert XML markers just like that, you'll have to use myText.markup(myTag). Which means that you can't simply insert an XML opening bracket/tag..
If you want a non-printing character you'll have to use one like Mike suggested, or maybe a text anchor.
Why do you insist on an XML marker?
I need to create my own logic for custom tagging in such a way that symbol will remain [, ] but tag should not be added to xml structure.
I think we are going to have a hard time understanding your exact needs here without some more specific info.
Could you post an example of what you want it to be like? For example, maybe something like this: "The quick brown[special_tag_1]fox jumps over[special_tag_2]the lazy dog" but you want the whole tag "[special_tag_n]" to be non-printing? And what about the xml structure? Tell us more. There might be a better way to achieve what you want, but I'm just guessing at this stage.
I have a panel which has list of tags (fetched from remote server).
Created a text frame having text "hello world abc"
Now I selected text world and select a tag from panel and click a button "Tag it"
And I want output as "hello [world] abc" where symbol '[', ']' should be non printing.
symbol might be a character or graphic but it should not shown while doing pdf/jpeg/xml export or print the document.
Hope above clear my requirment.
I think my question is: if you don't want it to appear in your PDF, JPEG or XML export, nor the printout, in what sense do you want it to even BE in the document? I think you have a process in mind which finds these tags and does something with them - but since the tags won't be in PDF, JPEG or XML export - what will they be in and how will they be found?
Okay, well if I understand right, you are basically assigning a field from the remote database to a placeholder embedded in the indesign text, such that performing some kind of "update" action will update those values to match the latest remote values. If that is right, maybe have a look into using text variables for the placeholders? They have pretty good scripting support.
text variables also insert printable character.
in short I need to replicate xml tagging behaviour in such a way that it insert marking symbol between the character/text range but should not add that tag to xml structure.
text variables also insert printable character.
Sorry @alam_84, I don't understand this. Do you mean the contents of the text variable is printable? If so, yes of course: the text is printable. Or do you mean the text variable itself adds unwanted XML structure?
Yes Mark I mean content of text variable is printable but I want something that is mentioned by Laubender and Manan in their post.
Thanks for your valueable reply now I need to check how text adornment can be show/hide.
@alam_84 you don't just have to check how to switch on/off the adornment infact that would be the last of your concerns or probably not even a concern. The thing that you need to check is to create your own adornment, if you are thinking of using the existing XML adorment, I would advice against it as that might mess up with the tagging workflow natively present and who knows you might even not be able to do it. So the prudent way would be to have a personal adornment developed.
Also I would advice against using the same characters for your tag as used by InDesign because that can confuse the document user when using a document that has both your's and InDesign's native tags. It would also be confusing for you to debug.
Please don't open new posts when such posts already exist and are active. The other thread discussing this is
Merging this with the other thread.
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.
( Adobe Community Expert )
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.
I haven't personally implemented text adornments so have no further insight on this matter as to how to go about implementing it etc.
Thanks Manan, Your answer is helpfull to me now I just needs to check how these adornment can be turn on/off.
There is a nice sample plugin in the SDK
BasicTextAdornment.sdk decorations are not printed, but how can I make them printed?
Yes, your understanding is correct
Yes Laubender your understanding is correct.