コード例 #1
0
        static void Main(string[] args)
        {
            string strPath = System.AppDomain.CurrentDomain.BaseDirectory;

            // Starting with Toolkit version 10 native DLLs are no longer
            // copied to the system folder. The Toolkit constructor must
            // be called with the path to the native DLLs or place them
            // in your applications working directory. This example
            // assumes they are located in the default installation folder.
            // (Use x86 in the path for 32b applications)
            string toolkitPath = $@"{Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)}\ActivePDF\Toolkit\bin\x64";

            // Instantiate Object
            using (APToolkitNET.Toolkit toolkit = new APToolkitNET.Toolkit(CoreLibPath: toolkitPath))
            {
                // Open the template PDF
                short result = toolkit.OpenInputFile(InputFileName: $"{strPath}Toolkit.Input.pdf");
                if (result != 0)
                {
                    WriteResult($"Error opening input file: {result.ToString()}", toolkit);
                    return;
                }

                // List the fields in the input PDF
                APToolkitNET.InputFields inputFields = toolkit.GetInputFields();
                foreach (APToolkitNET.FieldInstances fieldInstances in inputFields.Instances)
                {
                    foreach (APToolkitNET.FieldInfo fieldInstance in fieldInstances.Fields)
                    {
                        WriteFieldInfo(FieldInfo: fieldInstance);
                    }
                }

                // Close the input file
                toolkit.CloseInputFile();
            }

            WriteResult("Success!");
        }