Skip to content

Commit acb477a

Browse files
committed
Merge branch 'hotfix/hotfix-v31.2.2' of https://github.com/syncfusion-content/document-processing-docs into 260329-ug
2 parents a674fc7 + c97758f commit acb477a

File tree

3 files changed

+162
-20
lines changed

3 files changed

+162
-20
lines changed

Document-Processing/PDF/PDF-Library/NET/PdfGrid.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3645,7 +3645,6 @@ using Syncfusion.Pdf;
36453645
using Syncfusion.Pdf.Graphics;
36463646
using Syncfusion.Pdf.Grid;
36473647
using Syncfusion.Drawing;
3648-
using System.Reflection.Metadata;
36493648

36503649
//Create a new PDF document.
36513650
PdfDocument pdfDocument = new PdfDocument();
@@ -3685,7 +3684,6 @@ using Syncfusion.Pdf;
36853684
using Syncfusion.Pdf.Graphics;
36863685
using Syncfusion.Pdf.Grid;
36873686
using System.Drawing;
3688-
using System.Reflection.Metadata;
36893687

36903688
//Create a new PDF document.
36913689
PdfDocument pdfDocument = new PdfDocument();
@@ -3725,7 +3723,6 @@ Imports Syncfusion.Pdf
37253723
Imports Syncfusion.Pdf.Graphics
37263724
Imports Syncfusion.Pdf.Grid
37273725
Imports Syncfusion.Drawing
3728-
Imports System.Reflection.Metadata
37293726

37303727
'Create a new PDF document.
37313728
Dim pdfDocument As New PdfDocument()
@@ -3777,7 +3774,6 @@ using Syncfusion.Pdf.Graphics;
37773774
using Syncfusion.Pdf.Grid;
37783775
using Syncfusion.Pdf;
37793776
using Syncfusion.Drawing;
3780-
using System.Reflection.Metadata;
37813777

37823778
//Create a new PDF document.
37833779
PdfDocument pdfDocument = new PdfDocument();
@@ -3832,7 +3828,6 @@ using Syncfusion.Pdf.Graphics;
38323828
using Syncfusion.Pdf.Grid;
38333829
using Syncfusion.Pdf;
38343830
using System.Drawing;
3835-
using System.Reflection.Metadata;
38363831

38373832
//Create a new PDF document.
38383833
PdfDocument pdfDocument = new PdfDocument();
@@ -3886,7 +3881,6 @@ Imports Syncfusion.Pdf
38863881
Imports Syncfusion.Pdf.Graphics
38873882
Imports Syncfusion.Pdf.Grid
38883883
Imports Syncfusion.Drawing
3889-
Imports System.Reflection.Metadata
38903884

38913885
'Create a new PDF document.
38923886
Dim pdfDocument As PdfDocument = New PdfDocument()
@@ -3948,7 +3942,6 @@ using Syncfusion.Pdf.Graphics;
39483942
using Syncfusion.Pdf.Grid;
39493943
using Syncfusion.Pdf;
39503944
using Syncfusion.Drawing;
3951-
using System.Reflection.Metadata;
39523945

39533946
//Create a new PDF document.
39543947
PdfDocument pdfDocument = new PdfDocument();
@@ -4012,7 +4005,6 @@ using Syncfusion.Pdf.Graphics;
40124005
using Syncfusion.Pdf.Grid;
40134006
using Syncfusion.Pdf;
40144007
using System.Drawing;
4015-
using System.Reflection.Metadata;
40164008

40174009
//Create a new PDF document.
40184010
PdfDocument pdfDocument = new PdfDocument();
@@ -4078,7 +4070,6 @@ Imports Syncfusion.Pdf
40784070
Imports Syncfusion.Pdf.Graphics
40794071
Imports Syncfusion.Pdf.Grid
40804072
Imports Syncfusion.Drawing
4081-
Imports System.Reflection.Metadata
40824073

40834074
'Create a new PDF document.
40844075
Dim pdfDocument As PdfDocument = New PdfDocument()
@@ -4155,7 +4146,6 @@ using Syncfusion.Pdf.Graphics;
41554146
using Syncfusion.Pdf.Grid;
41564147
using Syncfusion.Pdf;
41574148
using Syncfusion.Drawing;
4158-
using System.Reflection.Metadata;
41594149

41604150
//Create a new PDF document.
41614151
PdfDocument pdfDocument = new PdfDocument();
@@ -4206,7 +4196,6 @@ using Syncfusion.Pdf.Graphics;
42064196
using Syncfusion.Pdf.Grid;
42074197
using Syncfusion.Pdf;
42084198
using System.Drawing;
4209-
using System.Reflection.Metadata;
42104199

42114200
//Create a new PDF document.
42124201
PdfDocument pdfDocument = new PdfDocument();
@@ -4257,7 +4246,6 @@ Imports Syncfusion.Pdf
42574246
Imports Syncfusion.Pdf.Graphics
42584247
Imports Syncfusion.Pdf.Grid
42594248
Imports Syncfusion.Drawing
4260-
Imports System.Reflection.Metadata
42614249

