Skip to content
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,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36616.10 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Multi‑Page-PDF-Radio-Button-Group-Synchronization", "Multi‑Page-PDF-Radio-Button-Group-Synchronization\Multi‑Page-PDF-Radio-Button-Group-Synchronization.csproj", "{268276E6-E841-4FDC-BA43-80B6A95921CE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{268276E6-E841-4FDC-BA43-80B6A95921CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{268276E6-E841-4FDC-BA43-80B6A95921CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{268276E6-E841-4FDC-BA43-80B6A95921CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{268276E6-E841-4FDC-BA43-80B6A95921CE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {05CFF1BA-A827-4272-A101-1018EB8FC017}
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>Multi_Page_PDF_Radio_Button_Group_Synchronization</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,53 @@
using Syncfusion.Drawing;
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Interactive;

// Create a new PDF document
using (PdfDocument document = new PdfDocument())
{
// Create two pages
PdfPage page1 = document.Pages.Add();
PdfPage page2 = document.Pages.Add();
// Access the form
PdfForm form = document.Form;
form.FieldAutoNaming = false;
// Label font
PdfFont labelFont = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Regular);
// Group name
string groupName = "EmployeesRadioGroup";
float labelOffsetX = 10f;
float labelOffsetY = -2f;
// Create ONE radio button list field (anchor it on the first page; items can be on any page)
PdfRadioButtonListField radioField = new PdfRadioButtonListField(page1, groupName)
{
// Keep standard radio behavior: only one selection in the group
AllowUnisonSelection = false
};
// Define the 4 radio items: 2 on page 1, 2 on page 2
var items = new (PdfPage page, string export, RectangleF bounds, string label)[]
{
(page1, "rb1", new RectangleF(100f, 200f, 20f, 20f), "Radio Button 1"),
(page1, "rb2", new RectangleF(100f, 240f, 20f, 20f), "Radio Button 2"),
(page2, "rb3", new RectangleF(100f, 200f, 20f, 20f), "Radio Button 3"),
(page2, "rb4", new RectangleF(100f, 240f, 20f, 20f), "Radio Button 4"),
};
// Add items to the single radio field and draw their labels
foreach (var (page, export, bounds, label) in items)
{
PdfRadioButtonListItem item = new PdfRadioButtonListItem(page, export)
{
Bounds = bounds
};
radioField.Items.Add(item);
// Label beside the radio button
page.Graphics.DrawString(label, labelFont, PdfBrushes.Black,
bounds.Right + labelOffsetX, bounds.Y + labelOffsetY);
}
// Set default selection
radioField.SelectedValue = "rb4";
// Add the single field to the form
form.Fields.Add(radioField);
// Save the PDF document
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
}
Loading