Skip to content

Commit 09b21e0

Browse files
committed
Updated READMEs in Text group
1 parent 1e0f014 commit 09b21e0

File tree

17 files changed

+133
-59
lines changed

17 files changed

+133
-59
lines changed
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
# Character spacing
2-
This sample shows how to change character spacing using PdfCanvas.CharacterSpacing property.
1+
# Change character spacing of PDF canvas in C# and VB.NET
32

4-
Character spacing defines a distance between adjacent characters in a line of text.
3+
This sample shows how to change character spacing using [Docotic.Pdf library](https://bitmiracle.com/pdf-library/).
4+
5+
## Description
6+
7+
Use the [PdfCanvas.CharacterSpacing](https://api.docotic.com/pdfcanvas-characterspacing) property to specify the amount of space to add to each glyph’s displacement. The character spacing defines a distance between adjacent characters in a line of text.
8+
9+
## See also
10+
* [Get free time-limited license key](https://bitmiracle.com/pdf-library/download)
11+
* [Using horizontal scaling for PDF text in C# and VB.NET](/Samples/Text/TextHorizontalScaling)
12+
* [Change word spacing on a PDF canvas in C# and VB.NET](/Samples/Text/WordSpacing)

Samples/Text/DrawText/README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
# Draw text
2-
This sample shows how to draw text on a canvas.
1+
# Draw text on PDF canvas in C# and VB.NET
32

4-
To draw text on a canvas, use PdfCanvas.DrawString or PdfCanvas.DrawText method. These methods draw text using current canvas font.
3+
This sample shows how to draw text on a canvas using [Docotic.Pdf library](https://bitmiracle.com/pdf-library/).
54

6-
DrawString method draws a single line of text from the current text position (take a look at PdfCanvas.TextPosition property) or inscribed in specified rectangle. DrawText method allows to draw multiple lines of text.
5+
The code uses Canvas API that can add text to any PDF document. If you are going to create a new PDF, then consider using Layout API that can [make PDF generation easier](https://bitmiracle.com/pdf-library/layout/).
6+
7+
## Description
8+
9+
To draw text on a canvas, use the [PdfCanvas.DrawString](https://api.docotic.com/pdfcanvas-drawstring) or [PdfCanvas.DrawText](https://api.docotic.com/pdfcanvas-drawtext) methods. These methods draw text using the [current canvas font](https://api.docotic.com/pdfcanvas-font).
10+
11+
`DrawString` methods draw a single line of text either from the [current text position](https://api.docotic.com/pdfcanvas-textposition) or inscribed in the specified rectangle. The `DrawText` method can draw multiple lines of text.
12+
13+
## See also
14+
* [Get free time-limited license key](https://bitmiracle.com/pdf-library/download)
15+
* [Add new text](https://bitmiracle.com/pdf-library/edit/#add-text)
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
# Draw text from baseline
1+
# Draw text from the baseline in C# and VB.NET
2+
23
This sample shows how to draw text starting at font's baseline.
34

4-
PdfCanvas.DrawString method draws string starting at left-top corner of the text rectangle. To draw text starting at font's baseline, calculate the distance between the baseline and the top coordinate of the text rectangle.
5+
## Description
6+
7+
[PdfCanvas.DrawString](https://api.docotic.com/pdfcanvas-drawstring) methods draw text starting at the left-top corner of the text rectangle. To draw text starting at font's baseline, calculate the distance between the baseline and the top coordinate of the text rectangle.
8+
9+
The [PdfFont.TopSideBearing](https://api.docotic.com/pdffont-topsidebearing) property retrieves the distance between the baseline and the top of the font's bounding box. `TopSideBearing` expressed in the glyph coordinate system. Use the value of the [PdfFont.TransformationMatrix](https://api.docotic.com/pdffont-transformationmatrix) property to map `TopSideBearing` to the canvas coordinate system.
510

6-
PdfFont.TopSideBearing property retrieves the distance between the baseline and the top of the font's bounding box. TopSideBearing expressed in the glyph coordinate system. Use PdfFont.TransformationMatrix to map TopSideBearing to the canvas coordinate system.
11+
For all PDF fonts except some tricky Type3 fonts, `TransformationMatrix` has the following structure: `{ M11, 0, 0, M22, 0, 0 }`. For such fonts, map `TopSideBearing` to the canvas coordinate system using this formula: `font.TopSideBearing * font.TransformationMatrix.M22 * canvas.FontSize`.
712

8-
For all PDF fonts except some tricky Type3 fonts, TransformationMatrix has the following structure: { M11, 0, 0, M22, 0, 0 }. For such fonts, map TopSideBearing to the canvas coordinate system by this formula: font.TopSideBearing * font.TransformationMatrix.M22 * canvas.FontSize.
13+
With `TopSideBearing`, expressed in the canvas coordinate system, you can draw text using a `DrawString` method. Convert the baseline coordinate to the top coordinate of the text rectangle using this formula: `top = (baselineY - topSideBearingCanvasSpace)`. Finally, use calculated top coordinate for a `DrawString` call to draw text starting at the baseline position.
914

10-
With TopSideBearing, expressed in the canvas coordinate system, you can draw text using DrawString method. Convert baseline coordinate to the top coordinate of the text rectangle by this formula: top = (baselineY - topSideBearingCanvasSpace). Finally, pass calculated top coordinate to DrawString method to draw text starting at the baseline position.
15+
## See also
16+
* [Get free time-limited license key](https://bitmiracle.com/pdf-library/download)
17+
* [Draw text on PDF canvas in C# and VB.NET](/Samples/Text/DrawText)

Samples/Text/EmbedFonts/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Embed PDF fonts in C# and VB.NET
22
This sample shows how to embed fonts in a PDF document using [Docotic.Pdf library](https://bitmiracle.com/pdf-library/).
33

4-
Use [PdfFont.Embed()](https://bitmiracle.com/pdf-library/api/pdffont-embed) method to embed the given font in a PDF document.
5-
By default, this method uses [SystemFontLoader](https://bitmiracle.com/pdf-library/api/systemfontloader) to load bytes for TrueType/OpenType fonts.
4+
Use the [PdfFont.Embed](https://api.docotic.com/pdffont-embed) method to embed a font in a PDF document.
5+
By default, this method uses [SystemFontLoader](https://api.docotic.com/systemfontloader) to load bytes for TrueType/OpenType fonts.
66

77
This sample shows how to embed TrueType font bytes using fonts from a custom directory.
88

99
Embedding of PDF fonts is useful when you need to:
1010
* Display or print a PDF document consistently on any devices.
1111
* Fix an existing PDF document with non-embedded fonts.
1212
* Replace an existing PDF font subset with a full font to use in editable form fields.
13-
* Produce PDF/A document.
13+
* Produce a PDF/A document.
1414

1515
Note that embedding of PDF fonts can significantly increase an output file size.
1616

Samples/Text/ExtractText/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Convert PDF to text in C# and VB.NET
2-
This sample shows how to extract text from PDF document or from a PDF page in C# and VB.NET.
2+
This sample shows how to extract text from a PDF document or from a PDF page in C# and VB.NET.
33

4-
Use [PdfDocument.GetText()](https://bitmiracle.com/pdf-library/api/pdfdocument-gettext) or [PdfPage.GetText()](https://bitmiracle.com/pdf-library/api/pdfpage-gettext) methods to extract text in plain text format. You can also use [PdfCanvas.GetTextData() method](https://bitmiracle.com/pdf-library/api/pdfcanvas-gettextdata) to extract text chunks with their coordinates.
4+
Use [PdfDocument.GetText](https://api.docotic.com/pdfdocument-gettext) or [PdfPage.GetText](https://api.docotic.com/pdfpage-gettext) methods to extract text in plain text format. You can also use [PdfCanvas.GetTextData method](https://api.docotic.com/pdfcanvas-gettextdata) to extract text chunks with their coordinates.
55

6-
Alternative methods are [PdfDocument.GetTextWithFormatting()](https://bitmiracle.com/pdf-library/api/pdfdocument-gettextwithformatting) and [PdfPage.GetTextWithFormatting()](https://bitmiracle.com/pdf-library/api/pdfpage-gettextwithformatting). These methods will extract text with formatting. Formatting means that all relative text positions will be kept after extraction and text will look more readable. Extracting text with formatting may be especially useful for PDF documents with tabular data.
6+
The alternative methods are [PdfDocument.GetTextWithFormatting](https://api.docotic.com/pdfdocument-gettextwithformatting) and [PdfPage.GetTextWithFormatting](https://api.docotic.com/pdfpage-gettextwithformatting). These methods extract text with formatting. Formatting means that all relative text positions will be kept after extraction and the text will look more readable. Extracting text with formatting may be especially useful for PDF documents with tabular data.
77

88
## See also
99
* [Get free time-limited license key](https://bitmiracle.com/pdf-library/download)
10-
* [Extract text from PDF in C# and VB.NET](https://bitmiracle.com/pdf-library/pdf-text/extract) article
10+
* [Extract text from PDF in C# and VB.NET](https://bitmiracle.com/pdf-library/pdf-text/extract)
1111
* [Find and highlight text in a PDF document](/Samples/Text/FindAndHighlightText) sample
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Extract text from PDF by words
22
This sample shows how to extract text by words from a PDF page in C# and VB.NET.
33

4-
[Docotic.Pdf library](https://bitmiracle.com/pdf-library/) allows you to read PDF text with detailed information (position, font, color) about every text chunk. Use [PdfPage.GetWords() method](https://bitmiracle.com/pdf-library/api/pdfpage-getwords) to extract information about all words with their coordinates from a PDF page.
4+
[Docotic.Pdf library](https://bitmiracle.com/pdf-library/) allows you to read PDF text with detailed information (position, font, color) about every text chunk. Use the [PdfPage.GetWords method](https://api.docotic.com/pdfpage-getwords) to extract information about all words with their coordinates on a PDF page.
55

66
## See also
77
* [Get free time-limited license key](https://bitmiracle.com/pdf-library/download)
8-
* [Extract text from PDF in C# and VB.NET](https://bitmiracle.com/pdf-library/pdf-text/extract) article
8+
* [Extract text from PDF in C# and VB.NET](https://bitmiracle.com/pdf-library/pdf-text/extract)
99
* [Find and highlight text in a PDF document](/Samples/Text/FindAndHighlightText) sample
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Find and highlight text in PDF document
22
This sample shows how to find and highlight phrase in a PDF document in C# and VB.NET.
33

4-
Use [PdfPage.GetWords() method](https://bitmiracle.com/pdf-library/api/pdfpage-getwords) to extract information about all words from PDF page. Find your phrase in the collection of words. Then highlight the result using [PdfPage.AddHighlightAnnotation method](https://bitmiracle.com/pdf-library/api/pdfpage-addhighlightannotation).
4+
Use the [PdfPage.GetWords method](https://api.docotic.com/pdfpage-getwords) to extract information about all words on a PDF page. Find your phrase in the collection of words. Then highlight the result using the [PdfPage.AddHighlightAnnotation method](https://api.docotic.com/pdfpage-addhighlightannotation).
55

66
## See also
77
* [Get free time-limited license key](https://bitmiracle.com/pdf-library/download)
8-
* [Extract text from PDF in C# and VB.NET](https://bitmiracle.com/pdf-library/pdf-text/extract) article
8+
* [Extract text from PDF in C# and VB.NET](https://bitmiracle.com/pdf-library/pdf-text/extract)
99
* [OCR PDF and convert to searchable document](/Samples/Text/OcrAndMakeSearchable) sample

Samples/Text/FixGarbledText/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ There are searchable PDF documents that look just fine. But it’s not possible
55

66
This happens when the document does not contain mappings of glyphs to Unicode characters. Or contains incorrect mappings.
77

8-
There is [PdfTextExtractionOptions.UnmappedCharacterHandler](https://bitmiracle.com/pdf-library/api/pdftextextractionoptions-unmappedcharactercodehandler) property. This sample shows how to perform OCR for unmapped characters and then replace them with correct Unicode values.
8+
There is the [PdfTextExtractionOptions.UnmappedCharacterHandler](https://api.docotic.com/pdftextextractionoptions-unmappedcharactercodehandler) property. This sample shows how to perform OCR for unmapped characters and then replace them with correct Unicode values.
99

1010
This sample uses [Docotic.Pdf library](https://bitmiracle.com/pdf-library/) and [Tesseract OCR Engine](https://github.com/charlesw/tesseract). You would also need to have [Visual Studio 2015-2019 x86 & x64 runtimes](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) installed.
1111

1212
## See also
13-
* [OCR PDF in C# and VB.NET](https://bitmiracle.com/blog/ocr-pdf-in-net) article
14-
* [Extract text from PDF in C# and VB.NET](https://bitmiracle.com/pdf-library/pdf-text/extract) article
15-
* [Get free time-limited license key for Docotic.Pdf](https://bitmiracle.com/pdf-library/download)
13+
* [Get free time-limited license key for Docotic.Pdf](https://bitmiracle.com/pdf-library/download)
14+
* [OCR PDF in C# and VB.NET](https://bitmiracle.com/blog/ocr-pdf-in-net)
15+
* [Extract text from PDF in C# and VB.NET](https://bitmiracle.com/pdf-library/pdf-text/extract)

Samples/Text/Fonts/README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
# Fonts
2-
This sample shows how to use fonts in Docotic.Pdf library.
1+
# Using PDF fonts in C# and VB.NET
32

4-
Docotic.Pdf library provides several ways to add fonts to PDF document. You can add a font from a file using PdfDocument.AddFontFromFile(..) method. This method supports TrueType fonts, TrueType font collections and Type1 fonts.
3+
This sample shows how to use PDF fonts in [Docotic.Pdf library](https://bitmiracle.com/pdf-library/).
54

6-
You can also add any font installed on your system, a one of 14 built-in fonts or a font created from a System.Drawing.Font object using PdfDocument.AddFont(..) method. The names of 14 built-in PDF fonts are in PdfBuiltInFont enumeration.
5+
The code uses Canvas API that can work with fonts in new and existing PDF documents. If you are going to create a new PDF, then consider using Layout API that can [make PDF generation easier](https://bitmiracle.com/pdf-library/layout/).
76

8-
You can specify a font to use on canvas using PdfCanvas.Font property. PdfCanvas.FontSize property specifies the size of a font.
7+
## Description
8+
9+
The library provides several ways to add fonts to PDF documents. You can add a font from a file using one of the [PdfDocument.AddFontFromFile](https://api.docotic.com/pdfdocument-addfontfromfile) methods. This method supports TrueType fonts, TrueType font collections, and Type1 fonts.
10+
11+
[PdfDocument.AddFont](https://api.docotic.com/pdfdocument-addfont) methods can add any font installed on your system, a one of 14 built-in fonts or a font created from a `System.Drawing.Font` object. The names of 14 built-in PDF fonts are in the [PdfBuiltInFont](https://api.docotic.com/pdfbuiltinfont) enumeration.
12+
13+
You can specify a font to use for a canvas text by using the [PdfCanvas.Font](https://api.docotic.com/pdfcanvas-font) property. The [PdfCanvas.FontSize](https://api.docotic.com/pdfcanvas-fontsize) property specifies the size of the font.
14+
15+
## See also
16+
* [Get free time-limited license key](https://bitmiracle.com/pdf-library/download)
17+
* [Unicode text in PDF using C# and VB.NET](/Samples/Text/Internationalization)
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
# Internationalization
2-
This sample shows how to draw text in different languages.
1+
# Unicode text in PDF using C# and VB.NET
32

4-
Docotic.Pdf library can be used to draw text in any language. Note, that current canvas font should support characters in a text that is to be drawn.
3+
This sample shows how to draw text in different languages using [Docotic.Pdf library](https://bitmiracle.com/pdf-library/).
4+
5+
The code uses Canvas API that can add text to any PDF document. If you are going to create a new PDF, then consider using Layout API that can [make PDF generation easier](https://bitmiracle.com/pdf-library/layout/).
6+
7+
## Description
8+
9+
The library can draw text in any language, but the current canvas font must support all characters in the text.
10+
11+
One use set up a font that [contains glyphs for all characters](https://api.docotic.com/pdffont-containsglyphsfortext) in the text, you can draw the text using [PdfCanvas.DrawString](https://api.docotic.com/pdfcanvas-drawstring) and [PdfCanvas.DrawText](https://api.docotic.com/pdfcanvas-drawtext) methods.
12+
13+
## See also
14+
* [Get free time-limited license key](https://bitmiracle.com/pdf-library/download)
15+
* [Draw text on PDF canvas in C# and VB.NET](/Samples/Text/DrawText)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# OCR PDF and extract plain text in C# and VB.NET
22
This sample shows how to recognize and extract text from non-searchable PDF documents using [Docotic.Pdf library](https://bitmiracle.com/pdf-library/) and [Tesseract OCR Engine](https://github.com/charlesw/tesseract).
33

4-
Follow these steps to do OCR when PDF page does not contain searchable text:
4+
Follow these steps to do OCR when a PDF page does not contain searchable text:
55
1. Save the page as high-resolution image using Docotic.Pdf. Higher resolution leads to better recognition quality.
66
2. Recognize the image using Tesseract OCR engine.
77
3. Use recognized text.
88

9-
If your documents contain text in language(s) other than English, then make sure to provide [Language Data Files for Tesseract 4.00](https://github.com/tesseract-ocr/tessdata/tree/4.0.0) for the language(s) of your document.
9+
If your documents contain text in language(s) other than English, provide [Language Data Files for Tesseract 4.00](https://github.com/tesseract-ocr/tessdata/tree/4.0.0) for the language(s) of your document.
1010

1111
Also ensure that you have [Visual Studio 2015-2019 x86 & x64 runtimes](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) installed.
1212

1313
## See also
14-
* [OCR PDF in C# and VB.NET](https://bitmiracle.com/blog/ocr-pdf-in-net) article
15-
* [Extract text from PDF in C# and VB.NET](https://bitmiracle.com/pdf-library/pdf-text/extract) article
16-
* [Get free time-limited license key for Docotic.Pdf](https://bitmiracle.com/pdf-library/download)
14+
* [Get free time-limited license key for Docotic.Pdf](https://bitmiracle.com/pdf-library/download)
15+
* [OCR PDF in C# and VB.NET](https://bitmiracle.com/blog/ocr-pdf-in-net)
16+
* [Extract text from PDF in C# and VB.NET](https://bitmiracle.com/pdf-library/pdf-text/extract)

0 commit comments

Comments
 (0)