Search code examples
pdfreporting-servicesfontsssrs-2008

How to avoid font substitutions in PDF files


I'm writing this question as a last resort, because I've been trying to find the solution for the last week and I cannot come up with any.

The Workflow

There are PDF files generated by SSRS according to respective .rdl files and data retrieved from database. I made an application which, in short, groups those PDF files and merges them into one group. In order to merge files I use PdfSharp library.

The Problem

The PDF files contain not embedded fonts. This causes an issue during printing of the documents, because non-latin characters are not properly printed. To be more specific, the .rdl files contains only text boxes with Arial font family. However, the PDF generated by SSRS uses Helvetica (which Adobe Reader converts to Arial, but the printer has problems with it).

What I am trying to achieve

I want to get my output PDF to contain only embedded fonts.

What I have tried so far

I tried changing the font in the .rdl file to a font which would not be substituted (for instance Calibri or Liberation Sans). This however causes report's 'construction' to 'crash' - several elements are not in the place where they should be.

Having read through several threads on Microsoft forums I found out that the font substitution problem is common in SSRS 2008 and, unfortunately, has not been solved and does not seem to have a workaround, let alone solution.

My Question

Do you know a way for my output PDF files to contain only embedded fonts? Maybe it can be achieved through some modification of .rdl files, maybe there is a way to do it through PdfSharp or some other library?


Solution

  • In the end I used GhostScript to embed fonts, as is explained in this answer.

    "C:\Program Files\gs\gs9.21\bin\gswin64c.exe" \
        -o outputPdf.pdf \
        -sDEVICE=pdfwrite \
        -dPDFSETTINGS=/prepress \
        -sFONTMAP=myFontMap.txt \
        inputPdf.pdf