public static void Main()
        {
            // NOTE:
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            string pathToFile = "SubmitResetFormActions.pdf";

            using (PdfDocument pdf = new PdfDocument())
            {
                PdfPage    page    = pdf.Pages[0];
                PdfTextBox textBox = page.AddTextBox("sample_textbox", 10, 50, 100, 15);
                textBox.Text = "Hello";

                PdfCheckBox checkBox = page.AddCheckBox("sample_checkbox", 10, 70, 100, 15, "Check me");
                checkBox.Checked = true;

                PdfRadioButton radioButton = page.AddRadioButton("radio", 10, 90, 100, 15, "Select me!");
                radioButton.ExportValue = "radio1";
                radioButton.Checked     = true;

                PdfRadioButton radioButton2 = page.AddRadioButton("radio", 10, 110, 100, 15, "No, select me!");
                radioButton2.ExportValue = "radio2";
                radioButton2.Checked     = false;

                PdfButton submitButton = page.AddButton(10, 130, 45, 20);
                submitButton.Text = "Submit";
                PdfSubmitFormAction submitAction = pdf.CreateSubmitFormAction(new Uri("http://bitmiracle.com/login.php"));
                submitAction.SubmitFormat = PdfSubmitFormat.Html;
                submitAction.SubmitMethod = PdfSubmitMethod.Get;
                submitAction.AddControl(textBox);
                submitAction.AddControl(checkBox);
                submitAction.AddControl(radioButton);
                submitAction.AddControl(radioButton2);
                submitButton.OnMouseDown = submitAction;

                PdfButton resetButton = page.AddButton(65, 130, 45, 20);
                resetButton.Text = "Reset";
                PdfResetFormAction resetAction = pdf.CreateResetFormAction();
                resetAction.AddControl(textBox);
                resetAction.AddControl(checkBox);
                resetAction.AddControl(radioButton);
                resetAction.AddControl(radioButton2);
                resetButton.OnMouseDown = resetAction;

                pdf.Save(pathToFile);
            }

            Process.Start(pathToFile);
        }
        public static void Main()
        {
            // NOTE:
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            string pathToFile = "HideAction.pdf";

            using (PdfDocument pdf = new PdfDocument())
            {
                PdfPage page = pdf.Pages[0];

                PdfButton hideeButton = page.AddButton(45, 85, 70, 25);
                hideeButton.Text = "Button";

                PdfTextBox hideeTextBox = page.AddTextBox(45, 120, 70, 25);
                hideeTextBox.Text = "TextBox";

                PdfHideAction hideAction = pdf.CreateHideAction(true);
                hideAction.AddControl(hideeButton);
                hideAction.AddControl(hideeTextBox);

                PdfHideAction showAction = pdf.CreateHideAction(false);
                showAction.AddControl(hideeButton);
                showAction.AddControl(hideeTextBox);

                PdfButton showButton = page.AddButton("showBtn", 10, 50, 70, 25);
                showButton.Text      = "Show controls";
                showButton.OnMouseUp = showAction;

                PdfButton hideButton = page.AddButton("hideBtn", 90, 50, 70, 25);
                hideButton.Text      = "Hide controls";
                hideButton.OnMouseUp = hideAction;

                pdf.Save(pathToFile);
            }

            Console.WriteLine($"The output is located in {Environment.CurrentDirectory}");
        }
Beispiel #3
0
        public static void Main()
        {
            // NOTE:
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            string pathToFile = "AddAnnotationsAndControlsToLayers.pdf";

            using (PdfDocument pdf = new PdfDocument())
            {
                pdf.PageMode = PdfPageMode.UseOC;

                PdfLayer buttonsLayer = pdf.CreateLayer("Buttons");
                PdfLayer textLayer    = pdf.CreateLayer("Text");

                PdfPage page = pdf.Pages[0];

                int top    = 100;
                int height = 50;
                foreach (string name in new string[] { "Button 1", "Button 2", "Button 3" })
                {
                    PdfButton button = page.AddButton(name, new PdfRectangle(10, top, 100, height));
                    button.Text  = name;
                    button.Layer = buttonsLayer;

                    top += height + 10;
                }

                top    = 100;
                height = 50;
                foreach (string title in new string[] { "Text 1", "Text 2", "Text 3" })
                {
                    PdfTextAnnotation annot = page.AddTextAnnotation(new PdfPoint(200, top), title);
                    annot.Layer = textLayer;
                    top        += height + 10;
                }

                pdf.Save(pathToFile);
            }

            Console.WriteLine($"The output is located in {Environment.CurrentDirectory}");
        }
Beispiel #4
0
        public static void Main()
        {
            // NOTE:
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            string pathToFile = "ButtonImage.pdf";

            using (PdfDocument pdf = new PdfDocument())
            {
                PdfPage page = pdf.Pages[0];

                PdfButton button = page.AddButton(10, 50, 100, 100);
                button.Image  = pdf.AddImage(@"..\Sample Data\pink.png");
                button.Layout = PdfButtonLayout.ImageOnly;

                pdf.Save(pathToFile);
            }

            Console.WriteLine($"The output is located in {Environment.CurrentDirectory}");
        }
Beispiel #5
0
        public static void Main()
        {
            // NOTE:
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            string pathToFile = "ButtonImage.pdf";

            using (PdfDocument pdf = new PdfDocument())
            {
                PdfPage page = pdf.Pages[0];

                PdfButton button = page.AddButton(10, 50, 100, 100);
                button.Image  = pdf.AddImage(@"Sample Data\\pink.png");
                button.Layout = PdfButtonLayout.ImageOnly;

                pdf.Save(pathToFile);
            }

            Process.Start(pathToFile);
        }
        public static void Main()
        {
            // NOTE:
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            string pathToFile = "Buttons.pdf";

            using (PdfDocument pdf = new PdfDocument())
            {
                PdfPage page = pdf.Pages[0];

                PdfButton button = page.AddButton(10, 50, 100, 50);
                button.BackgroundColor = new PdfGrayColor(60);
                button.Border.Color    = new PdfRgbColor(128, 0, 128);
                button.Text            = "Button";

                pdf.Save(pathToFile);
            }

            Console.WriteLine($"The output is located in {Environment.CurrentDirectory}");
        }
Beispiel #7
0
        public static void Main()
        {
            // NOTE:
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            string pathToFile = "Buttons.pdf";

            using (PdfDocument pdf = new PdfDocument())
            {
                PdfPage page = pdf.Pages[0];

                PdfButton button = page.AddButton(10, 50, 100, 50);
                button.BackgroundColor = new PdfGrayColor(60);
                button.BorderColor     = new PdfRgbColor(128, 0, 128);
                button.Text            = "Button";

                pdf.Save(pathToFile);
            }

            Process.Start(pathToFile);
        }