Пример #1
0
        public FileInfo Run(FileInfo info, StateManager.VoucherItem item)
        {
            string fullFilePath = null;

            var pdf = new PdfAManager();

            int count = 0;

            foreach (Bitmap bmp in pdf.ExtractImagesFromPDF(info.FullName))
            {
                if (count++ == 0)
                {
                    fullFilePath = Path.ChangeExtension(info.FullName, ".jpg");
                    Global.IgnoreList.Add(fullFilePath);
                    bmp.Save(fullFilePath, ImageFormat.Jpeg);
                }
                else
                {
                    var path = Path.ChangeExtension(info.FullName, ".jpg");
                    path = path.ChangeFilePath((name) => name.Replace(".", string.Concat("_ ", count, ".")));
                    Global.IgnoreList.Add(path);
                    bmp.Crop2().Save(path, ImageFormat.Jpeg);
                    item.FileInfoList.Add(new FileInfo(path)); // Scanned Image
                }
                bmp.DisposeSf();
            }

            info.DeleteSafe();

            return(new FileInfo(fullFilePath));
        }
Пример #2
0
        public void create_pdf_sign()
        {
            string[] files = Directory.GetFiles(@"C:\Users\Rosen.rusev\Pictures\Presenter");

            PdfAManager manager = new PdfAManager();

            string fileName       = "C:\\test\\SES724-320377-0013491924-5.pdf";
            string signedFileName = "C:\\test\\SES724-320377-0013491924-5_Signed.pdf";

            using (var bmp = (Bitmap)Bitmap.FromFile("C:\\test\\SES724-320377-0013491924-5.jpg"))
            {
                manager.CreatePdf(fileName, new Bitmap[] { bmp },
                                  new PdfCreationInfo()
                {
                    Title   = "Voucher SES724-320377-0013491924-5",
                    Subject = "Retailer 320377",
                    Author  = "PTF Spain",
                    Creator = "PTF Spain"
                });
            }

            manager.SignPdfFile(
                fileName,
                signedFileName,
                new PdfSignInfo()
            {
                pfxFilePath      = @"C:\PROJECTS\VPrint2\ReceivingServiceLib.Common\PTF.pfx",
                pfxKeyPass       = "",
                DocPass          = null,
                SignImagePath    = @"C:\PROJECTS\VPrint2\ReceivingServiceLib.Common\Resources\PTFLogo.jpg",
                ReasonForSigning = "Voucher SES724-320377-0013491924-5",
                Location         = "Madrid, Spain"
            });
        }
Пример #3
0
        public void compressPDF_test()
        {
            PdfAManager man = new PdfAManager();

            man.CompressPdf("C:\\tmp64C66c81c722_ca06_46b4_ac94_97b958110a5a.pdf", "C:\\result1.pdf");
        }