Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Rectangle vs. Graphic Frame

Contributor ,
Dec 14, 2024 Dec 14, 2024

Hi all,

 

does anyone have any idea how to differentiate between these two rectangles using ExtendScript.

 

Bildschirmfoto 2024-12-14 um 17.13.42.pngexpand image

 

About the creation process: An XML tag was assigned to the lower rectangle, which was then removed. This way, the appearance in the layer palette can be recreated.

 

They do not differ in IDML. Thus, the lower element becomes a “normal” rectangle when the IDML file is opened.

 

Thanks for any hints
Roland

TOPICS
Scripting
632
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 14, 2024 Dec 14, 2024

I am not sure what your goal or needs are, but ID frames are... malleable entities that shift with the designer's whim. Drag out a "Rectangle"; drag out a rectangular "Frame"; either can be used as a graphics element or tagged as a graphics or text frame by subsequent actions.

 

Not a Script Guy, but I'd wager that script-level actions are no more differentiated. That is, I'd bet you can create a (graphics) Rectangle and follow up with assigning and formatting text in it, or placing a graphic, and vicey-versey-alleey-roundy.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 14, 2024 Dec 14, 2024

Thank you for your answer.  That's right, you can convert it back to its original state. But what I want to find out is how these two states of the rectangle can be distinguished at script level.

 

Both are rectangle frames, both have (it seems) the same script properties and are the same in IDML. Only one rectangle was tagged once (XML) and the tag removed again.

 

Background, why I want to find out: one rectangle is tagged when exporting a PDF, the other is not.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 15, 2024 Dec 15, 2024

@Roland Dreger

 

Maybe because of XML?

 

What is your end goal? 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 15, 2024 Dec 15, 2024

In principle, I just want to identify these specific spline items. I get an unknown document, loop through the items and analyze them. These items that are not “normal” should be listed.

 

The reason is that they are treated differently when exported to a tagged PDF.

InDesign:

Bildschirmfoto 2024-12-15 um 23.08.03.pngexpand image

PDF

Bildschirmfoto 2024-12-15 um 23.09.11.pngexpand image

Bildschirmfoto 2024-12-15 um 23.11.26.pngexpand image

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 15, 2024 Dec 15, 2024

Define "not normal". 

 

As I've suspected - XML creates a "structure" in your document - tree to your object.

 

Still - what is your end goal? 

 

Tag objects that hasn't been "touched" by XML? 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 15, 2024 Dec 15, 2024
quote

Define "not normal". 


By Robert at ID-Tasker

 

Normal is perhaps the wrong term. But look in the layer palette, there the two rectangles differ in their automatically assigned names. The tag behavior is different when exporting. If you create an IDML and open a document from it, “Rectangle” appears again in the layer palette. So they are obviously different, but not in the script properties. And I think that's strange.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 15, 2024 Dec 15, 2024

@Roland Dreger

 

OK, but still - what is your end goal? Why do you need to find the "wrong" ones?

 

What do you have to do with them? 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 16, 2024 Dec 16, 2024

@Roland Dreger 

 

What options do you have set in the PDF export dialog?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 16, 2024 Dec 16, 2024
quote

Roland Dreger 

 

What options do you have set in the PDF export dialog?

 

Because in print and interactive - I got this from you file:

 

RobertatIDTasker_0-1734364503480.pngexpand image

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 16, 2024 Dec 16, 2024

No special settings. Only Interactive PDF and “Create PDF with tags”. You get the same result, don't you?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 17, 2024 Dec 17, 2024
quote

No special settings. Only Interactive PDF and “Create PDF with tags”. You get the same result, don't you?


By Roland Dreger

 

Looks that way:

RobertatIDTasker_0-1734453731266.pngexpand image

 

I think it's because of XML. Some kind of leftovers after tagging?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 17, 2024 Dec 17, 2024
LATEST

@Roland Dreger 

 

But tagging is pulled from ObjectStyle / XML info - objects don't have a "accessiblity tag" property...

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#TagType.html

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 16, 2024 Dec 16, 2024

In principle, I just want to identify these specific spline items. I get an unknown document, loop through the items and analyze them. These items that are not “normal” should be listed.

 

