Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            logger.Debug(LOG_START);
            // セッションデータの取得
            KinmuSystem.SetSessionData(ref loginShainInfo, ref viewShainInfo, ref viewDateTime, Response, Request, Session);

            string companyName      = "(株)エスケイケイ";
            string dataErrorMessage = "データ読み込み時にエラーが発生しました。管理者に連絡してください。";



            try
            {
                var kinmuManager = new KinmuManager(viewShainInfo.SHAIN_CD, viewDateTime.Year, viewDateTime.Month);
                var pdfManager   = new PDFManager(kinmuManager);

                //データをバインドする
                YearLabel.Text        = viewDateTime.ToString("yyyy");
                MonthLabel.Text       = viewDateTime.ToString("MM");
                CompanyNameLabel.Text = companyName;
                NameLabel.Text        = viewShainInfo.SHAIN_NM;
                Title = "作業日誌 " + viewShainInfo.SHAIN_NM + " " + viewDateTime.ToString("yyyy年MM月");

                WorkDiaryGridView.DataSource = pdfManager.GetWorkDiaryList();
                WorkDiaryGridView.DataBind();

                //minuteをhourにする
                int totalWorkTime = kinmuManager.CalcGekkanTotalJitsuRoudoJikan();
                TotalWorkTimeLabel.Text = MinutesToStringFormat(totalWorkTime, "{0}時間{1:00}分");
            }
            catch (KinmuException ex)
            {
                WorkDiaryPanel.Visible = false;
                ErrorPanel.Visible     = true;
                ErrorMessageLabel.Text = dataErrorMessage + "\nErrorMessage:" + ex.Message + "\nStackTrace:" + ex.StackTrace;
            }
        }
Beispiel #2
0
        public void PDFManagerTest()
        {
            PDFManager pdfManager = new PDFManager("9017812", 2016, 10);

            Assert.IsTrue(pdfManager != null, "正常系エラー:インスタンスが生成されていません");
        }
Beispiel #3
0
 public static void Init(ICustomFontProvider customFontProvider = null, IList <Assembly> rendererAssemblies = null)
 {
     PDFManager.Init(new AndroidImageSource(), customFontProvider, rendererAssemblies);
 }
