Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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,44 @@
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Interactive;
using Syncfusion.Drawing;

// Create a new PDF document
using (PdfDocument document = new PdfDocument())
{
// Loop through multiple pages
for (int i = 1; i <= 5; i++)
{
// Add a new page to the PDF document
PdfPage page = document.Pages.Add();
// Draw header text
page.Graphics.DrawString($"Radio Button Example - {i}",
new PdfStandardFont(PdfFontFamily.Helvetica, 20),
PdfBrushes.Black, new PointF(10, 30));
// Create a Radio Button List Field
PdfRadioButtonListField employeesRadioList = new PdfRadioButtonListField(page, $"employeesRadioList_{i}")
{
AllowUnisonSelection = false // Each button acts independently
};
// Add the radio button field to the form
document.Form.Fields.Add(employeesRadioList);
// Draw option labels
page.Graphics.DrawString("Option 1", new PdfStandardFont(PdfFontFamily.Helvetica, 12),
PdfBrushes.Black, new PointF(50, 70));
page.Graphics.DrawString("Option 2", new PdfStandardFont(PdfFontFamily.Helvetica, 12),
PdfBrushes.Black, new PointF(50, 100));
// Create radio button items with positions
PdfRadioButtonListItem radioButtonItem1 = new PdfRadioButtonListItem("Option1")
{
Bounds = new RectangleF(10, 70, 20, 20)
};
PdfRadioButtonListItem radioButtonItem2 = new PdfRadioButtonListItem("Option2")
{
Bounds = new RectangleF(10, 100, 20, 20)
};
// Add items to the radio button group
employeesRadioList.Items.Add(radioButtonItem1);
employeesRadioList.Items.Add(radioButtonItem2);
}
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
}
Loading