Print Preview VS Export to PDF/docx

Stimulsoft Reports.JS discussion
Post Reply
csrt
Posts: 49
Joined: Thu Jan 17, 2019 12:38 pm

Print Preview VS Export to PDF/docx

Post by csrt »

Hello. I am using latest Stimulsoft JS 2023.2.1 version, and face the following issue:

Suppose we have a blank report with a text element in it, filled with text, copied from a docx file.
If we print it - it appears just as in the designer. But if we try to export it to docx or PDF - it loses the format, loses the fonts and sizes.
For example a part might be exported with the correct font Times New Roman, but another part might be exported with times_new_roman, so there is no such a font, and the appearance changes.

I've used the Demo project from the library.
Report + exported files are attached.
Attachments
demo123.png
demo123.png (427.39 KiB) Viewed 1049 times
demo234.png
demo234.png (310.33 KiB) Viewed 1049 times
Demo202321.mrt
(46.3 KiB) Downloaded 78 times
Demo202321.docx
(25.1 KiB) Downloaded 72 times
Demo202321.pdf
(49.83 KiB) Downloaded 74 times
Demo202321.rar
(7.54 MiB) Downloaded 76 times
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Print Preview VS Export to PDF/docx

Post by Lech Kulikowski »

Hello,

Please add used fonts before rendering:
Stimulsoft.Base.StiFontCollection.addOpentypeFontFile("font.ttf");

Thank you.
csrt
Posts: 49
Joined: Thu Jan 17, 2019 12:38 pm

Re: Print Preview VS Export to PDF/docx

Post by csrt »

Hello, thank you for your response.

I'm afraid the solution proposed is not viable, since it implies that I know what font will be used, which I obviously don't.
Besides, if there are used 2 3 10 fonts? To import them all manually?

Just to be clear - we are not talking about some custom fonts. These are regular fonts, like Times New Roman, available in Stimulsoft Designer. So I assume that the fonts are available already, since they can be used in designer. In one of the exported docx files I saw the next behavior: first page had the available font "Times New Roman", and the next ones had the font "times_new_roman" - it looks like an export bug. Can you please check this aspect as well? The exported document is attached.

As well, can you please tell me if there will be a more automatic solution for this problem in next patches, that will account for used fonts and export to files properly?
Attachments
exported.docx
(18.32 KiB) Downloaded 82 times
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Print Preview VS Export to PDF/docx

Post by Lech Kulikowski »

Hello,

1. You text component with a large height placed directly on the page. Please place it on the databand for correct splitting on pages.

2. In your text is used the following string:
<span style="font-family: &quot;Times New Roman&quot;;">denumit

we do not support such a combination:
https://www.stimulsoft.com/en/documenta ... nt_tag.htm

that is the issue with exporting.

Thank you.
csrt
Posts: 49
Joined: Thu Jan 17, 2019 12:38 pm

Re: Print Preview VS Export to PDF/docx

Post by csrt »

Hello, thank you for your answer - we will try to be more careful next time.

By the way, is there a correct way to import some pre-formatted text from an outside .docx document into the designer, so that there are no issues with fonts and format?
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Print Preview VS Export to PDF/docx

Post by Lech Kulikowski »

Hello,

Unfortunately, we do not have any special options, or methods to import formatted text.

Thank you.
Post Reply