Rendering and exporting problems

Posted by: bagattini on 30 October 2023, 10:26 pm EST

    • Post Options:
    • Link

    Posted 30 October 2023, 10:26 pm EST - Updated 30 October 2023, 10:32 pm EST

    On a small amount of clients, I’m getting the following error when exporting a report generated with AR:

    Cannot read the file for font: Roboto

    Of course, the report uses the font Roboto. The font is available, installed on the client’s machine.

    If instead of exporting the PDF I try to print it on a PDF printer, I’m getting the text all messed up:

    In the Active Reports viewer, the text is rendered correctly, although I’m not sure if it’s actually substituting the Roboto font with a similar one.

    The stack trace of the exception is as follow:

    Exception: System.InvalidOperationException
    
    Message: Cannot read the file for font: Roboto
    
    Stack trace: in #lSr.#TGn.#VGn(IntPtr hdc, Font font, IntPtr& newFont)
    in #mqc.#zqc.#Fk(Font font)
    in #mqc.#zqc..ctor(Font font)
    in #lSr.#SOn.#tMn()
    in #lSr.#iRn.#tMn()
    in #mqc.#Vqc.#U.#Yqc.#H5k(String fontName)
    in #mqc.#Vqc.#U.#Yqc.#Dvd(String fontName)
    in #mqc.#Vqc.#U.#Yqc.#RZc(String fontName, FontStyle fontStyle, Boolean isVertical)
    in #mqc.#Vqc.#RZc(Int32 fontIndex, String fontName, FontStyle fontStyle, Single sizeInPoints, Boolean vertical)
    in GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport.#7pk(SectionDocument document, Stream stream, String pageRange, Byte[]& xmpMetadata)
    in GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport.Export(SectionDocument document, Stream stream, String pageRange)
    in GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport.Export(SectionDocument document, String filePath, String pageRange)
  • Posted 2 November 2023, 9:07 pm EST

    Hi Bagattini,

    Try embedding the fonts into your report using Custom Font Resolver. It will allow you to configure fonts for preview and export on all platforms. Please refer to the following links in our documentation for more information on the same:

    If the issue still persists, please share a stripped-down sample reproducing the issue with us or edit the attached sample so that it replicates the issue and send it back to us for further investigation.

    Attachment:CustomFontResolverSample.zip

  • Posted 7 November 2023, 12:49 am EST

    Thank you,

    I’ll soon implement this option to see if it works in our scenario.

    Can I ask you if this solution is viable also with Active Reports 7? We’re updating our codebase to use Active Reports 17 and will surely add this option to the newer version of it, but I wonder if it is possible to make an update to patch our users running an older version.

    Kindest regards,

    Matteo

  • Posted 7 November 2023, 6:22 pm EST

    Hi Matteo,

    Unfortunately, the Font Resolver was introduced in ActiveReports 15 and therefore could not be implemented in ActiveReports 7.

    Please Note: ActiveReports 7 is a legacy version of ActiveReports and we no longer provide support for the same.

    Regards,

    Anand

  • Posted 12 February 2024, 10:37 pm EST - Updated 12 February 2024, 10:59 pm EST

    Dear,

    I’m finally implementing the suggested solution. However, I’m not able to make it work. I can run the Font Resolver Sample as provided, however if I switch to a different font that is not installed on my system (in this case, the Oswald font for testing purposes, for which I simply downloaded the TTFs without installing it), the report gets rendered in the Active Reports Viewer with what I think is Microsoft Sans Serif.

    When I export the PDF, it uses the correct embedded font.

    Is there a way to also use the embedded font for the Viewer?

    Kindest regards,

    Matteo

  • Posted 13 February 2024, 7:30 pm EST

    Hi Matteo,

    For previewing your report using a font that is not installed on your system, you can use a ‘FontResolver’ which will pick up the fonts from your specified fonts folder to render your report and preview it in the viewer.

    You can learn more about Font Resover here: Custom Font Resolver.

    We have also attached a sample implementing the same for your reference.

    Regards,

    Anand

    FontResolverForViewer.zip

  • Posted 13 February 2024, 7:52 pm EST

    Dear Anand,

    I guess your answer was a bit rushed, as the same sample was already posted before.

    Anyway, I think I found a way for the viewer to show the correct font by forcing the compatibility mode of the report, hope that’s the right approach.

    Kindest regards,

    Matteo

  • Posted 14 February 2024, 5:47 pm EST

    Hi Matteo,

    We’re glad you were able to resolve your issue.

    >> I think I found a way for the viewer to show the correct font by forcing the compatibility mode of the report, hope that’s the right approach.

    It could be the cause of your issue, however, it would be difficult to comment upon the same without a sample.

    Although, if you face any problem with your sample in the future please feel free to reach us out regarding the issue and we’ll be glad to help you out!

    Regards,

    Anand

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels