示例#1
0
        public Program()
        {
            Console.WriteLine("///////////////////");
            Console.WriteLine("  Creating Ncode");
            Console.WriteLine("///////////////////");
            Console.WriteLine();
            Console.WriteLine("1) Initializing with app key");
            Console.WriteLine();

            // This is sample app key for testing.
            // If you have your app key, enter here.
            string appKey = "855422da920c239d1349beb455d46364f5cb485cda83a9f61938fbedb75a075e";

            sdk = new CNcodeSDK();
            if (sdk.Init(appKey))
            {
                Request_and_GenerateNcode();
            }



            Console.WriteLine("////////////////////////");
            Console.WriteLine("  Creating Ncoded PDF");
            Console.WriteLine("////////////////////////");
            Console.WriteLine();
            Console.WriteLine("1) Initializing with lib key");
            Console.WriteLine();

            // Input your Adobe pdf library key.
            // If you don't have it, you should perchase it.
            string workingDir = Directory.GetCurrentDirectory();
            string libKey     = "Input your library key!";

            lib = new PDFControl();
            if (lib.init(workingDir, libKey))
            {
                ncodeImageFilename = workingDir + @"\" + ncodeImageFilename;
                RemoveK_and_AddNcode(workingDir + @"\input.pdf", workingDir + @"\output.pdf", new string[] { ncodeImageFilename });
            }
            lib.libraryCleanUp();



            Console.WriteLine();
            Console.WriteLine("-- Complete --");
            Console.ReadLine();
        }
示例#2
0
        public Program()
        {
            // Initializing libraries
            Console.WriteLine("//////////////////////////");
            Console.WriteLine("  Initializing libraries");
            Console.WriteLine("//////////////////////////");
            Console.WriteLine();

            sdk = new CNcodeSDK();
            lib = new PDFControl();

            // This is sample app key for testing.
            // If you have your app key, enter here.
            string appKey_NcodeSDK = "184b265d3aed5ccfab05c6b5167f3";

            if (!sdk.Init(appKey_NcodeSDK))
            {
                Console.WriteLine("Initializing Ncode SDK failed.");
                return;
            }
            else
            {
                Console.WriteLine("Ncode SDK version : " + sdk.GetVersion());
                Console.WriteLine();
            }

            // Enter resource folder path
            string libPath = Directory.GetCurrentDirectory();

            // This libKey is not the license key.
            // Please refer below description of Datalogics' sample code.
            // This libKey is needed for remove K from CMYK color space.
            // If you don't need remove K, leave libKey blank.

            // Datalogics description

            /* You may find that you receive exceptions when you attempt to open
             * PDF files that contain permissions restrictions on content or image
             * extraction.  This is due to the APIs used for viewing: these can
             * also be used in other contexts for content extraction or enabling
             * save-as-image capabilities. If you are making a PDF file viewer and
             * you encounter this situation, please contact your support
             * representative or [email protected] to request a key to enable
             * bypassing this restriction check.
             */
            string libKey = "";

            if (!lib.init(libPath, libKey))
            {
                Console.WriteLine("Initializing Adobe PDF lib failed.");
                return;
            }



            Console.WriteLine("///////////////////");
            Console.WriteLine("  Creating Ncode");
            Console.WriteLine("///////////////////");
            Console.WriteLine();

            IPDFDocument doc       = lib.openDocument("input_sample.pdf");
            int          pageCount = doc.getPageCount();

            ncodeImageFilename = new string[pageCount];
            GenerateNcode(pageCount);



            Console.WriteLine("////////////////////////");
            Console.WriteLine("  Creating Ncoded PDF");
            Console.WriteLine("////////////////////////");

            RemoveK_and_AddNcode_from_Image("input_sample.pdf", "output.pdf", ncodeImageFilename);
            lib.libraryCleanUp();



            Console.WriteLine();
            Console.WriteLine("-- Complete --");
            Console.ReadLine();
        }