mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
handle case where no unicode value is found for type 1 fonts.
This commit is contained in:
@@ -41,10 +41,10 @@ The ```PdfDocument``` provides access to the document metadata as ```DocumentInf
|
|||||||
PdfDocument document = PdfDocument.Open(fileName);
|
PdfDocument document = PdfDocument.Open(fileName);
|
||||||
|
|
||||||
// The name of the program used to convert this document to PDF.
|
// The name of the program used to convert this document to PDF.
|
||||||
string producer = document.DocumentInformation.Producer;
|
string producer = document.Information.Producer;
|
||||||
|
|
||||||
// The title given to the document
|
// The title given to the document
|
||||||
string title = document.DocumentInformation.Title;
|
string title = document.Information.Title;
|
||||||
// etc...
|
// etc...
|
||||||
|
|
||||||
### Page ###
|
### Page ###
|
||||||
@@ -61,7 +61,7 @@ The ```Page``` contains the page width and height in points as well as mapping t
|
|||||||
|
|
||||||
### Letter ###
|
### Letter ###
|
||||||
|
|
||||||
Due to the way a PDF is structured internally the page text may not be a readable representation of the page text. Since PDF is a presentation format, text can be drawn in any order, not necessarily reading order. This means spaces may be missing or words may be in unexpected positions in the text.
|
Due to the way a PDF is structured internally the page text may not be a readable representation of the text as it appears in the document. Since PDF is a presentation format, text can be drawn in any order, not necessarily reading order. This means spaces may be missing or words may be in unexpected positions in the text.
|
||||||
|
|
||||||
To help users resolve actual text order on the page, the ```Page``` file provides access to a list of the letters:
|
To help users resolve actual text order on the page, the ```Page``` file provides access to a list of the letters:
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
namespace UglyToad.Pdf.Tests.Integration
|
||||||
|
{
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A class for testing files which are not checked in to source control.
|
||||||
|
/// </summary>
|
||||||
|
public class LocalTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Tests()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -95,6 +95,8 @@
|
|||||||
return new CharacterIdentifierSystemInfo(SystemInfoBuilder.Registry, SystemInfoBuilder.Ordering, SystemInfoBuilder.Supplement);
|
return new CharacterIdentifierSystemInfo(SystemInfoBuilder.Registry, SystemInfoBuilder.Ordering, SystemInfoBuilder.Supplement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CharacterIdentifierSystemInfo;
|
||||||
|
|
||||||
throw new InvalidOperationException("The Character Identifier System Information was never set.");
|
throw new InvalidOperationException("The Character Identifier System Information was never set.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,14 @@
|
|||||||
var encodedCharacterName = encoding.GetName(characterCode);
|
var encodedCharacterName = encoding.GetName(characterCode);
|
||||||
|
|
||||||
// Look up the character name in the Adobe Glyph List.
|
// Look up the character name in the Adobe Glyph List.
|
||||||
value = GlyphList.AdobeGlyphList.NameToUnicode(encodedCharacterName);
|
try
|
||||||
|
{
|
||||||
|
value = GlyphList.AdobeGlyphList.NameToUnicode(encodedCharacterName);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
namespace UglyToad.Pdf.Fonts.Simple
|
namespace UglyToad.Pdf.Fonts.Simple
|
||||||
{
|
{
|
||||||
|
using System;
|
||||||
using Cmap;
|
using Cmap;
|
||||||
using Composite;
|
using Composite;
|
||||||
using Core;
|
using Core;
|
||||||
@@ -58,7 +59,14 @@
|
|||||||
|
|
||||||
var name = encoding.GetName(characterCode);
|
var name = encoding.GetName(characterCode);
|
||||||
|
|
||||||
value = GlyphList.AdobeGlyphList.NameToUnicode(name);
|
try
|
||||||
|
{
|
||||||
|
value = GlyphList.AdobeGlyphList.NameToUnicode(name);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user