42624250
'Create a new PDF document.
42634251
Dim pdfDocument As PdfDocument = New PdfDocument()
@@ -4320,7 +4308,6 @@ using Syncfusion.Pdf.Graphics;
43204308
using Syncfusion.Pdf.Grid;
43214309
using Syncfusion.Pdf;
43224310
using Syncfusion.Drawing;
4323-
using System.Reflection.Metadata;
43244311

43254312
//Create a new PDF document.
43264313
PdfDocument pdfDocument = new PdfDocument();
@@ -4389,7 +4376,6 @@ using Syncfusion.Pdf.Graphics;
43894376
using Syncfusion.Pdf.Grid;
43904377
using Syncfusion.Pdf;
43914378
using System.Drawing;
4392-
using System.Reflection.Metadata;
43934379

43944380
//Create a new PDF document.
43954381
PdfDocument pdfDocument = new PdfDocument();
@@ -4459,7 +4445,6 @@ Imports Syncfusion.Pdf
44594445
Imports Syncfusion.Pdf.Graphics
44604446
Imports Syncfusion.Pdf.Grid
44614447
Imports Syncfusion.Drawing
4462-
Imports System.Reflection.Metadata
44634448

44644449
'Create a new PDF document.
44654450
Dim pdfDocument As PdfDocument = New PdfDocument()
@@ -4535,7 +4520,6 @@ The following code illustrates how to create the nested table in a PDF document
45354520
using Syncfusion.Pdf.Grid;
45364521
using Syncfusion.Pdf;
45374522
using Syncfusion.Drawing;
4538-
using System.Reflection.Metadata;
45394523

45404524
//Create a new PDF document.
45414525
PdfDocument pdfDocument = new PdfDocument();
@@ -4590,7 +4574,6 @@ pdfDocument.Close(true);
45904574
using Syncfusion.Pdf.Grid;
45914575
using Syncfusion.Pdf;
45924576
using System.Drawing;
4593-
using System.Reflection.Metadata;
45944577

45954578
//Create a new PDF document.
45964579
PdfDocument pdfDocument = new PdfDocument();
@@ -4645,7 +4628,6 @@ pdfDocument.Close(true);
46454628
Imports Syncfusion.Pdf
46464629
Imports Syncfusion.Pdf.Grid
46474630
Imports Syncfusion.Drawing
4648-
Imports System.Reflection.Metadata
46494631

46504632
'Create a new PDF document.
46514633
Dim pdfDocument As PdfDocument = New PdfDocument()

