diff --git a/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field.sln b/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field.sln new file mode 100644 index 00000000..a382d5ee --- /dev/null +++ b/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field.sln @@ -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 diff --git a/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field/Add-RTL-text-in-a-textbox-field.csproj b/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field/Add-RTL-text-in-a-textbox-field.csproj new file mode 100644 index 00000000..5f635f16 --- /dev/null +++ b/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field/Add-RTL-text-in-a-textbox-field.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + Add_RTL_text_in_a_textbox_field + enable + enable + + + + + + + diff --git a/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field/Data/arial.ttf b/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field/Data/arial.ttf new file mode 100644 index 00000000..810df57c Binary files /dev/null and b/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field/Data/arial.ttf differ diff --git a/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field/Output/gitkeep.txt b/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field/Output/gitkeep.txt new file mode 100644 index 00000000..e69de29b diff --git a/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field/Program.cs b/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field/Program.cs new file mode 100644 index 00000000..691b79ad --- /dev/null +++ b/Forms/Add-RTL-text-in-a-textbox-field/.NET/Add-RTL-text-in-a-textbox-field/Program.cs @@ -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); + } +}