Beispiel #4
0
        private void btnFirma_Click(object sender, EventArgs e)
        {
            if (this.isModified)
            {
                if (DialogResult.No == MessageBox.Show("Per proseguire è necessario salvare i dati inseriti. Vuoi proseguire ?", "Firma documento", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    return;
                }

                if (!ValidateControls())
                {
                    return;
                }

                Save();
            }

            //if (DialogResult.No == MessageBox.Show("Selezionare una directory in cui salvare il documento." +  Environment.NewLine + "Vuoi proseguire ?", "Firma documento", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            //    return;

            //SaveFileDialog dlg = new SaveFileDialog
            //{
            //    Title = "Salvataggio Pdf",
            //    AddExtension = true,
            //    Filter = "PDF|*.pdf"
            //};

            //if (dlg.ShowDialog() != DialogResult.OK)
            //    return;

            //if (string.IsNullOrEmpty(dlg.FileName))
            //    return;

            if (cmbTemplate.SelectedIndex == 0)
            {
                MessageBox.Show("E' necessario selezionare un template valido !", "Firma documento", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.isModified = false;
                return;
            }

            string strFileNameOutput = $"{FileHelper.GetPath("pdfElab")}{user.COGNOME}" + " " + $"{user.NOME}" + " " + $"{DateTime.Today:yyyyMMdd}" + ".pdf";
            string strFileName       = PDFManager.RunSignPro(strFileNameOutput, cmbTemplate.SelectedIndex, user);

            if (string.IsNullOrEmpty(strFileName))
            {
                return;
            }

            var pathString = FirmaInCloudDB.LoadTemplate(cmbTemplate.SelectedIndex, "").AsEnumerable().First();

            FileNameParser fileNameParser = new FileNameParser(strFileName);

            TemplateLinq templateLinq = new TemplateLinq
            {
                KEY_USER  = user.KEY_USER,
                DTSIGN    = DateTime.Now,
                PATH      = strFileName,
                DESCR     = fileNameParser.DESCR,
                KEY_TEMPL = Convert.ToInt32(pathString.ItemArray[0])
            };

            FirmaInCloudDB.SaveTemplate_Linq(templateLinq, user);

            ConfigDB.SaveConfig(Config.ParamValues.COUNT, (int.Parse(ConfigDB.LoadConfig(Config.ParamValues.COUNT).CONF_VALUE) + 1).ToString());

            LoadTemplate_Linq(templateLinq);

            if (DialogResult.No == MessageBox.Show("E' possibile inviare il documento appena firmato all'indirizzo mail: " + user.MAIL + Environment.NewLine + "Vuoi proseguire ?", "Firma documento", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                return;
            }

            Mail.SendMail(strFileName, txtMail.Text, user.NOME + " " + user.COGNOME, "");
        }
Beispiel #5
0
        public void ExtractTextTest1()
        {
            PDFManager pdfManager = new PDFManager(); // TODO: Initialize to an appropriate value

            //byte[] input = File.ReadAllBytes(DiscoveryManager.GetDiscoveryPath("M:\\DFD", "http://unicode.org/charts/PDF/U0590.pdf", ".pdf"));

            byte[] input = File.ReadAllBytes(@"");


            string path = @"M:\COL\hebrew.pdf";
            string destinationFileName = @"M:\COL\hebrew1.pdf";


            PdfReader reader   = new PdfReader(path);
            int       n        = reader.NumberOfPages;
            Document  document = new Document(PageSize.A4);

            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(destinationFileName, FileMode.Create));

            int i = 0;

            document.Open();

            PdfContentByte cb = writer.DirectContent;


            PdfTemplate template = cb.CreateTemplate(0, 0);


            while (i < n)
            {
                document.NewPage();
                i++;

                PdfImportedPage importedPage = writer.GetImportedPage(reader, i);


                Image img = Image.GetInstance(importedPage);

                img.ScalePercent(100);
                document.Add(img);
                cb.AddTemplate(importedPage, 0, 100);
            }


            document.Close();
            writer.Close();


            PdfReader pdfReader = new PdfReader(input);

            StringBuilder stringBuilder = new StringBuilder();

            string dingle = string.Empty;

            for (int page = 1; page <= pdfReader.NumberOfPages; page++)
            {
                stringBuilder.Append(pdfManager.ExtractText(pdfReader.GetPageContent(page)) + " ");

                PRTokeniser prTokeniser = new PRTokeniser(pdfReader.GetPageContent(page));


                PdfDictionary pdfDictionary = pdfReader.GetPageN(page);

                byte[] dinas = pdfReader.GetPageContent(page);

                string winsdgf = Encoding.GetEncoding(1255).GetString(dinas);


                try
                {
                    while (prTokeniser.NextToken())
                    {
                        if (prTokeniser.TokenType == PRTokeniser.TokType.STRING)
                        {
                            dingle += prTokeniser.StringValue;

                            try
                            {
                                //dingle += (char)(int.Parse(prTokeniser.StringValue));

                                //dingle += iTextSharp.text.Utilities.ConvertFromUtf32(prTokeniser.FilePointer);

                                //dingle += ((char)prTokeniser.Read()).ToString();

                                dingle += prTokeniser.ReadString(2);
                                Chunk chunk = new Chunk(prTokeniser.StringValue);

                                //string wangle = PRTokeniser.GetHex(prTokeniser.IntValue).ToString();
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    {
                    }
                    //throw;
                }

                //int ij = 0;

//                #
//If Not IsNothing(pageBytes) Then
//#
//                    token = New PRTokeniser(pageBytes)
//#
//                    While token.NextToken()
//#
//                        tknType = token.TokenType()
//#
//                        tknValue = token.StringValue
//#
//                        If tknType = PRTokeniser.TK_STRING Then
//#
//                            sb.Append(token.StringValue)
//#
//                        'I need to add these additional tests to properly add whitespace to the output string
//#
//                        ElseIf tknType = 1 AndAlso tknValue = "-600" Then
//#
//                            sb.Append(" ")
//#
//                        ElseIf tknType = 10 AndAlso tknValue = "TJ" Then
//#
//                            sb.Append(" ")
//#
//                        End If
//#
//                   End While
            }

            string actual = pdfManager.ExtractText(input);
        }
Beispiel #6
0
 public OrderController()
 {
     _context      = new WarehouseEntities();
     _pdfManager   = new PDFManager();
     _orderManager = new OrderManager(_context);
 }
Beispiel #7
0
        private void GeneratePDF(object sender, EventArgs e)
        {
            var pdf = PDFManager.GeneratePDFFromView(mainGrid);

            DependencyService.Get <IPdfSave>().Save(pdf, "SinglePage.pdf");
        }
 public DispatchController()
 {
     _context         = new WarehouseEntities();
     _pdfManager      = new PDFManager();
     _dispatchManager = new DispatchManager(_context);
 }
 public DeliveryController()
 {
     _context         = new WarehouseEntities();
     _pdfManager      = new PDFManager();
     _deliveryManager = new DeliveryManager(_context);
 }