Problem with PDF export in k8s, windows 2019

Stimulsoft Reports.WEB discussion
e.andrukh
Posts: 14
Joined: Mon Feb 28, 2022 5:48 pm

Re: Problem with PDF export in k8s, windows 2019

Post by e.andrukh »

I made adding fonts like this and correct font is used, but as you said in one style only. Waiting for fix.

Code: Select all

			foreach (var file in System.IO.Directory.GetFiles("C:\\Windows\\Fonts"))
			{
				Stimulsoft.Base.StiFontCollection.AddFontFile(file);
			}
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: Problem with PDF export in k8s, windows 2019

Post by Lech Kulikowski »

Hello,

The next release build will be available within two or three weeks.

Thank you.
e.andrukh
Posts: 14
Joined: Mon Feb 28, 2022 5:48 pm

Re: Problem with PDF export in k8s, windows 2019

Post by e.andrukh »

Hello,
I upgraded to latest version and found one more issue:
Image is not exported.
Not reproduced anymore
Last edited by e.andrukh on Fri Mar 11, 2022 10:42 am, edited 1 time in total.
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: Problem with PDF export in k8s, windows 2019

Post by Lech Kulikowski »

Hello,

We couldn't connect to your database. Please send us test data for your report.

Thank you.
e.andrukh
Posts: 14
Joined: Mon Feb 28, 2022 5:48 pm

Re: Problem with PDF export in k8s, windows 2019

Post by e.andrukh »

Hello, I updated to v2022.2.1
But it still has wrong fonts.
Pdf is attached.

Before update problem was with wrong style of font: italic was used instead of general one.

Now it's different.
Attachments
credit_note_request_20220322_1614.pdf
(91.14 KiB) Downloaded 89 times
Last edited by e.andrukh on Tue Mar 22, 2022 3:29 pm, edited 1 time in total.
e.andrukh
Posts: 14
Joined: Mon Feb 28, 2022 5:48 pm

Re: Problem with PDF export in k8s, windows 2019

Post by e.andrukh »

By the way attached three fonts cannot be added to StiFontCollection

Code: Select all

StiFontCollection.AddFontFile(fileName)
System.ArgumentNullException: Value cannot be null.
Parameter name: key
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at Stimulsoft.Base.StiFontCollection.AddContentToCache(Byte[] content, String extension, String alias, Nullable`1 fontStyle, Boolean isResource)
at Stimulsoft.Base.StiFontCollection.AddFontFile(String fileName, String alias, Nullable`1 fontStyle)
Attachments
Fonts.zip
(179.91 KiB) Downloaded 100 times
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: Problem with PDF export in k8s, windows 2019

Post by Lech Kulikowski »

Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: Problem with PDF export in k8s, windows 2019

Post by Lech Kulikowski »

Hello,

> By the way attached three fonts cannot be added to StiFontCollection

The issue is fixed. The fix will be available in the next release build.

> Before update problem was with wrong style of font: italic was used instead of general one.
> I updated to v2022.2.1
> But it still has wrong fonts.

Not really. The fonts now exported to PDF are correct, and the styles are correct.
But there is a problem with the character width.
Analysis of the pdf file shows that this is another GDI bug - the character width of the wrong font is returned.
Try setting the following static option:
StiOptions.Export.Pdf.AllowInvokeWindowsLibraries = false;
and let us know about the result.

Thank you.
e.andrukh
Posts: 14
Joined: Mon Feb 28, 2022 5:48 pm

Re: Problem with PDF export in k8s, windows 2019

Post by e.andrukh »

It solves the problem, thanks.

I copied all Windows fonts to C:\Windows\Fonts.
This code is used before reports rendering and exporting:

Code: Select all

			StiOptions.Export.Pdf.AllowInvokeWindowsLibraries = false;

			foreach (var fileName in Directory.GetFiles(@"C:\Windows\Fonts"))
			{
				try
				{
					StiFontCollection.AddFontFile(fileName);
				}
				catch (Exception ex)	{ }
			}
e.andrukh
Posts: 14
Joined: Mon Feb 28, 2022 5:48 pm

Re: Problem with PDF export in k8s, windows 2019

Post by e.andrukh »

Maybe it can be helpful, how fonts are copied and registered in docker image:

Code: Select all

FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019

COPY ./Fonts ./Fonts
COPY ./InstallFonts.ps1 ./Fonts
RUN ["powershell.exe", "./Fonts/InstallFonts.ps1"]
Attachments
InstallFonts.zip
(1.46 KiB) Downloaded 89 times
Post Reply