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

911741 Added RTL text to the text box field sample. #141

Open
wants to merge 2 commits 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}") = "Add-RTL-text-in-a-textbox-field", "Add-RTL-text-in-a-textbox-field\Add-RTL-text-in-a-textbox-field.csproj", "{BC62D7EF-50C9-47CC-853F-4280B8F819FA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BC62D7EF-50C9-47CC-853F-4280B8F819FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC62D7EF-50C9-47CC-853F-4280B8F819FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC62D7EF-50C9-47CC-853F-4280B8F819FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC62D7EF-50C9-47CC-853F-4280B8F819FA}.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>Add_RTL_text_in_a_textbox_field</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

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

// Create a new PDF document
using (PdfDocument document = new PdfDocument())
{
// Add a page to the document
PdfPage page = document.Pages.Add();
// Create a font to be used for the text box.
PdfTrueTypeFont font = new PdfTrueTypeFont(Path.GetFullPath(@"Data/arial.ttf"), 12);
// Create a text box field with RTL text
PdfTextBoxField textBox = new PdfTextBoxField(page, "rtlTextBox");

// Set the default text (RTL text, Arabic example)
textBox.Text = "مرحبا بكم في عالم البرمجة"; // "Welcome to the world of programming" in Arabic
// Set the text direction to Right-to-Left
textBox.TextAlignment = PdfTextAlignment.Right;

textBox.Bounds = new RectangleF(10, 10, 150, 50);
// Set the font for the text box field
textBox.Font = font;
// Add the text box field to the page
document.Form.Fields.Add(textBox);

//Set default appearance as false.
document.Form.SetDefaultAppearance(false);

//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);
}
}
Loading