Question

We use ABCpdf software, and recently added a Russian translation option for some of our documents. Most of the contents of the PDF come from a web page using the AddImageURL method. This all works fine, meaning that the Russian text is readable.

However, we have a few text sections that need to be placed exactly at the bottom of the page, so we do this with ABCpdf's AddText method. These strings show up as ???????? in the generated PDF.

Here's a quick code sample:

Doc pdfDoc = new Doc();
//snip snip snip...

//add footer text
pdfDoc.Rect.SetRect(30, 30, 552, 10);  //footer section
pdfDoc.HPos = 0; //set horizontal position to left
pdfDoc.AddText(GetRussianString("REFERENCE") + " #" + ReferenceID);

After reading the documentation on Websupergoo's site, I tried using AddFont and EmbedFont (separately and together), but this did not work:

pdfDoc.Font = pdfDoc.EmbedFont("Times-Roman", LanguageType.Unicode);

I also searched for ways to set encoding at the document level, and didn't find any documentation on this, at least not for version 8. We are currently using 8.11.2 of the ABCpdf software.

Has anybody done something like this successfully?

Was it helpful?

Solution

OK, the (totally embarrassing) answer is that I was being far too literal about the example from WebSuperGoo's site. I needed to use the exact font name from my development/production machine.

pdfDoc.Font = pdfDoc.EmbedFont("Times New Roman", LanguageType.Unicode);

Obvious? Yes. But it's one of things that can be overlooked when in a hurry, so I'll post the answer here in case anybody else gets tripped up.

Part of my confusion stemmed from the fact that Russian text added from a URL was just fine in the document, but not the content added as text. I'm guessing that abcPDF sets the font according to the encoding it gets from the web page, but that affects only the content it is pulling in, not the overall PDF.

Anyhow, thanks to gekannt and anybody else who took a look.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top