Skip to content

Commit 187ee57

Browse files
committed
Updated Example to add unicode text
1 parent 6786932 commit 187ee57

File tree

6 files changed

+156
-0
lines changed

6 files changed

+156
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.13.35617.110 d17.13
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Display_unicode_text_in_formfields_of_PDF_document", "Display_unicode_text_in_formfields_of_PDF_document\Display_unicode_text_in_formfields_of_PDF_document.csproj", "{8DE76E38-6547-4345-A1A2-34A10F488A23}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{8DE76E38-6547-4345-A1A2-34A10F488A23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{8DE76E38-6547-4345-A1A2-34A10F488A23}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{8DE76E38-6547-4345-A1A2-34A10F488A23}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{8DE76E38-6547-4345-A1A2-34A10F488A23}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {7A440092-D71E-4040-BCAD-C7E01DCEA5CE}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#$€$@ - Sample unicode text
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{8DE76E38-6547-4345-A1A2-34A10F488A23}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>Display_unicode_text_in_formfields_of_PDF_document</RootNamespace>
10+
<AssemblyName>Display_unicode_text_in_formfields_of_PDF_document</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="Syncfusion.Compression.Base, Version=29.2462.11.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
37+
<HintPath>..\packages\Syncfusion.Compression.Base.29.2.11\lib\net462\Syncfusion.Compression.Base.dll</HintPath>
38+
</Reference>
39+
<Reference Include="Syncfusion.Licensing, Version=29.2462.11.0, Culture=neutral, PublicKeyToken=632609b4d040f6b4, processorArchitecture=MSIL">
40+
<HintPath>..\packages\Syncfusion.Licensing.29.2.11\lib\net462\Syncfusion.Licensing.dll</HintPath>
41+
</Reference>
42+
<Reference Include="Syncfusion.Pdf.Base, Version=29.2462.11.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
43+
<HintPath>..\packages\Syncfusion.Pdf.WinForms.29.2.11\lib\net462\Syncfusion.Pdf.Base.dll</HintPath>
44+
</Reference>
45+
<Reference Include="System" />
46+
<Reference Include="System.Core" />
47+
<Reference Include="System.Drawing" />
48+
<Reference Include="System.Xml.Linq" />
49+
<Reference Include="System.Data.DataSetExtensions" />
50+
<Reference Include="Microsoft.CSharp" />
51+
<Reference Include="System.Data" />
52+
<Reference Include="System.Net.Http" />
53+
<Reference Include="System.Xml" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<Compile Include="Program.cs" />
57+
<Compile Include="Properties\AssemblyInfo.cs" />
58+
</ItemGroup>
59+
<ItemGroup>
60+
<None Include="App.config" />
61+
<None Include="packages.config" />
62+
</ItemGroup>
63+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
64+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using Syncfusion.Pdf;
2+
using Syncfusion.Pdf.Graphics;
3+
using Syncfusion.Pdf.Interactive;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Drawing;
7+
using System.IO;
8+
using System.Linq;
9+
using System.Text;
10+
using System.Threading.Tasks;
11+
12+
namespace Display_unicode_text_in_formfields_of_PDF_document
13+
{
14+
internal class Program
15+
{
16+
static void Main(string[] args)
17+
{
18+
//Create a new PDF document.
19+
PdfDocument document = new PdfDocument();
20+
21+
//Add a page to the document.
22+
PdfPage page = document.Pages.Add();
23+
24+
//Create PDF graphics for the page.
25+
PdfGraphics graphics = page.Graphics;
26+
27+
//Use the system installed font
28+
PdfFont font = new PdfTrueTypeFont(new Font("Arial Unicode MS", 14), true);
29+
30+
//Read the unicode text from the text file.
31+
StreamReader reader = new StreamReader(@"../../Data/Input.txt", Encoding.UTF8);
32+
string text = reader.ReadToEnd();
33+
reader.Close();
34+
35+
// Create the new PDF text box field.
36+
PdfTextBoxField textField = new PdfTextBoxField(page, "textBox");
37+
// Set bounds.
38+
textField.Bounds = new RectangleF(10, 10, 200, 30);
39+
40+
textField.Text = text;
41+
// Set font.
42+
textField.Font = font;
43+
// Add the field to the form collection.
44+
document.Form.Fields.Add(textField);
45+
46+
47+
//Save the document.
48+
document.Save("../../Data/Output.pdf");
49+
50+
//Close the document.
51+
document.Close(true);
52+
}
53+
}
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Syncfusion.Compression.Base" version="29.2.11" targetFramework="net472" />
4+
<package id="Syncfusion.Licensing" version="29.2.11" targetFramework="net472" />
5+
<package id="Syncfusion.Pdf.WinForms" version="29.2.11" targetFramework="net472" />
6+
</packages>

0 commit comments

Comments
 (0)