Different visualization than the actual document for pictoral categories

As per the preview, we are getting numerical values instead of the pictoral graphs for the categories.

attaching the screenshot for your reference.
image.png (31.8 KB)

image.png (115.3 KB)

Please suggest the changes to achieve the required result.

Thanks
Nikunj

@nikunj.gupta.egon

Can you please provide more details about the specific changes you are looking to achieve for the pictorial categories visualization?

@nikunj.gupta.egon

Hi Nikunj,

It seems that it may be a bug, when the GroupDocs.Viewer renders the content of the document incorrect, but in order to fix it we need to have a sample file. If this file has confidential info, we can make this forum topic private.

Waiting for your reply.

With best regards,
Denis Gvardionov

Hi Denis,

This is a confidential document and connot share the whole document. Can I share the particular page ?

Thanks
nikunj

@nikunj.gupta.egon

Hi Nikunj,

Yes, of course. But first of all please say — which format this particular document has? Is it a PDF or DOCX or something else? because if it is a Word document, for example, you can wipe out all sensitive information.

With best regards,
Denis Gvardionov

Hi Denis,

Please find the sample document
Group_Docs_error_sample1.docx (16.9 KB)

@nikunj.gupta.egon

Hi Nikunj,

I’ve downloaded the attached “Group_Docs_error_sample1.docx” and opened it on my PC locally using MS Word 2021 and I see numerical values, not the pictoral graphs, please see a screenshot attached to this post. Macros are enabled.

MS-Word-view.png (55.3 KB)

With best regards,
Denis Gvardionov

Added the sample again, please verify.

Thanks
Nikunj
Sample file.docx (86.7 KB)

@nikunj.gupta.egon

Hi Nikunj,

Unfortunately, I see still the same numeric values, not the pictoral graphs, same as in the previous time. I’ve checked it both in my local MS Word and Word Online, see two attached screenshots.

With best regards,
Denis Gvardionov

Word local.png (138.0 KB)
Word online.png (185.6 KB)

Hi Denis, can you check if you have the particular font type “Harvey Balls” on your system?

image.png (48.1 KB)

@nikunj.gupta.egon

Hi Nikunj,

The latest provided “Sample file.docx” (86.7 KB) contains 5 different font families: ‘Messina Sans Book’, ‘Messina Sans’, ‘Coranto 2’, ‘Messina Sans Light’, ‘Harvey Balls’. None of them are installed on my PC. It seems that this is the reason why I don’t see thepictoral graphs . Please suggest the source (link) where I can find and download the ‘Harvey Balls’ font.

With best regards,
Denis Gvardionov

Hi Denis,

I don’t have the actual link to the font. However I have search in Google and the below link look promising to download the “Harvey Balls” font.

However, another check I want to understand, if the font is not available, do Groupdocs display any kind of message to the user as it seems a generic scenario and not possible to have all the fonts installed on the machine.

Thanks
Nikunj

@nikunj.gupta.egon

Hi Nikunj,

I’ve downloaded the “Harvey Balls” font using your link and with it I was able to render the previously provided document “Sample file.docx” to the HTML and PNG with correct pictorial marks, as you initially wanted. I didn’t install this font to my OS Windows. What I did I put this “harvey_balls.ttf” to a separate folder and then specified this folder using the FolderFontSource and FontSettings types.

Source code is below. Make sure to adjust the correct and existing paths to the input/output files and folders, and the most important - to set a valid license, because the target page is 4th, while trial mode will allow you to render only first 2 pages. So, the code is below, as a form of unit-test:

[Test]
public void ConvertToHtmlPngWithCustomFontsFolder()
{
    // set valid license first!!!!!!!!!


    const string filename = "Sample file.docx";    
    string inputWordsPath = Path.Combine("Valid", "Path", filename);
    FileAssert.Exists(inputWordsPath);

    string outputHtmlEmbeddedPathTemplate = Path.Combine("Output folder path",
        string.Format("{0}-embedded-page{{0}}.html",
        Path.GetFileNameWithoutExtension(filename))
        );
    string outputPngPathTemplate = Path.Combine("Output folder path", string.Format("{0}-page{{0}}.png",
        Path.GetFileNameWithoutExtension(filename)));

    HtmlViewOptions htmlEmbeddedOpt = HtmlViewOptions.ForEmbeddedResources(outputHtmlEmbeddedPathTemplate);
    PngViewOptions pngViewOpt = new PngViewOptions(outputPngPathTemplate);

    // "harvey_balls.ttf" should be in this folder!
    string harveyBallsFontPath = Path.Combine("Full path", "Fonts", "Harvey Balls");
    DirectoryAssert.Exists(harveyBallsFontPath);

    GroupDocs.Viewer.Fonts.FolderFontSource fontSource = new GroupDocs.Viewer.Fonts.FolderFontSource(harveyBallsFontPath, GroupDocs.Viewer.Fonts.SearchOption.TopFolderOnly);
    GroupDocs.Viewer.Fonts.FontSettings.SetFontSources(fontSource);

    using (Viewer viewer = new Viewer(inputWordsPath))
    {
        viewer.View(htmlEmbeddedOpt);
        viewer.View(pngViewOpt);
    }
}

The result of this code sample is attached here in a “Sample file-page4.zip” archive — it contains only the 4th page, converted to PNG and HTML. I believe it is the result that you wanted from the beginning.

Sample file-page4.zip (110.4 KB)

Now answer to your question. The situation, when some document was created on the author’s machine and uses some font AAA, and then is processed using the GroupDocs.Viewer on some client’s machine, where font AAA is missing, is typical. In such case GroupDocs.Viewer tries to mimic the MS Word behaviour and substitute this font using some complex font substitution rules: it analyzes the metadata of the document, alternative names of the missing font, settings of the document, settings of the OS, list of all available fonts, installed in the OS and so on. Finally, when by some reason the OS is “clean”, when it has no installed fonts at all (I don’t know how to do this, but may be this is possible somehow), then GroupDocs.Viewer will substitute the free font “Fanwood”, which is embedded directly inside the GroupDocs.Viewer.dll file as a last resort.

At this moment the GroupDocs.Viewer does the font substitution operation “silently” — there are no any messages or events when the font substitution mechanism is activated and which font is missing and onto which is replaced/substituted, and for which exact document. Such feature is hard to implement because it is too unclear, vague, and ambiguous what kind of notification should be emitted, in which form and how they can be utilizing on the client’s side. Also please note that all described above is related to the WordProcessing format family (DOC, DOCX, DOCM, RTF, ODT etc). But there are also much more formats and format families like Excel/Spreadsheet, PowerPoint/Presentation, PDF/XPS and many more, and font processing for them is different.

Hope this code sample and explanation will help. If you have any questions feel free to ask.

With best regards,
Denis Gvardionov