Alexandre Heinen
Alexandre Heinen

Reputation: 703

Stimulsoft exporting pdf with only squares

i'm working with Stimulsoft in C# WebAPI running on Azure App Service. When i export my report as PDF all the text is rendered as squares, like this

enter image description here

when export as HTML the report is correct. Locally or in a Virtual Machine in Azure the pdf file is correct, the problem occurs only on Azure App Service.

this is the code i use to export pdf. The font i use is Arial, some parts have bold or italic.

var settings = new StiPdfExportSettings() { ImageQuality = 1.0f, ImageResolution = 300, EmbeddedFonts = true, StandardPdfFonts = true };

                report.ExportDocument(StiExportFormat.Pdf, ms, settings);

Can anyone help me?

Upvotes: 2

Views: 4330

Answers (3)

HighAley
HighAley

Reputation: 1329

The PDF export needs get access to font files that are used in a report. Stimulsoft report engine uses GDI+ to get access to necessary information about the fonts.

Azure Web Sites have restrictions a restriction on access to GDI+.

The one way out is to use Standard PDF fonts.

Or you could prepare necessary fonts for PDF export on your local machine. In this case, you don't need the access to GDI+ functions.

How it works:

  • using the FontInfoCreator utility, you create font files (*.fiz)

  • in the init part of your application load these files to the font store.

Sample code:

Stimulsoft.Report.Export.FontsInfoStore.LoadFontInfoToStore("Arial", @"fontstore\Arial.fiz"); 

Upvotes: 3

Eugene
Eugene

Reputation: 2878

The issue with fonts is caused by the Azure Web Sites service's limitation: it has access to the limited set of fonts only and is not providing access (confirmed by another MS employee too) to GDI+ subsystem device context that is required for fonts rendering.

You may also expect General GDI+ error occured if you try to manipulate fonts or their parameters.

The suggested solutions are

Upvotes: -1

Alexandre Heinen
Alexandre Heinen

Reputation: 703

I have solved the problem changing the pdf settings to export like this

var settings = new StiPdfExportSettings() { ImageQuality = 1.0f, ImageResolution = 300, EmbeddedFonts = false, UseUnicode = false, StandardPdfFonts = true };

this works only with StandardPdfFonts = true and EmbeddedFonts = false, only UseUnicode = false doesn't work

Upvotes: 2

Related Questions