Document-Processing/PDF/PDF-Library/NET/Working-with-HyperLinks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ To open a file in relative path, the [PdfLaunchAction](https://help.syncfusion.c
559559

560560
{% endhighlight %}
561561

562-
{% highlight c# tabtitle="C#" [Windows-specific] %}
562+
{% highlight c# tabtitle="C# [Windows-specific]" %}
563563

564564
using Syncfusion.Pdf;
565565
using Syncfusion.Pdf.Interactive;
@@ -587,7 +587,7 @@ document.Close();
587587

588588
{% endhighlight %}
589589

590-
{% highlight vb.net tabtitle="VB.NET" [Windows-specific] %}
590+
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
591591

592592
Imports Syncfusion.Pdf
593593
Imports Syncfusion.Pdf.Interactive

Document-Processing/PDF/PDF-Library/NET/Working-with-Text.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,166 @@ document.Close(True)
798798

799799
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Text/Measure-tilting-space-in-PDF/.NET).
800800

801+
## Unit conversion in text layout
802+
803+
The [PdfUnitConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfUnitConvertor.html) class is used to accurately position and layout paragraph text within a PDF document. By converting measurements from inches to points, it ensures consistent margins and precise placement of content.
804+
805+
This example demonstrates how to use converted units to accurately position and format paragraph text within a PDF document.
806+
807+
{% tabs %}
808+
809+
{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/PDF-Examples/master/Text/Unit-conversion-in-text-layout/.NET/Unit-conversion-in-text-layout/Program.cs" %}
810+
811+
using Syncfusion.Pdf;
812+
using Syncfusion.Pdf.Graphics;
813+
using Syncfusion.Drawing;
814+
815+
// Create a new PDF document
816+
using (PdfDocument document = new PdfDocument())
817+
{
818+
// Add a page
819+
PdfPage page = document.Pages.Add();
820+
821+
// Initialize unit converter
822+
PdfUnitConverter converter = new PdfUnitConverter();
823+
824+
// Convert margins from inches to points
825+
float margin = converter.ConvertUnits(1f, PdfGraphicsUnit.Inch, PdfGraphicsUnit.Point);
826+
827+
// Define text bounds to fill the page with margins
828+
RectangleF textBounds = new RectangleF(
829+
margin,
830+
margin,
831+
page.Graphics.ClientSize.Width - 2 * margin,
832+
page.Graphics.ClientSize.Height - 2 * margin
833+
);
834+
835+
// Define font and paragraph text
836+
PdfFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 14);
837+
838+
string paragraphText = "Adventure Works Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets. While its base operation is located in Washington with 290 employees, several regional sales teams are located throughout their market base.";
839+
840+
// Create text element and layout format
841+
PdfTextElement textElement = new PdfTextElement(paragraphText, font, PdfBrushes.Black);
842+
843+
PdfLayoutFormat layoutFormat = new PdfLayoutFormat
844+
{
845+
Break = PdfLayoutBreakType.FitPage,
846+
Layout = PdfLayoutType.Paginate
847+
};
848+
849+
// Draw the paragraph text within the bounds
850+
textElement.Draw(page, textBounds, layoutFormat);
851+
852+
//Save the document
853+
document.Save("Output.pdf");
854+
}
855+
856+
{% endhighlight %}
857+
858+
{% highlight c# tabtitle="C# [Windows-specific]" %}
859+
860+
using Syncfusion.Pdf;
861+
using Syncfusion.Pdf.Graphics;
862+
using System.Drawing;
863+
864+
// Create a new PDF document
865+
using (PdfDocument document = new PdfDocument())
866+
{
867+
// Add a page
868+
PdfPage page = document.Pages.Add();
869+
870+
// Initialize unit converter
871+
PdfUnitConverter converter = new PdfUnitConverter();
872+
873+
// Convert margins from inches to points
874+
float margin = converter.ConvertUnits(1f, PdfGraphicsUnit.Inch, PdfGraphicsUnit.Point);
875+
876+
// Define text bounds to fill the page with margins
877+
RectangleF textBounds = new RectangleF(
878+
margin,
879+
margin,
880+
page.Graphics.ClientSize.Width - 2 * margin,
881+
page.Graphics.ClientSize.Height - 2 * margin
882+
);
883+
884+
// Define font and paragraph text
885+
PdfFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 14);
886+
887+
string paragraphText = "Adventure Works Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets. While its base operation is located in Washington with 290 employees, several regional sales teams are located throughout their market base.";
888+
889+
// Create text element and layout format
890+
PdfTextElement textElement = new PdfTextElement(paragraphText, font, PdfBrushes.Black);
891+
892+
PdfLayoutFormat layoutFormat = new PdfLayoutFormat
893+
{
894+
Break = PdfLayoutBreakType.FitPage,
895+
Layout = PdfLayoutType.Paginate
896+
};
897+
898+
// Draw the paragraph text within the bounds
899+
textElement.Draw(page, textBounds, layoutFormat);
900+
901+
//Save the document
902+
document.Save("Output.pdf");
903+
}
904+
905+
{% endhighlight %}
906+
907+
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
908+
909+
Imports Syncfusion.Pdf
910+
Imports Syncfusion.Pdf.Graphics
911+
Imports System.Drawing
912+
913+
Module Program
914+
Sub Main()
915+
' Create a new PDF document
916+
Using document As New PdfDocument()
917+
918+
' Add a page
919+
Dim page As PdfPage = document.Pages.Add()
920+
921+
' Initialize unit converter
922+
Dim converter As New PdfUnitConverter()
923+
924+
' Convert 1 inch margin to points
925+
Dim margin As Single = converter.ConvertUnits(1.0F, PdfGraphicsUnit.Inch, PdfGraphicsUnit.Point)
926+
927+
' Define text bounds to fill the page with margins
928+
Dim textBounds As New RectangleF(
929+
margin,
930+
margin,
931+
page.Graphics.ClientSize.Width - 2 * margin,
932+
page.Graphics.ClientSize.Height - 2 * margin
933+
)
934+
935+
' Define font and paragraph text
936+
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.TimesRoman, 14)
937+
Dim paragraphText As String = "Adventure Works Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets. While its base operation is located in Washington with 290 employees, several regional sales teams are located throughout their market base."
938+
939+
' Create text element and layout format
940+
Dim textElement As New PdfTextElement(paragraphText, font, PdfBrushes.Black)
941+
Dim layoutFormat As New PdfLayoutFormat With {
942+
.Break = PdfLayoutBreakType.FitPage,
943+
.Layout = PdfLayoutType.Paginate
944+
}
945+
946+
text within the bounds
947+
textElement.Draw(page, textBounds, layoutFormat)
948+
949+
' Save the document
950+
document.Save("Output.pdf")
951+
End Using
952+
End Sub
953+
End Module
954+
955+
{% endhighlight %}
956+
957+
{% endtabs %}
958+
959+
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Text/Unit-conversion-in-text-layout/.NET).
960+
801961
## Embedding fonts and working with Unicode text
802962

803963
To embed a font or display Unicode text in the document, the ‘Unicode’ Boolean parameter of the [PdfTrueTypeFont](https://help.syncfusion.com/cr/document-processing/Syncfusion.Pdf.Graphics.PdfTrueTypeFont.html#Syncfusion_Pdf_Base__ctor) constructor has to be set to true. The following code illustrates the same.

0 commit comments

Comments
 (0)