IPXS_Inst::StrToAtom Method

From PDF XChange PDF SDK
Revision as of 23:53, 21 April 2016 by Palamar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Gets atom ID by it's string representation.

Syntax

HRESULT StrToAtom([in]           LPWSTR  sString,
                  [out, retval]  ULONG*  nAtom);

Parameters

sString
[in] Value of LPWSTR containing the string representation of the atom.
nAtom
[out, retval] Pointer to ULONG containing the resulting atom ID.

Return Value

Returns S_OK if operation was successful or error code in other cases.

Sample

//C#
private void RemoveSquareAnnotations(PDFXEdit.IPXV_Document Doc, PDFXEdit.IPXV_Inst Inst)
{
	PDFXEdit.IPXS_Inst pSInt = (PDFXEdit.IPXS_Inst)Inst.GetExtension("PXS");
	uint nSquareAtom = pSInt.StrToAtom("Square");
	int nID = Inst.Str2ID("op.annots.delete", false);
	PDFXEdit.IOperation Op = Inst.CreateOp(nID);
	PDFXEdit.ICabNode input = Op.Params.Root["Input"];
	//Filling the operation with the annotations of Square type
	for (uint i = 0; i < Doc.CoreDoc.Pages.Count; i++)
	{
		PDFXEdit.IPXC_Page page = Doc.CoreDoc.Pages[i];
		uint nCnt = page.GetAnnotsCount();
		for (uint j = 0; j < nCnt; j++)
		{
			PDFXEdit.IPXC_Annotation annot = page.GetAnnot(j);
			if (annot.Type == nSquareAtom)
				input.Add().v = annot;
		}
	}
	Op.Do();
}

See Also

IPXS_Inst