1

このページでは、PDFのカスタムドキュメントプロパティを設定する方法の便利な例を示します。

だから私はこれを行いました(そしてカスタムプロパティがファイルに設定されていることを確認しました):

Doc theDoc = new Doc();
int theID = theDoc.AddObject("<< >>");
theDoc.SetInfo(-1, "/Info:Ref", theID.ToString());
theDoc.SetInfo(theID, "/Company:Text", "ACME");
theDoc.Save(FileName);

後でプロパティを取得しようとしています。私はもう試した:

Doc theDoc = new Doc();
theDoc.Read(FileName);
int theID = theDoc.AddObject("<< >>");
theDoc.SetInfo(-1, "/Info:Ref", theID.ToString());
return theDoc.GetInfo(theID, "/Company:Text"); //returns empty string

//...read theDoc
int theID = theDoc.GetInfoInt(-1, "/Info");
return theDoc.GetInfo(theID, "/Company:Text"); //returns empty string

誰かが私がそのプロパティを取得する方法についての手がかりを持っていますか?

4

1 に答える 1

0

これらの値を設定する別の方法を見つけました。

if (theDoc.GetInfo(-1, "/Info") == "")
    theDoc.SetInfo(-1, "/Info:Ref", theDoc.AddObject("<< >>").ToString());
theDoc.SetInfo(-1, "/Info*/Company:Text", "ACME");

このように値を設定した後、次のように値を取得できます。

if (theDoc.GetInfo(-1, "/Info") == "")
    theDoc.SetInfo(-1, "/Info:Ref", theDoc.AddObject("<< >>").ToString());
string companyName = theDoc.GetInfo(-1, "/Info*/Company:Text");
于 2013-03-22T13:08:06.153 に答える