예제 #1
0
        private void DgFiles_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                //var item = (EpdmVault.ColumnsBind)DgFiles.SelectedItem;
                var item = default(EpdmVault.ColumnsBind);
                DgFiles.Dispatcher.Invoke(new Action(() => { item = (EpdmVault.ColumnsBind)DgFiles.SelectedItem; }));
                if (item != null)
                {
                    var oFolder = default(IEdmFolder5);
                    var aFile   = EpdmVault.Vault.GetFileFromPath(item.FilePath, out oFolder);
                    if (aFile == null)
                    {
                        System.Windows.MessageBox.Show("Файл не найден.", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }

                    var LocWin = new LoadLocalFile();
                    aFile.GetFileCopy(0, "", item.FolderId, (int)EdmGetFlag.EdmGet_MakeReadOnly + (int)EdmGetFlag.EdmGet_Simple);
                    //aFile.GetFileCopy(0, "", item.FolderId,(int)EdmGetFlag.EdmGet_Refs+ (int)EdmGetFlag.EdmGet_RefsOnlyMissing+ (int)EdmGetFlag.EdmGet_RefsOverwriteLocked+ (int)EdmGetFlag.EdmGet_RefsVerLatest);
                    var extension = Path.GetExtension(item.FilePath);
                    switch (extension.ToLower())
                    {
                    case ".dxf":
                    case ".eprt":
                    case ".easm":
                    case ".edrw":
                    case ".sldprt":
                    case ".sldasm":
                    case ".slddrw":
                        DXFControl    = new UserControlEdr();
                        hostDxf       = new WindowsFormsHost();
                        hostDxf.Child = DXFControl;
                        HostControl.Children.Add(hostDxf);
                        DXFControl.axEModelViewControl1.OpenDoc(item.FilePath, false, false, true, "");
                        if (pdfControl != null)
                        {
                            pdfControl.Dispose();
                        }
                        break;

                    case ".pdf":
                        pdfControl    = new PDFControl();
                        hostpdf       = new WindowsFormsHost();
                        hostpdf.Child = pdfControl;
                        HostControl.Children.Add(hostpdf);
                        pdfControl.OpenFile(item.FilePath);
                        if (DXFControl != null)
                        {
                            DXFControl.Dispose();
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message + ", \n" + ex.StackTrace);
            }
        }
예제 #2
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();
        }
예제 #3
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();
        }