//Funções básicas OK //Necessita mais testes para validar o preenchimento de campos de 'Formulário' private void btnEditPdf_Click(object sender, EventArgs e) { if (ofdAbrirArquivo.ShowDialog() == DialogResult.OK) { using (Toolkit oTK = new Toolkit()) { oTK.OpenOutputFile(GetNewFileName(ofdAbrirArquivo, FileNameOptionEnum.Edit)); oTK.OpenInputFile(ofdAbrirArquivo.FileName); BindingList <object> blFormFieldValues = new BindingList <object>(); foreach (DictionaryEntry item in oTK.GetInputFields()) { lbKeyFormFields.Items.Add(item.Key); blFormFieldValues.Add(item.Value); } oTK.DoFormFormatting = 1; oTK.FormNumbering = 1; oTK.SetFormFieldData("topmostSubform[0].Page1[0].f1_1[0]", "Jeremy Likness", 1); //oTK.SetFormFieldData("topmostSubform[0].Page1[0].Address[0].f1_7[0]", "28202 Cabot Rd Ste 155", 1); //oTK.SetFormFieldData("topmostSubform[0].Page1[0].Address[0].f1_8[0]", "Laguna Niguel, CA 92677", 1); oTK.CopyForm(0, 0); blFormFieldValues.ToList().ForEach(x => lbValueFormFields.Items.Add(x)); oTK.CloseOutputFile(); } } }
private void btnCopiaPdf_Click(object sender, EventArgs e) { if (ofdAbrirArquivo.ShowDialog() == DialogResult.OK) { using (Toolkit oTK = new Toolkit()) { oTK.OpenOutputFile(GetNewFileName(ofdAbrirArquivo, FileNameOptionEnum.Copy)); oTK.OpenInputFile(ofdAbrirArquivo.FileName); oTK.CopyForm(0, 0); oTK.CloseOutputFile(); } } }
private void btnCompriPdf_Click(object sender, EventArgs e) { if (ofdAbrirArquivo.ShowDialog() == DialogResult.OK) { using (Toolkit oTK = new Toolkit()) { oTK.OpenInputFile(ofdAbrirArquivo.FileName); var compressor = oTK.GetCompressor(); compressor.CompressImages = true; compressor.CompressObjects = true; compressor.CompressionQuality = 20; compressor.Activate(); oTK.OpenOutputFile(GetNewFileName(ofdAbrirArquivo, FileNameOptionEnum.Compress)); oTK.CopyForm(0, 0); oTK.CloseOutputFile(); } } }