VahidN / PdfReport.Core

PdfReport.Core is a code first reporting engine, which is built on top of the iTextSharp.LGPLv2.Core and EPPlus.Core libraries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't build a report in Ubuntu.

MedinaVla opened this issue · comments

Summary of the issue

Environment

PdfReport.Core 1.4.5
.NET Core SDK version: 6
OS: Ubuntu 22.04

PdfReport.Core version:
.NET Core SDK version: 
IDE: 

Example code/Steps to reproduce:

 public PdfReport GetPdfContentAsync(IEnumerable<AssetResponse> mapped, string title)
        {
            try
            {
                var dateFormat = GetDateFormat();

                return new PdfReport().DocumentPreferences(doc =>
                    {
                        doc.RunDirection(PdfRunDirection.LeftToRight);//In this line i get the error
                        doc.Orientation(PageOrientation.Landscape);
                        doc.PageSize(PdfPageSize.A4);
                        doc.PrintingPreferences(new PrintingPreferences
                        {
                            PickTrayByPdfSize = true
                        });

Output:

System.IO.DirectoryNotFoundException:  directory does not exist.
   at PdfRpt.Core.Helper.Guard.CheckDirectoryExists(String fileName)
   at PdfRpt.GenericFontProvider..ctor(String mainFontPath, String defaultFontPath)
   at PdfRpt.FluentInterface.DataTemplate.setDefaultPdfFonts()
   at PdfRpt.FluentInterface.DataTemplate.get_PdfFont()
   at PdfRpt.FluentInterface.PagesFooterBuilder..ctor(PdfReport pdfReport)
   at PdfRpt.FluentInterface.PdfReport.PagesFooter(Action`1 pagesFooterBuilder)

  • Set this path correctly. Also there are other paths too (such as fonts path). You should check them as well.
  • Your CheckDirectoryExists exception is related to setDefaultPdfFonts. Which means the specified fonts can't be found.