Skip to content
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

910367_sample: Choose default value in radio button field sample. #97

Merged
merged 3 commits into from
Sep 19, 2024
Merged
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.10.35004.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Default_Value_For_Radio_Button", "Default_Value_For_Radio_Button\Default_Value_For_Radio_Button.csproj", "{7E6BEB33-2817-4832-86D2-0361BA9F4852}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7E6BEB33-2817-4832-86D2-0361BA9F4852}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E6BEB33-2817-4832-86D2-0361BA9F4852}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E6BEB33-2817-4832-86D2-0361BA9F4852}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E6BEB33-2817-4832-86D2-0361BA9F4852}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BA72A87B-3558-4578-B9C4-E7A6B1F428FE}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

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

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

<ItemGroup>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

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


// Create a new PDF document
PdfDocument document = new PdfDocument();
// Add a new page to the PDF document
PdfPage page = document.Pages.Add();

// Create a new radio button list field
PdfRadioButtonListField genderRadioList = new PdfRadioButtonListField(page, "gender");
// Create a font
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12, PdfFontStyle.Regular);

// Create a new radio button item for "Male"
PdfRadioButtonListItem radioItem1 = new PdfRadioButtonListItem("Male");
// Set the bounds for the radio button
radioItem1.Bounds = new RectangleF(90, 203, 15, 15);
// Draw the label "Male"
page.Graphics.DrawString("Male", font, PdfBrushes.Black, new RectangleF(110, 204, 180, 20));
// Add the radio button item to the list
employeesRadioList.Items.Add(radioItem1);

// Create a new radio button item for "Female"
PdfRadioButtonListItem radioItem2 = new PdfRadioButtonListItem("Female");
// Set the bounds for the radio button
radioItem2.Bounds = new RectangleF(205, 203, 15, 15);
// Draw the label "Female"
page.Graphics.DrawString("Female", font, PdfBrushes.Black, new RectangleF(225, 204, 180, 20));
// Add the radio button item to the list
employeesRadioList.Items.Add(radioItem2);
//Set the default value of the radio button field.
employeesRadioList.SelectedIndex = 1;
Sri-hari-haran-g marked this conversation as resolved.
Show resolved Hide resolved
// Add the radio button list to the form
document.Form.Fields.Add(employeesRadioList);

//Create file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the PDF document to file stream.
document.Save(outputFileStream);
}

//Close the document.
document.Close(true);

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.PDF.OCR.NET" Version="26.2.14" />
<PackageReference Include="Syncfusion.PDF.OCR.NET" Version="*" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
ocrProcessor.Settings = ocrSettings;

// Perform OCR on the loaded PDF document, providing the path to the tessdata directory
ocrProcessor.PerformOCR(loadedDocument, "../../../tessdata");
ocrProcessor.PerformOCR(loadedDocument, "tessdata");

// Create a file stream to save the OCR-processed PDF
FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create);
Expand Down
Loading