Unable to add text run because of CMAP

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

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 11 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 11 months ago

Hi Akamun,

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

Datalogics Support

Get instant access to the latest PDF news, tips and tricks!

Do you want monthly updates on the latest document technology trends?

By submitting the form, you agree to receive marketing emails from Datalogics. You may unsubscribe at any time.