Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            ImGearLicense.SetSolutionName("Accusoft");
            ImGearLicense.SetSolutionKey(0x00000000, 0x00000000, 0x00000000, 0x00000000);
            ImGearLicense.SetOEMLicenseKey("2.0.E6dKRyMXM7REMwJuP0JK2YUXG7RCFaiSiQUY4EiukyGEkQ2aJuFwsCRjGCU9RacudaMaMCGjHYFEMCducEFQP0GScSUjkYFuPKiuG7sw57iQc0i9k72aPjcjHXJKR7UQPCsQ20iSiEPQUYdjJKRCH9FKMyJSPYdSF9kyUKdQdKJQHYP7dYJY5udy26MwWY5CdQGQFSPY4QsuUyiS50ij2a2aGCGj5KPuHE4QUuM7GwcQJXMwJ7FukX2QMaRXdyMYP9HykKJusCkwUQc9MKME46c9HCd9GaJQPK5XRaP9M0MKPa2aJudKk9Fjd9U94EGuPEsyP9GjsXFQJXHC5QRQUSdSiy26s6cX4yijRCFEJ7JwF0suk75aRCRYGUY");
            new BarcodeXpress().Licensing.SetOEMLicenseKey("2.0.ENhwvGbL56y2F6F6l3n7F7hNlNsBv7l7FLy2e2d4FpD8fByBbkFGFZeSW6yw53b3W7WLeZn3xjF8ywxjFSsGvGfZxGv4dG56f3W4s4nkfSF4fSF4lZD2FSD4hUf3bBWBdNn853bSf8nwW6DGW7dLeZn3xje3fwlZb45jvwU3xGv4DjFwd8bSs7lBUkbBb7y7y3s2D4d4yNxLbNdBeNd8dLf2f3xLv8U3f2W8FLvLF6UjeZWjeWdB7");


            ImGearCommonFormats.Initialize();

            // Load the image
            ImGearRasterPage inPage;

            using (var stream = new FileStream("trees.jpg", FileMode.Open))
                inPage = ImGearFileFormats.LoadPage(stream, 0) as ImGearRasterPage;

            // Create a result page for the barcode
            ImGearRasterPage outPage = new ImGearRasterPage(inPage.DIB.Width, inPage.DIB.Height, new ImGearColorSpace(ImGearColorSpaceIDs.RGB), new int[] { 8, 8, 8 }, true);

            // Transform the input image into the output barcode
            DecodePage(inPage, outPage);

            // Read the encoded barcode!
            ReadBarcodes(outPage);
        }
Ejemplo n.º 2
0
        public static void Encode(String inputPdfPath, String outputPdfPath, String message)
        {
            if (message.Length == 0)
            {
                throw new InvalidOperationException("The message must be at least one character.");
            }

            String encodedMessage = EncodeMessage(message);

            // Open file for reading.
            using (FileStream pdfData = new FileStream(inputPath, FileMode.Open, FileAccess.Read))
            {
                // Read PDF document to memory.
                using (ImGearPDFDocument igPdfDocument = (ImGearPDFDocument)ImGearFileFormats.LoadDocument(
                           pdfData, firstPage, (int)ImGearPDFPageRange.ALL_PAGES))
                {
                    // Package secret message.
                    InjectMessage(igPdfDocument, encodedMessage);

                    // Save PDF file.
                    igPdfDocument.Save(outputPath, ImGearSavingFormats.PDF, firstPage, firstPage,
                                       igPdfDocument.Pages.Count, ImGearSavingModes.OVERWRITE);

                    exitCode = ExitCode.CompletedSuccessfully;
                }
            }
        }
Ejemplo n.º 3
0
        /**
         * Program entry point.
         */
        static void Main(string[] args)
        {
            InitImageGear();

            using (Stream mergedStream = new FileStream(mergedImageFilepath, FileMode.Open))
                using (Stream recoveredStream = new FileStream(recoveredImageFilepath, FileMode.Create))
                {
                    // load merged image
                    ImGearPage mergedImage = ImGearFileFormats.LoadPage(mergedStream);

                    // extract hidden image
                    ImGearPage recoveredImage = ExtractHiddenImage(mergedImage);

                    ImGearFileFormats.SavePage(recoveredImage, recoveredStream, ImGearSavingFormats.PNG);
                }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Handles filesystem interaction to
        /// load a filepath into an ImGearPage instance
        /// </summary>
        private static ImGearPage LoadPageFromLocalFile(string filePath)
        {
            // From a local file
            ImGearPage igPage;
            int        pageIndex = 0;

            /////////////////////////////////////////////////////////////////////////////////////////////////////////
            // This remainder of this function will be left for contestants to implement
            //
            // Hint:
            // Set igPage variable with ImGearPage instance
            // https://help.accusoft.com/ImageGear-Net/v24.11/Windows/HTML/webframe.html#topic582.html
            //
            // contestant implementation ------------------------------------------------------------------------------
            using (FileStream localFile = new FileStream(filePath, FileMode.Open))
            {
                igPage = ImGearFileFormats.LoadPage(localFile, pageIndex);
            }
            // end contestant implementation --------------------------------------------------------------------------
            /////////////////////////////////////////////////////////////////////////////////////////////////////////

            return(igPage);
        }