Skip to content

264229 Added sample for added radio button fields in multiple PDF pages #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35707.178 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adding-Radio-Buttons-to-Multiple-PDF-Pages", "Adding-Radio-Buttons-to-Multiple-PDF-Pages\Adding-Radio-Buttons-to-Multiple-PDF-Pages.csproj", "{3B91CB77-3B67-4F35-850F-19E70AA1AEA7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3B91CB77-3B67-4F35-850F-19E70AA1AEA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B91CB77-3B67-4F35-850F-19E70AA1AEA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B91CB77-3B67-4F35-850F-19E70AA1AEA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B91CB77-3B67-4F35-850F-19E70AA1AEA7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Adding_Radio_Buttons_to_Multiple_PDF_Pages</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Interactive;
using Syncfusion.Pdf;
using Syncfusion.Drawing;

//Create a new PDF document
PdfDocument document = new PdfDocument();
for (int i = 1; i <= 5; i++)
{
//Add a new page to PDF document
PdfPage page = document.Pages.Add();
//Draw string
page.Graphics.DrawString("Radio Button Example-" + i, new PdfStandardFont(PdfFontFamily.Helvetica, 20), PdfBrushes.Black, new PointF(10, 30));
//Create a Radio button
PdfRadioButtonListField employeesRadioList = new PdfRadioButtonListField(page, "employeesRadioList");
//Add the radio button into form
document.Form.Fields.Add(employeesRadioList);
page.Graphics.DrawString("Option1", new PdfStandardFont(PdfFontFamily.Helvetica, 12), PdfBrushes.Black, new PointF(50, 70));
//Create radio button items
PdfRadioButtonListItem radioButtonItem1 = new PdfRadioButtonListItem("Option1");
radioButtonItem1.Bounds = new RectangleF(10, 70, 20, 20);
page.Graphics.DrawString("Option2", new PdfStandardFont(PdfFontFamily.Helvetica, 12), PdfBrushes.Black, new PointF(50, 100));
PdfRadioButtonListItem radioButtonItem2 = new PdfRadioButtonListItem("Option2");
radioButtonItem2.Bounds = new RectangleF(10, 100, 20, 20);
//Add the items to radio button group
employeesRadioList.Items.Add(radioButtonItem1);
employeesRadioList.Items.Add(radioButtonItem2);
}
// Save the PDF document to a file
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
document.Save(outputFileStream);
}
//Close the document
document.Close(true);
Loading