示例#1
0
 public CustPackPrintBLL(string basePath = null)
 {
     //if (basePath == null)
     //    ; ;
     this.BasePath = basePath;
     pdfUtility    = new PDFUtility();
 }
        public void AddPDFFieldsTest()
        {
            var list = new List <PDFField>();

            list.Add(new PdfTextField()
            {
                text       = "HELLOOOOOOOOO",
                x          = 150,
                y          = 100,
                width      = 130,
                height     = 200,
                fontSize   = 25,
                color      = "#FF00008B",
                showborder = true,
                page       = 1
            });
            list.Add(new PdfTextField()
            {
                text       = "Test2OOOO",
                x          = 210,
                y          = 150,
                width      = 130,
                height     = 200,
                fontSize   = 15,
                color      = "#FF00008B",
                showborder = true,
                page       = 1
            });

            PDFUtility.AddPDFFields(@"D:\temp\testSignatureService\BG.pdf", @"D:\temp\testSignatureService\BG_Out.pdf", list);
        }
示例#3
0
 public MainWindow(string pdf, int index) : this()
 {
     this.pdf          = pdf;
     pageIndex.Minimum = 0;
     pageIndex.Maximum = PDFUtility.GetImages(pdf).Count() - 1;
     pageIndex.Value   = index;
 }
        public object SetExamplePdf(HttpRequestMessage request)
        {
            var template_id = request.GetQueryNameValuePairs().Single(t => t.Key == "id").Value;
            var bytes       = request.Content.ReadAsByteArrayAsync().Result;
            var pdfInfo     = PDFUtility.GetPdfInfo(bytes);

            ContentManager.GetInstance().SetExamplePdf(template_id, bytes);
            return(pdfInfo);
        }
示例#5
0
 public LabelPrintBLL(string basePath = null)
 {
     //if (basePath == null)
     //    ; ;
     this.BasePath = basePath;
     pdfUtility    = new PDFUtility();
     fontHelper    = new FontHelper();
     BoldFont      = new Font(BF_Light, ContentFontSize, Font.BOLD);
 }
示例#6
0
        private void DeltaIncidentButton_Click(object sender, RoutedEventArgs e)
        {
            string     PDFFileLocation = @"C:\Dev\Invert911\Invert911_RMS\InvertCommon\Reports\LawIncident\DeltaReports\IncidentReport.pdf";
            PDFUtility p = new PDFUtility();
            Dictionary <string, string> d = p.ReadAllFields(PDFFileLocation);

            string s = d.ToString();

            PrintReportBrowser.Navigate(PDFFileLocation);
        }
示例#7
0
        private void DeltaIncidentButton_Click(object sender, RoutedEventArgs e)
        {
            string FolderPath      = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); //starup path
            string PDFFileLocation = System.IO.Path.Combine(FolderPath, @"Reports\LawIncident\DeltaReports\IncidentReport.pdf");


            if (File.Exists(PDFFileLocation))
            {
                PDFUtility p = new PDFUtility();
                Dictionary <string, string> d = p.ReadAllFields(PDFFileLocation);
                string s = d.ToString();

                PrintReportBrowser.Navigate(PDFFileLocation);
            }
        }
示例#8
0
        public object AddFields([FromBody] AddFieldsRequest request)
        {
            var fields = request.fields;

            if (!string.IsNullOrEmpty(request.template_id))
            {
                fields = ContentManager.GetInstance().GetTemplate(request.template_id).fields;
            }
            if (request.bytes != null)
            {
                return(PDFUtility.AddPDFFields(request.bytes, fields));
            }
            else
            {
                return(PDFUtility.AddPDFFields(request.path_in, request.path_out, fields));
            }
        }
示例#9
0
        async Task <Bitmap> GetBitmap()
        {
            while (string.IsNullOrEmpty(pdf))
            {
                var dialog = new CommonOpenFileDialog();
                var filter = new CommonFileDialogFilter("PDF", "pdf");
                dialog.Filters.Add(filter);
                if (dialog.ShowDialog() != CommonFileDialogResult.Ok)
                {
                    Application.Current.Shutdown();
                    return(null);
                }
                pdf = dialog.FileName;
            }

            var image = await Task.Run(() => PDFUtility.GetImages(pdf));

            pageIndex.Maximum = image.Count() - 1;
            var index  = (int)pageIndex.Value;
            var bitmap = await Task.Run(() => new Bitmap(image.ToArray()[index].image));

            return(bitmap);
        }
        public void TestSignTest()
        {
            var src   = @"D:\temp\testSignatureService\BG.PDF";
            var dest  = @"D:\temp\testSignatureService\BG_Signed.PDF";
            var field = new PdfSignatureField()
            {
                name       = "signature1",
                x          = 100,
                y          = 100,
                width      = 100,
                height     = 100,
                reason     = "testJaaa",
                location   = "current location",
                page       = 1,
                thumbprint = "‎76 61 4a 24 85 76 46 4a 5b 13 75 3a e4 f3 31 4b 7b aa 79 62".Replace("‎", "").Replace(" ", "").ToUpper()
            };
            var result = PDFUtility.AddPdfSignatureField(File.ReadAllBytes(src), field);

            File.WriteAllBytes(dest, result);

            field = new PdfSignatureField()
            {
                name       = "signature2",
                x          = 200,
                y          = 200,
                width      = 100,
                height     = 100,
                reason     = "testJaaa2",
                location   = "location",
                page       = 1,
                thumbprint = "‎bc 97 b6 69 77 48 9c fb ca a0 78 58 38 19 c5 d6 1f 65 0c b8".Replace("‎", "").Replace(" ", "").ToUpper()
            };

            result = PDFUtility.AddPdfSignatureField(File.ReadAllBytes(dest), field);
            File.WriteAllBytes(dest, result);
        }
示例#11
0
 public RPWayBillPrintBLL(string basePath)
 {
     this.BasePath = basePath;
     pdfUtility    = new PDFUtility();
 }
        public object GetPdfInfo(HttpRequestMessage request)
        {
            var bytes = request.Content.ReadAsByteArrayAsync().Result;

            return(PDFUtility.GetPdfInfo(bytes));
        }
        public void TextWithSignatureTest()
        {
            List <PDFField> list = GetTestList();

            PDFUtility.AddPDFFields(@"D:\temp\testSignatureService\BG.pdf", @"D:\temp\testSignatureService\BG_Out_text_signature.pdf", list);
        }