The reason is that they are treated differently when exported to a tagged PDF.

 

So, I'm still coming away with the impression that this is more intellectual curiosity/tech puzzle than anything relevant to a real-world need. Yes, I understand the mania obsession regulatory-pressured focus on accessibility, and there are lots of grimy cracks and broken corners in PDF export with respect to that... but, simple question:

 

Does this difference actually result in any variation of accessiblity in an otherwise conforming PDF? Or, is it ever likely to?

 

Not saying it's not worth pursuing and possibly "fixing" even if it's benign, but there is a difference between need and... curiosity. Or so I think.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 16, 2024 Dec 16, 2024

This (I'll call it) bug is certainly a rare case and apparently only occurs with documents that previously contained an XML structure.

 

But there is also a practical relevance. If this is not dealt with, a check (in this case PAC) results in an error: "Alternative text missing for 'Figure' structure element"

 

alternate_text_missing.pngexpand image

But of course, curiosity also plays a role here.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 14, 2024 Dec 14, 2024

Hi @Roland Dreger, I couldn't find a single thing that differentiated these two frames, based on doing diff between the two dumps in the ExtendScript debugger. Maybe the exported XML is different?

 

I don't know your use case, but I wondered if the following code might be safe to use:

 

 

var doc = app.activeDocument,
    item1 = doc.rectangles[0],
    item2 = doc.rectangles[1];

resetGraphicRectangle(item1);
resetGraphicRectangle(item2);

function resetGraphicRectangle(item) {

    if (
        ContentType.GRAPHIC_TYPE !== item.contentType
        || 0 === item.graphics.length
    )
        return;

    item.contentType = ContentType.UNASSIGNED;
    item.contentType = ContentType.GRAPHIC_TYPE;

};

 

Edit: fixed typo.

 

- Mark

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 15, 2024 Dec 15, 2024

Good idea @m1b 

 

Just wonder if the core issue is addressed - rather than resetting.

Maybe some Metadata or Hidden Attributes could be added to the frame. While the obvious properties are identical, this would mean a hidden attributes or metadata (perhaps a label, taggedPDFData, or custom object metadata) that might be accessible by ExtendScript.


I'd try with testing export Tags,  since Roland mentioned differences in PDF tagging, maybe a script could compare export tag settings (perhaps tagged PDF Data or other related properties).

 

Could a check for Custom Label where untagging elements could leave residual label data or other flags? Perhaps there's a way for a script to loop through all objects and differentiate label properties.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 15, 2024 Dec 15, 2024

Hi Mark, hi Eugene,

thank you for your investigation. My use case: Before the PDF export, it should be checked whether a tag (tagged PDF) is exported for an object. I would prefer not to change anything in the document during this check, otherwise it could potentially irritate the users.

 

But for an action to correct these issues, this is a good idea. Possibly also check whether an XML element is still associated with the object.

 

Roland

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 15, 2024 Dec 15, 2024

Alas, as you can guess, I'm out of my depth here. I hope someone more knowledgeable about this area of scripting can help. Eugene, I'm not sure I follow your idea, but if you have time, perhaps you could pursue it with Roland's sample file? It sounds intriguing.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 15, 2024 Dec 15, 2024

I can give it a go - I'm not the best scripter but I don't really know the end goal here or what the purpose of it is. 

If there was more info to give that would be great. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 15, 2024 Dec 15, 2024

Here are some screenshots But don't do too much work. It's a special case. And I'd just be interested to know how you can identify these special items.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 15, 2024 Dec 15, 2024
quote

Here are some screenshots But don't do too much work. It's a special case. And I'd just be interested to know how you can identify these special items.


By Roland Dreger

 

Can you share some INDD document(s)? 

 

I could run them through my ID-Tasker tool. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 15, 2024 Dec 15, 2024

@Robert at ID-Tasker, there is a document attached to Roland's first post.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 15, 2024 Dec 15, 2024

Yes @Eugene Tyson, "don't do too much work" is good advice. I believe Roland has more scripting experience than either of us and probably has probably experimented copiously before posting the question here. If we don't know a fix by our prior experience, looking for a solution now will probably double-up work that Roland has already done. (But I don't want to put you off if you want the learning experience, which is usually time well spent.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines