Community ForumCategory: Adobe PDF LibraryUnable to add text run because of CMAP
Akamun asked 3 months ago

Hi,
I am using the .net APDFL to write text on a new pdf file.
My code looks something like this
using (Library library1 = new Library(new[] { WorkingDirectory }, WorkingDirectory, WorkingDirectory, LibraryFlags.IgnoreDefaultDirectories| LibraryFlags.CheckSubFonts | LibraryFlags.PreferLocalFonts))
{
library1.AllowRelaxedSyntax = true;
Font font = new Font("Calibri", FontCreateFlags.Embedded | FontCreateFlags.Subset, (WritingMode)0);
Text text = new Text();
GraphicState graphicState = new GraphicState();
TextState textState = new TextState();
Matrix matrix = new Matrix(1, 0, 0, 1, 14, 14);
TextRun textRun = new TextRun("Hello", font, graphicState, textState, matrix);
}

It fails at the new TextRun with error that encoding cmap is not available. I have the font file and cmap availabe at the path.
The thing that I am trying to do is take text from one PDF and encode it onto another pdf.

Patrick replied 3 months ago

The error you are reporting seemingly contradicts your claim that you have the right cmap available in WorkingDirectory. The second parameter for the Library constructor is supposed to point to the Resources\CMap directory with its 229 CMap files.

That said, it could possibly be an issue with the 3rd Parameter, which is supposed to be the path to the Resources\Unicode directory which contains two subdirectories: icu and mappings.

1 Answers
Corey Staff answered 3 months ago

Hi Akamun,

Is this still an issue for you? Did Patrick’s response help get you in the right direction?

Regards,
Datalogics Support

Top