IPXS_Inst::StrToAtom Method

From PDF XChange PDF SDK
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

01//C#
02private void RemoveSquareAnnotations(PDFXEdit.IPXV_Document Doc, PDFXEdit.IPXV_Inst Inst)
03{
04    PDFXEdit.IPXS_Inst pSInt = (PDFXEdit.IPXS_Inst)Inst.GetExtension("PXS");
05    uint nSquareAtom = pSInt.StrToAtom("Square");
06    int nID = Inst.Str2ID("op.annots.delete", false);
07    PDFXEdit.IOperation Op = Inst.CreateOp(nID);
08    PDFXEdit.ICabNode input = Op.Params.Root["Input"];
09    //Filling the operation with the annotations of Square type
10    for (uint i = 0; i < Doc.CoreDoc.Pages.Count; i++)
11    {
12        PDFXEdit.IPXC_Page page = Doc.CoreDoc.Pages[i];
13        uint nCnt = page.GetAnnotsCount();
14        for (uint j = 0; j < nCnt; j++)
15        {
16            PDFXEdit.IPXC_Annotation annot = page.GetAnnot(j);
17            if (annot.Type == nSquareAtom)
18                input.Add().v = annot;
19        }
20    }
21    Op.Do();
22}

See Also

IPXS_Inst