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

image count values in C++

Explorer ,
Jun 02, 2020 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

1.0K

Translate

Translate

Report

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 ,
Jun 02, 2020 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

Votes

Translate

Translate

Report

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
Explorer ,
Jun 02, 2020 Jun 02, 2020

Copy link to clipboard

Copied

I'll check with your reference

Nithu

Votes

Translate

Translate

Report

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 ,
Jun 03, 2020 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

Votes

Translate

Translate

Report

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
Explorer ,
Jun 03, 2020 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

Votes

Translate

Translate

Report

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 ,
Jun 03, 2020 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)

Votes

Translate

Translate

Report

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 ,
Jun 05, 2020 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 )

Votes

Translate

Translate

Report

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 ,
Jun 05, 2020 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

Votes

Translate

Translate

Report

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
Adobe Employee ,
Jun 11, 2020 Jun 11, 2020

Copy link to clipboard

Copied

LATEST

duplicate thread/spam, locked

Votes

Translate

Translate

Report

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