public static void PreserveRightsUsingFormClass()
 {
     // ExStart:PreserveRightsUsingFormClass
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_AsposePdf_Forms();
     // Input and output file paths are equal, this forces incremental update when form saved.
     Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(dataDir + "input.pdf");
     // Fill value in form field
     form.FillField("topmostSubform[0].Page1[0].f1_29_0_[0]", "Nayyer");
     // Save updated document
     form.Save(dataDir + "PreserveRightsUsingFormClass_out.pdf");
     // ExEnd:PreserveRightsUsingFormClass
 }       
Exemplo n.º 2
0
        public static void PreserveRightsUsingFormClass()
        {
            // ExStart:PreserveRightsUsingFormClass
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Forms();

            // Input and output file paths are equal, this forces incremental update when form saved.
            Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(dataDir + "input.pdf");
            // Fill value in form field
            form.FillField("topmostSubform[0].Page1[0].f1_29_0_[0]", "Nayyer");
            // Save updated document
            form.Save(dataDir + "PreserveRightsUsingFormClass_out_.pdf");
            // ExEnd:PreserveRightsUsingFormClass
        }
Exemplo n.º 3
0
        public static Boolean WritePDFForm(Aspose.Pdf.Facades.Form pdfForm,IConfiguration sampleData)
        {
            foreach (KeyValuePair<string, string> data in sampleData.AsEnumerable())
            {
                LoggerService.WriteLog(data.Key);
                LoggerService.WriteLog(data.Value);
                pdfForm.FillField(data.Key, data.Value);                
            }
            
            pdfForm.Document.Flatten();

            // Save updated file
            pdfForm.Save(Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.FullName + "\\SampleDoc\\OutputPdfFormSample.pdf");
            return true;
        }
Exemplo n.º 4
0
        public static void Run()
        {
            // ExStart:JustifyText
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();

            using (FileStream source = File.Open(dataDir + "Input1.pdf", FileMode.Open))
            {
                MemoryStream ms = new MemoryStream();

                // Create Form Object
                Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form();

                // Open Source File
                form.BindPdf(source);

                // Fill Text Field
                form.FillField("Text1", "Thank you for using Aspose");

                // Save the document in Memory Stream
                form.Save(ms);

                ms.Seek(0, SeekOrigin.Begin);

                FileStream dest = new FileStream(dataDir + "JustifyText_out.pdf", FileMode.Create);

                // Create formEditor Object
                FormEditor formEditor = new FormEditor();

                // Open PDF from memory stream
                formEditor.BindPdf(ms);

                // Set Text Alignment as Justified
                formEditor.Facade.Alignment = FormFieldFacade.AlignJustified;

                // Decorate form field.
                formEditor.DecorateField();

                // Save te resultant file.
                formEditor.Save(dest);

                // Close file stream
                dest.Close();
            }
            // ExEnd:JustifyText
        }
Exemplo n.º 5
0
        public static void Run()
        {
            // ExStart:JustifyText
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();

            using (FileStream source = File.Open(dataDir + "Input1.pdf", FileMode.Open))
            {
                MemoryStream ms = new MemoryStream();

                // Create Form Object
                Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form();

                // Open Source File
                form.BindPdf(source);

                // Fill Text Field
                form.FillField("Text1", "Thank you for using Aspose");

                // Save the document in Memory Stream
                form.Save(ms);

                ms.Seek(0, SeekOrigin.Begin);

                FileStream dest = new FileStream(dataDir + "JustifyText_out.pdf", FileMode.Create);

                // Create formEditor Object
                FormEditor formEditor = new FormEditor();

                // Open PDF from memory stream
                formEditor.BindPdf(ms);

                // Set Text Alignment as Justified
                formEditor.Facade.Alignment = FormFieldFacade.AlignJustified;

                // Decorate form field.
                formEditor.DecorateField();

                // Save te resultant file.
                formEditor.Save(dest);

                // Close file stream
                dest.Close();
            }
            // ExEnd:JustifyText                      
        }
        public static void Run()
        {
            // ExStart:FillFormFieldF
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms();

            // Create Form Object
            Aspose.Pdf.Facades.Form pdfForm = new Aspose.Pdf.Facades.Form();

            // Open Document
            pdfForm.BindPdf(dataDir + "FormField.pdf");

            // Fill the field "textfield" with "Mike".
            pdfForm.FillField("textfield", "Mike");                    
            
            // Save updated file
            pdfForm.Save( dataDir + "FillFormFieldF_out.pdf");
            // ExEnd:FillFormFieldF
        }
Exemplo n.º 7
0
        public static void Run()
        {
            // ExStart:FillFormFieldF
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms();

            // Create Form Object
            Aspose.Pdf.Facades.Form pdfForm = new Aspose.Pdf.Facades.Form();

            // Open Document
            pdfForm.BindPdf(dataDir + "FormField.pdf");

            // Fill the field "textfield" with "Mike".
            pdfForm.FillField("textfield", "Mike");

            // Save updated file
            pdfForm.Save(dataDir + "FillFormFieldF_out_.pdf");
            // ExEnd:FillFormFieldF
        }