Highlighted

image count values in C++

Explorer ,
Jun 02, 2020

Copy link to clipboard

Copied

Hi,

Can someone provide me the C++ code to find the total number of images present in the InDesign document.

 

Nithu

Topics

Feature request, How to, SDK

Views

739

Likes

Translate

Translate

Report

Report
This conversation has been locked.

image count values in C++

Explorer ,
Jun 02, 2020

Copy link to clipboard

Copied

Hi,

Can someone provide me the C++ code to find the total number of images present in the InDesign document.

 

Nithu

Topics

Feature request, How to, SDK

Views

740

Likes

Translate

Translate

Report

Report
Adobe Community Professional ,
Jun 02, 2020

Copy link to clipboard

Copied

I have already answered this in another thread. Look at the point about ILinksManager in the following thread

https://community.adobe.com/t5/indesign/how-to-add-word-and-image-count-values-in-c/m-p/11108827#M18...

 

-Manan

Likes

Translate

Translate

Report

Report
Explorer ,
Jun 02, 2020

Copy link to clipboard

Copied

I'll check with your reference

Nithu

Likes

Translate

Translate

Report

Report
Adobe Community Professional ,
Jun 03, 2020

Copy link to clipboard

Copied

HI,

 

There should also be plenty of samples in the InDesign SDK showing how to use the ILinksManager.

 

Regards

 

Malcolm

Likes

Translate

Translate

Report

Report
Explorer ,
Jun 03, 2020

Copy link to clipboard

Copied

IDocument* doc = Utils<ILayoutUIUtils>()->GetFrontDocument();
InterfacePtr<ILinksManager> linkmanager(doc, UseDefaultIID());
if(linkmanager)
int32 linkcnt = linkmanager->GetLinkCount();
PMString ct;
ct.AppendNumber(ct);

I have used this code to fetch the image count in the document but it displays the duplicate value is my code is correct or not. If not please guide me on this

Nithu

Likes

Translate

Translate

Report

Report
Most Valuable Participant ,
Jun 03, 2020

Copy link to clipboard

Copied

You really, really should learn basic programming first, before attempting to dive into something as difficult as the InDesign SDK (difficult even for experienced programmers).

 

I have given up on SDK programming long ago (because it is so very difficult) but even I can spot the problem right away. What number did you believe to append with this line

 

ct.AppendNumber(ct);

 

when that 'ct' is actually the very same PMString!? See an earlier thread for how to properly use "AppendNumber": https://community.adobe.com/t5/indesign/how-concat-string-and-number/td-p/8424376?page=1

 

(but it would be far, far better for all of us if you first learn how to program C++ -- not only the bare basics, but classes, templates and all! -- and only then return to the InDesign SDK)

Likes

Translate

Translate

Report

Report
Adobe Community Professional ,
Jun 05, 2020

Copy link to clipboard

Copied

Hi Manan,

apart from the SDK one should know that not all images or graphics in a document were placed and linked.

One could also paste pixels from e.g. PhotoShop. A method that is based on links will fail to notice them.

 

FWIW: With ExtendScript we have the allGraphics array of a document. Will that get all graphics and images? Ahem. Surprisingly the answer is: No. Images and graphics in not active states of form fields of any kind will not get covered.

 

Regards,
Uwe Laubender

( ACP )

Likes

Translate

Translate

Report

Report
Adobe Community Professional ,
Jun 05, 2020

Copy link to clipboard

Copied

Sure Uwe, these cases do exist. I have also not dealt with all these cases, nor am i sure if sdk methods that i mentioned will help for these use cases or not. However the point that Jongware is trying to make is that there is no other option to deal with this other than read the documentation, shortcuts won't work.

 

Anyways OP did not revert back if a progress was made and if these cases did crop up, but with you comment makes the discussion complete. We can pick this up when needed and ponder if the sdk does help in identifying all cases or not

 

-Manan

Likes

Translate

Translate

Report

Report
Adobe Employee ,
Jun 11, 2020

Copy link to clipboard

Copied

duplicate thread/spam, locked

Likes

Translate

Translate

Report

Report