Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            debug("Started ...");

            debug("Checking certificate ...");
            Cert myCert=null;
            try
            {
                myCert = new Cert(certTextBox.Text, passwordBox.Text);
                debug("Certificate OK");
            }
            catch (Exception ex)
            {
                debug("Error : please make sure you entered a valid certificate file and password");
                debug("Exception : "+ex.ToString());
                return;
            }

            debug("Creating new MetaData ... ");

            //Adding Meta Datas
            MetaData MyMD = new MetaData();
            MyMD.Author = authorBox.Text;
            MyMD.Title = titleBox.Text;
            MyMD.Subject = subjectBox.Text;
            MyMD.Keywords = kwBox.Text;
            MyMD.Creator = creatorBox.Text;
            MyMD.Producer = prodBox.Text;

            debug("Signing document ... ");
            PDFSigner pdfs = new PDFSigner(inputBox.Text, outputBox.Text, myCert, MyMD);
            pdfs.Sign(Reasontext.Text, Contacttext.Text, Locationtext.Text, SigVisible.Checked);

            debug("Done :)");
        }
Example #2
0
 public PDFSigner(string input, string output, Cert cert, MetaData md)
 {
     this.inputPDF = input;
     this.outputPDF = output;
     this.myCert = cert;
     this.metadata = md;
 }
Example #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.OpenFileDialog openFile;
            openFile = new System.Windows.Forms.OpenFileDialog();
            openFile.Filter = "PDF files *.pdf|*.pdf";
            openFile.Title = "Select a file";
            if (openFile.ShowDialog() != DialogResult.OK)
                return;

            inputBox.Text = openFile.FileName;

            PdfReader reader = new PdfReader(inputBox.Text);

            MetaData md = new MetaData();
            md.Info = reader.Info;

            authorBox.Text = md.Author;
            titleBox.Text = md.Title;
            subjectBox.Text = md.Subject;
            kwBox.Text = md.Keywords;
            creatorBox.Text = md.Creator;
            prodBox.Text = md.Producer;
        }