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

Get Reference tag as parent to all the link tag

Community Beginner ,
Sep 28, 2021 Sep 28, 2021

Copy link to clipboard


Hi Team,

I am running "auto tag document" for PDF to convert it as accessible PDF, but as per PDF/UA standard all the "Link" tag should be nested within "Reference" tag. so i have manged to create the reference tag above the link tag by using the below code, but how brink the Link tag as child to reference tag will "PDSMCGetPDEContainer" will help to achive this process, if so how to obtain the PDSMC parameter to pass in this method, or is there is any other api is there to achive this requirment.


ASInt32 numKids = PDSElementGetNumKids(element);
	ASInt32 kidIndex;
	for (kidIndex = 0; kidIndex < numKids; ++kidIndex) 
	//for (kidIndex = numKids - 1; kidIndex >= 0; --kidIndex)
		PDSElement kid;
		PDSMCInfo mcidInfo;
		ASAtom kidType = PDSElementGetKidWithMCInfo(element,kidIndex,&kid,&mcidInfo,NULL,NULL); 
		char buf[256], title[128];
		buf[0] = title[0] = '\0';

		if (kidType == OBJR_K) {
			PDSElement parent = CosNewNull();
			PDSOBJGetParent(kid, &parent);
			if (!CosObjEqual(parent, CosNewNull())) {
				ASInt32 title_size = PDSElementGetTitle(parent, reinterpret_cast<ASUns8*> (title));
				sprintf(buf, "\tOBJR-elem - parent - %s - %s ", ASAtomGetString(PDSElementGetType(parent)), title);
				strcpy(buf, "\tOBJR-elem");
		else if (kidType == MC_K) {
			sprintf(buf, "\t\tMC-elem - mcid=%d", mcidInfo.mcid);
		else if (kidType == StructElem_K) {
			sprintf(buf, "\tStruct-elem - %s ", ASAtomGetString(PDSElementGetType(kid)));

			const char * name = ASAtomGetString(PDSElementGetType(kid));
			std::string TagName(name);
			if (TagName == "Link")
				PDSElement Kidparent;
				ASBool KidparentIsTreeRoot;
				PDSElementGetParent(kid, &Kidparent, &KidparentIsTreeRoot);
				const char * Pname = ASAtomGetString(PDSElementGetType(Kidparent));
				PDSElement ReferenceTitle;
				PDSElementCreate(pdDoc, &ReferenceTitle);
				PDSElementSetType(ReferenceTitle, ASAtomFromString("Reference"));
				PDSElementInsertKid(Kidparent, ReferenceTitle, kidIndex - 1);

//				PDEContainer Container =  PDSMCGetPDEContainer();

				//PDSElementInsertKid(Kidparent, kid, kidIndex - 1);
				sprintf(buf, "\tStruct-elem - %s ", ASAtomGetString(PDSElementGetType(kid)));
				/*CosObj CosPage;
				PDPage pdPage = PDDocAcquirePage(pdDoc, 0);
				CosPage = PDPageGetCosObj(pdPage);*/
				//PDSElementInsertKid(ReferenceTitle, kid, kPDSAfterLast);
			ASInt32 title_size = PDSElementGetTitle(kid, reinterpret_cast<ASUns8*> (title));
			strcat(buf, reinterpret_cast<char *>(title));
			GetElemInfo(kid, pdDoc);


Thanks and Regards

Bala v

Acrobat SDK and JavaScript






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

Have something to add?

Join the conversation