HTML to PDF PDF.NET fonts error on macOS


#1

Hello, I’m trying to convert a html to pdf in PDF.NET
However on macOS it always fails via:
System.InvalidOperationException: Cannot find any fonts installed on the system.

this is my source code:

Fonts tree
.
├── AbadiMTCondensedExtraBold.ttf
├── AbadiMTCondensedLight.ttf
├── ArialNarrowBoldItalic.ttf
├── ArialNarrowItalic.ttf
├── ArialRoundedMTBold.ttf
├── BaskervilleOldFace.ttf
├── Bauhaus93.ttf
├── BellMT.ttf
├── BellMTBold.ttf
├── BellMTItalic.ttf
├── BernardMTCondensed.ttf
├── Book\ Antiqua\ Bold\ Italic.ttf
├── Book\ Antiqua\ Bold.ttf
├── Book\ Antiqua\ Italic.ttf
├── Book\ Antiqua.ttf
├── Bookman\ Old\ Style\ Bold\ Italic.ttf
├── Bookman\ Old\ Style\ Bold.ttf
├── Bookman\ Old\ Style\ Italic.ttf
├── Bookman\ Old\ Style.ttf
├── Bookshelf\ Symbol\ 7.ttf
├── Braggadocio.ttf
├── BritannicBold.ttf
├── COOPBL.TTF
├── Calibri.ttf
├── Calibrib.ttf
├── Calibrii.ttf
├── Calibriz.ttf
├── Calisto\ MT\ Bold.ttf
├── Calisto\ MT\ Italic.ttf
├── Calisto\ MT.ttf
├── CalistoMTBoldItalic.ttf
├── Cambria.ttc
├── Cambriab.ttf
├── Cambriai.ttf
├── Cambriaz.ttf
├── Candara.ttf
├── Candarab.ttf
├── Candarai.ttf
├── Candaraz.ttf
├── Century\ Gothic\ Bold\ Italic.ttf
├── Century\ Gothic\ Bold.ttf
├── Century\ Gothic\ Italic.ttf
├── Century\ Gothic.ttf
├── Century\ Schoolbook\ Bold\ Italic.ttf
├── Century\ Schoolbook\ Bold.ttf
├── Century\ Schoolbook\ Italic.ttf
├── Century\ Schoolbook.ttf
├── Century.ttf
├── ColonnaMT.ttf
├── ComicSansMSBold.ttf
├── Consola.ttf
├── Consolab.ttf
├── Consolai.ttf
├── Consolaz.ttf
├── Constan.ttf
├── Constanb.ttf
├── Constani.ttf
├── Constanz.ttf
├── CopperplateGothicBold.ttf
├── Corbel.ttf
├── Corbelb.ttf
├── Corbeli.ttf
├── Corbelz.ttf
├── CurlzMT.ttf
├── Deng.ttf
├── Dengb.ttf
├── Dengl.ttf
├── Desdemona.ttf
├── Dubai-Bold.ttf
├── Dubai-Light.ttf
├── Dubai-Medium.ttf
├── Dubai-Regular.ttf
├── EdwardianScriptITC.ttf
├── EngraversMT.ttf
├── EngraversMTBold.ttf
├── Eurostile\ Bold.ttf
├── Eurostile.ttf
├── Fangsong.ttf
├── FootlightMTLight.ttf
├── Franklin\ Gothic\ Book\ Italic.ttf
├── Franklin\ Gothic\ Book.ttf
├── Franklin\ Gothic\ Demi\ Cond.ttf
├── Franklin\ Gothic\ Demi\ Italic.ttf
├── Franklin\ Gothic\ Demi.ttf
├── Franklin\ Gothic\ Heavy\ Italic.ttf
├── Franklin\ Gothic\ Heavy.ttf
├── Franklin\ Gothic\ Medium\ Cond.ttf
├── Franklin\ Gothic\ Medium\ Italic.ttf
├── Franklin\ Gothic\ Medium.ttf
├── GARA.ttf
├── GARABD.ttf
├── GARAIT.ttf
├── Gabriola.ttf
├── Gautami.TTF
├── Gautamib.ttf
├── Gill\ Sans\ MT\ Bold\ Italic.ttf
├── Gill\ Sans\ MT\ Bold.ttf
├── Gill\ Sans\ MT\ Condensed.ttf
├── Gill\ Sans\ MT\ Ext\ Condensed\ Bold.ttf
├── Gill\ Sans\ MT\ Italic.ttf
├── Gill\ Sans\ MT.ttf
├── GillSansUltraBold.ttf
├── GloucesterMTExtraCondensed.ttf
├── Goudy\ Old\ Style\ Bold.ttf
├── Goudy\ Old\ Style\ Italic.ttf
├── Goudy\ Old\ Style.ttf
├── HGRGE.ttc
├── HGRME.ttc
├── HGRSGU.ttc
├── HGRSMP.ttf
├── Haettenschweiler.ttf
├── Harrington.ttf
├── ImprintMTShadow.ttf
├── Kaiti.ttf
├── Kartika.TTF
├── Kartikab.TTF
├── KinoMT.ttf
├── Lathab.ttf
├── Lucida\ Console.ttf
├── Lucida\ Sans\ Demibold\ Italic.ttf
├── Lucida\ Sans\ Demibold\ Roman.ttf
├── Lucida\ Sans\ Italic.ttf
├── Lucida\ Sans\ Unicode.ttf
├── Lucida\ Sans.ttf
├── LucidaBlackletter.ttf
├── LucidaBright.ttf
├── LucidaBrightDemibold.ttf
├── LucidaBrightDemiboldItalic.ttf
├── LucidaBrightItalic.ttf
├── LucidaCalligraphyItalic.ttf
├── LucidaFaxDemibold.ttf
├── LucidaFaxDemiboldItalic.ttf
├── LucidaFaxItalic.ttf
├── LucidaFaxRegular.ttf
├── LucidaHandwritingItalic.ttf
├── LucidaSansTypewriterBold.ttf
├── LucidaSansTypewriterBoldOblique.ttf
├── LucidaSansTypewriterOblique.ttf
├── LucidaSansTypewriterRegular.ttf
├── MS\ Reference\ Sans\ Serif.ttf
├── MS\ Reference\ Specialty.ttf
├── MSJH.ttf
├── MSJHBD.ttf
├── MTEXTRA.ttf
├── MangalB.ttf
├── Marlett.ttf
├── MaturaMTScriptCapitals.ttf
├── Mistral.ttf
├── ModernNo.20.ttf
├── MonotypeCorsiva.ttf
├── MonotypeSorts.ttf
├── News\ Gothic\ MT\ Bold\ Italic.ttf
├── News\ Gothic\ MT\ Bold.ttf
├── News\ Gothic\ MT\ Italic.ttf
├── News\ Gothic\ MT.ttf
├── Onyx.ttf
├── Perpetua\ Bold\ Italic.ttf
├── Perpetua\ Bold.ttf
├── Perpetua\ Italic.ttf
├── Perpetua\ Titling\ MT\ Bold.ttf
├── Perpetua\ Titling\ MT.ttf
├── Perpetua.ttf
├── Rockwell\ Bold\ Italic.ttf
├── Rockwell\ Bold.ttf
├── Rockwell\ Condensed\ Bold.ttf
├── Rockwell\ Condensed.ttf
├── Rockwell\ Extra\ Bold.ttf
├── Rockwell\ Italic.ttf
├── Rockwell.ttf
├── STHUPO.ttf
├── STLITI.ttf
├── STXINGKA.ttf
├── STXINWEI.ttf
├── STZHONGS.ttf
├── Segoe\ Print\ Bold.ttf
├── Segoe\ Script\ Bold.ttf
├── SimHei.ttf
├── SimSun.ttf
├── Stencil.ttf
├── TaiLeb.ttf
├── TrebuchetMSBoldItalic.ttf
├── Tunga.TTF
├── Tungab.TTF
├── Tw\ Cen\ MT\ Bold\ Italic.ttf
├── Tw\ Cen\ MT\ Bold.ttf
├── Tw\ Cen\ MT\ Condensed\ Bold.ttf
├── Tw\ Cen\ MT\ Condensed\ Extra\ Bold.ttf
├── Tw\ Cen\ MT\ Condensed.ttf
├── Tw\ Cen\ MT\ Italic.ttf
├── Tw\ Cen\ MT.ttf
├── Verdana\ Bold\ Italic.ttf
├── Verdana\ Bold.ttf
├── Verdana\ Italic.ttf
├── Verdana.ttf
├── WideLatin.ttf
├── Wingdings\ 2.ttf
├── Wingdings\ 3.ttf
├── Wingdings.ttf
├── YuGothB.ttc
├── YuGothL.ttc
├── YuGothM.ttc
├── YuGothR.ttc
├── angsa.ttf
├── angsab.ttf
├── angsai.ttf
├── angsaz.ttf
├── arial.ttf
├── arialbd.ttf
├── arialbi.ttf
├── ariali.ttf
├── ariblk.ttf
├── batang.ttc
├── calibril.ttf
├── calibrili.ttf
├── cordia.ttc
├── david.ttf
├── davidbd.ttf
├── gulim.ttc
├── himalaya.ttf
├── latha.ttf
├── malgun.ttf
├── malgunbd.ttf
├── malgunsl.ttf
├── mangal.ttf
├── meiryo.ttc
├── meiryob.ttc
├── mingliu.ttc
├── mingliub.ttc
├── mmrtext.ttf
├── mmrtextb.ttf
├── monbaiti.ttf
├── msgothic.ttc
├── msmincho.ttc
├── msyh.ttf
├── msyhbd.ttf
├── msyhl.ttf
├── msyi.ttf
├── ntailu.ttf
├── ntailub.ttf
├── nyala.ttf
├── pala.ttf
├── palab.ttf
├── palabi.ttf
├── palai.ttf
├── seguihis.ttf
├── seguisym.ttf
├── simsunb.ttf
├── symbol.ttf
├── tahoma.ttf
├── tahomabd.ttf
├── taile.ttf
├── thsarabun-bold-italic.ttf
├── thsarabun-bold.ttf
├── thsarabun-italic.ttf
├── thsarabun.ttf
├── times.ttf
├── timesbd.ttf
├── timesbi.ttf
├── timesi.ttf
├── webdings.ttf
├── yumin.ttf
├── yumindb.ttf
└── yuminl.ttf

try
{

 FontRepository.Sources.Add(new FolderFontSource("/Users/schmitch/Fonts"));
    // Source HTML document
    var options = new HtmlLoadOptions();
    var document = new Document(new MemoryStream(Encoding.UTF8.GetBytes(demo)), options);

    // Initialize PdfSaveOptions

    var saveOptions = new PdfSaveOptions { };
    document.Save("/Users/schmitch/out.pdf", saveOptions);

}
catch (Exception ex)
{
    Console.WriteLine(ex);
}

btw. I’m also have no idea how to get a pdf/a


#2

@cschmitt

Thanks for contacting support.

Could you please share your sample HTML file in ZIP format with us. We will further test the scenario in our environment and address it accordingly.

Please use following code snippet to generate PDF/A format from PDF:

Document doc = new Document(dataDir + "input.pdf");
doc.Convert(dataDir + "log.xml", PdfFormat.PDF_A_3B, ConvertErrorAction.Delete);
doc.Save(dataDir + "Converted.pdf");

#3

Actually the html is simple enough to post it here:

const string demo = "<html><head><title>Hello</title></head><body><h1>Hallo Welt</h1></body></html>";

we are actually evaluating Aspose.Pdf for dotnet and might want to buy it if it works on all os’s (mac, windows, linux).

Isn’t there a way to directly create a pdf/a from a html? we want to use it for invoice creation over html.


#5

@cschmitt

You can generate PDF/A format directly from HTML using following code snippet:

string demo = "<html><head><title>Hello</title></head><body><h1>Hallo Welt</h1></body></html>";
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(demo));
HtmlLoadOptions loadoptions = new HtmlLoadOptions(dataDir);
Document doc = new Document(ms, loadoptions);
doc.Convert(new MemoryStream(), PdfFormat.PDF_A_3B, ConvertErrorAction.Delete);
doc.Save(dataDir + "output.pdf");

Would you please try calling following method as well before using API in MAC environment. In case you still face any issue, please let us know. We will further proceed to assist you accordingly.

FontRepository.LoadFonts();


#6

sadly I still use FontRepository.LoadFonts(); I’m not sure if my fonts are “good”. I mean I use the fonts from office for mac. Path: /Applications/Microsoft\ Word.app/Contents/Resources/DFonts maybe I should copy mscore fonts from some linux system.


#7

@cschmitt

You may copy mscore fonts from linux system or install the package with Microsoft compatible fonts: ttf-mscorefonts-installer. ( e.g.: sudo apt-get install ttf-mscorefonts-installer )

These fonts should be placed in “/usr/share/fonts/truetype/msttcorefonts” folder (our API scan this folder on Linux like systems). If your OS has other default folder for fonts, you should keep following command at the beginning of your code as mentioned in your code already:

Aspose.Pdf.Text.FontRepository.Sources.Add(new FolderFontSource("<user's path to ms fonts>"))

We hope this will be helpful.


#8

Actually I tried everything now however it still won’t work.


#9

with a temporary license I get a different error:

System.NullReferenceException: Object reference not set to an instance of an object.
   at #=zOL931fUr_OVzcG0cX7B5ZMNanJ1UeCnh2PCHntc=.#=z07uPIWZOYJNi(#=zbzZwe_AQy8UOCQIc4qa7UunQ1JBcn2cPHg== #=z1gcEu3k=, Char #=zg6m4HVc=)
   at #=zOL931fUr_OVzcG0cX7B5ZMNanJ1UeCnh2PCHntc=.#=z07uPIWZOYJNi(#=zbzZwe_AQy8UOCQIc4qa7UunQ1JBcn2cPHg== #=z1gcEu3k=)
   at #=zf_XiHEHclcw5E9yIqNDNz2RLMq3VXVidFz7fZRkNYTxI.#=zIhpZse4=()
   at #=zly3aAjX1oihDx$GCEu8bhWocy9goAvJwnyNxaG_vUDPC.#=z7xJLsatDrhw3()
   at #=zSSqOYkctc8_YPCsGMhx82SOG$N7kDtdnCyHVlBL2kCX1sTKFbx9yxhg=.#=zM9LGwpYVoJPK()
   at #=zSSqOYkctc8_YPCsGMhx82SOG$N7kDtdnCyHVlBL2kCX1sTKFbx9yxhg=.#=z51MNEyrjUX_OcRcEGGrpjDs=(List`1 #=z4AOz1Gc=, #=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=)
   at #=zSSqOYkctc8_YPCsGMhx82SOG$N7kDtdnCyHVlBL2kCX1sTKFbx9yxhg=.#=zRZ_9Hq_nFspnYCW7sw==(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, List`1 #=zq$hssOA=)
   at #=zofqkBRbXsJBx8l788awA85U49tuI$XxiQ3mYV7cEze3H.#=zLbZHOAPePUHusF9Dbw==(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, Int32 #=z2MTuBsI=, Stack`1 #=zT0Mh8xVdFg6E, #=zpeKV3fK126a4eR8xZQD1UpQjWFoN5ju8tTk4hj0= #=z02KkDt4H2TZX, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=zl8yKEfIlQTUY)
   at #=zofqkBRbXsJBx8l788awA85U49tuI$XxiQ3mYV7cEze3H.#=zLbZHOAPePUHusF9Dbw==(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, Int32 #=z2MTuBsI=)
   at #=z_GbJzc4L1qGmx9Afm0aHRaBhgfh81huYL$d3Q9oud2tT.#=zTIO9yhqnG8le(#=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=z4aRUUKOeDYxw, #=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, #=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zoTmku_E1NA7b, Int32 #=z2MTuBsI=, Stack`1 #=zT0Mh8xVdFg6E, #=zpeKV3fK126a4eR8xZQD1UpQjWFoN5ju8tTk4hj0= #=z02KkDt4H2TZX, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=zoRzduQpcgKaq)
   at #=z_GbJzc4L1qGmx9Afm0aHRaBhgfh81huYL$d3Q9oud2tT.#=zRW7v_ieaQiRQ(List`1 #=zq$hssOA=, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=z4aRUUKOeDYxw, #=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, Int32 #=z2MTuBsI=, Stack`1 #=zT0Mh8xVdFg6E, #=zpeKV3fK126a4eR8xZQD1UpQjWFoN5ju8tTk4hj0= #=zpaYXpYU=, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=zl8yKEfIlQTUY)
   at #=z_GbJzc4L1qGmx9Afm0aHRaBhgfh81huYL$d3Q9oud2tT.#=zLbZHOAPePUHusF9Dbw==(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, Int32 #=z2MTuBsI=, #=zpeKV3fK126a4eR8xZQD1UpQjWFoN5ju8tTk4hj0= #=z02KkDt4H2TZX, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=zoRzduQpcgKaq)
   at #=z_GbJzc4L1qGmx9Afm0aHRaBhgfh81huYL$d3Q9oud2tT.#=zLbZHOAPePUHusF9Dbw==(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, Int32 #=z2MTuBsI=)
   at #=zoMiPA3XWOaOp9KqNa2hBT$U3004B17Hp59VfKjc=.#=zLbZHOAPePUHusF9Dbw==(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, Int32 #=z2MTuBsI=)
   at #=zwFr_rQlSNxJAXWr58xYqoVD625AWyBdAua1X4Yg=.#=z7JQjRFLlMSrC(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zoTmku_E1NA7b, Int32 #=zHMb4q9IiP8s6, #=zpeKV3fK126a4eR8xZQD1UpQjWFoN5ju8tTk4hj0= #=zOqP8UQzxjUqSMPrWUw==, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=zl8yKEfIlQTUY, List`1 #=zCYE2d8ghbdB1)
   at #=zoMiPA3XWOaOp9KqNa2hBT$U3004B17Hp59VfKjc=.#=z7JQjRFLlMSrC(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zoTmku_E1NA7b, Int32 #=zHMb4q9IiP8s6, #=zpeKV3fK126a4eR8xZQD1UpQjWFoN5ju8tTk4hj0= #=zOqP8UQzxjUqSMPrWUw==, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=zoRzduQpcgKaq, List`1 #=zCYE2d8ghbdB1)
   at #=zoMiPA3XWOaOp9KqNa2hBT$U3004B17Hp59VfKjc=.#=z7JQjRFLlMSrC(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zoTmku_E1NA7b, Int32 #=zHMb4q9IiP8s6)
   at #=zwFr_rQlSNxJAXWr58xYqoVD625AWyBdAua1X4Yg=.#=zvk1EKNHVWSJ1(Int32 #=zwzhV033EhMTH, Boolean #=zUBnlJjtO4M1Q, #=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=z2kDhL2MXHQKC)
   at #=zoMiPA3XWOaOp9KqNa2hBT$U3004B17Hp59VfKjc=.#=zvk1EKNHVWSJ1(Int32 #=zwzhV033EhMTH, #=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=z2kDhL2MXHQKC)
   at #=z3raz2QsEGMM3pv0cdeGDGoOQU$Hrn_O9u_J7JxySoo5S.#=zUhXu42cVQ$w8()
   at #=zO8HLO4SUUi6dHSVLxKACxN9iwRWcwXR8Vg==.#=zLxWRgMO8v2F1(#=z3whaN3pHpuNTgHX_Re4x_Q7QcmTcEQcpGglKjbvPG0Q$ #=z5Zvr$6wrTKNX)
   at #=zu$ASKCBwNBZFCkSlL8tLQY1D4Dgxy9skftB2PVfaSA7f.#=zXitnQFI=(#=z7yhUgs9XPckghCw7wO$r4dZaH2sDLy11HTPOIBQ= #=zshb_3j0=)
   at #=zu$ASKCBwNBZFCkSlL8tLQY1D4Dgxy9skftB2PVfaSA7f.#=zXitnQFI=(#=z7yhUgs9XPckghCw7wO$r4dZaH2sDLy11HTPOIBQ= #=zshb_3j0=)
   at #=zu$ASKCBwNBZFCkSl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Enk87q, #=zuTu8FT0$o6s8fUQQz1JtbS6wXWcm #=zeJDrXYU=, TimeSpan #=zd8xDpC8=)
   at #=zicvjhVXIFbVJvzHHr9dN$qzQ74hK.Render(#=zuTu8FT0$o6s8fUQQz1JtbS6wXWcm #=zeJDrXYU=, TimeSpan #=zd8xDpC8=, #=zt5Zv_olaYL9l1dCL9yBWuPU=[] #=zsy0$r$I=)
   at #=z_vBYH06eUazFzIOsurwlReIs33$K.Render(#=zuTu8FT0$o6s8fUQQz1JtbS6wXWcm #=zeJDrXYU=, #=zAJf5knY= #=z_R$Qewk=, TimeSpan #=zd8xDpC8=)
   at #=z_vBYH06eUazFzIOsurwlReIs33$K.Render(#=zuTu8FT0$o6s8fUQQz1JtbS6wXWcm #=zeJDrXYU=, #=zAJf5knY= #=z_R$Qewk=)
   at #=z9YNBd3PWBYXKj20HU_rwBaRhKz3R.#=zDE9B1zw=(Stream #=zO2FGWncL3ouD, Document #=zhIq3gn2tyPBl, HtmlLoadOptions #=zE1pPT3IS0Eqd, String #=zQXY7vm0cF2L1)
   at #=z9YNBd3PWBYXKj20HU_rwBaRhKz3R.#=zDE9B1zw=(Stream #=zO2FGWncL3ouD, Document #=zhIq3gn2tyPBl, HtmlLoadOptions #=zE1pPT3IS0Eqd)
   at Aspose.Pdf.Document.#=zofxKmy8=(Stream #=zZRmoOhs=, LoadOptions #=zauRjRxU=)
   at Aspose.Pdf.Document..ctor(Stream input, LoadOptions options)
   at Aspose.Test.Pdf.Program.Main(String[] args) in /Users/schmitch/projects/schmitch/dotnet/Aspose.Test.Pdf/Aspose.Test.Pdf/Program.cs:line 65


Also the fonts are correct since I can generate a simple pdf with just calibri via:

        static void Instant(Font font)
        {
            var doc = new Document
            {
                EmbedStandardFonts = true
            };
            Page page = doc.Pages.Add();
            TextFragment text = new TextFragment(demo);
            text.TextState.Font = font;
            page.Paragraphs.Add(text);
            doc.Convert(new PdfFormatConversionOptions(PdfFormat.PDF_A_3B));
            doc.Save("hase.pdf");
        }

however html to pdf does not work.


#10

@cschmitt

Please ensure libgdiplus package is installed in your environment or reinstall it if already installed. There are not any environment specific limitations of the API so we are hopeful your problem of NullReferenceException will probably be resolved as well.


#11

I have libgdiplus already installed:

✗ brew info mono-libgdiplus
mono-libgdiplus: stable 5.6.1 (bottled)
GDI+-compatible API on non-Windows operating systems
https://www.mono-project.com/docs/gui/libgdiplus/
/usr/local/Cellar/mono-libgdiplus/5.6.1 (13 files, 930.0KB) *
  Poured from bottle on 2019-06-03 at 09:21:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mono-libgdiplus.rb
==> Dependencies
Build: autoconf ✔, automake ✘, libtool ✔, pkg-config ✔
Required: cairo ✔, fontconfig ✔, freetype ✔, gettext ✔, giflib ✔, glib ✔, jpeg ✔, libexif ✔, libpng ✔, libtiff ✔, pixman ✔
✗ brew install mono-libgdiplus
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.

Warning: mono-libgdiplus 5.6.1 is already installed and up-to-date
To reinstall 5.6.1, run `brew reinstall mono-libgdiplus`

#12

@cschmitt

Since this thread has intermixed few exceptions, errors and scenarios so would you kindly compile the details about NullReferenceException that you are facing lately. Kindly share SSCCE code and mention if this is a file specific issue or if it occurs with every file you work with. Please also share a sample ZIP file so that we may try to reproduce it and assist you efficiently.


#13
Start: Loading Document
System.NullReferenceException: Object reference not set to an instance of an object.
   at #=zOL931fUr_OVzcG0cX7B5ZMNanJ1UeCnh2PCHntc=.#=z07uPIWZOYJNi(#=zbzZwe_AQy8UOCQIc4qa7UunQ1JBcn2cPHg== #=z1gcEu3k=, Char #=zg6m4HVc=)
   at #=zOL931fUr_OVzcG0cX7B5ZMNanJ1UeCnh2PCHntc=.#=z07uPIWZOYJNi(#=zbzZwe_AQy8UOCQIc4qa7UunQ1JBcn2cPHg== #=z1gcEu3k=)
   at #=zf_XiHEHclcw5E9yIqNDNz2RLMq3VXVidFz7fZRkNYTxI.#=zIhpZse4=()
   at #=zly3aAjX1oihDx$GCEu8bhWocy9goAvJwnyNxaG_vUDPC.#=z7xJLsatDrhw3()
   at #=zSSqOYkctc8_YPCsGMhx82SOG$N7kDtdnCyHVlBL2kCX1sTKFbx9yxhg=.#=zM9LGwpYVoJPK()
   at #=zSSqOYkctc8_YPCsGMhx82SOG$N7kDtdnCyHVlBL2kCX1sTKFbx9yxhg=.#=z51MNEyrjUX_OcRcEGGrpjDs=(List`1 #=z4AOz1Gc=, #=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=)
   at #=zSSqOYkctc8_YPCsGMhx82SOG$N7kDtdnCyHVlBL2kCX1sTKFbx9yxhg=.#=zRZ_9Hq_nFspnYCW7sw==(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, List`1 #=zq$hssOA=)
   at #=zofqkBRbXsJBx8l788awA85U49tuI$XxiQ3mYV7cEze3H.#=zLbZHOAPePUHusF9Dbw==(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, Int32 #=z2MTuBsI=, Stack`1 #=zT0Mh8xVdFg6E, #=zpeKV3fK126a4eR8xZQD1UpQjWFoN5ju8tTk4hj0= #=z02KkDt4H2TZX, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=zl8yKEfIlQTUY)
   at #=zofqkBRbXsJBx8l788awA85U49tuI$XxiQ3mYV7cEze3H.#=zLbZHOAPePUHusF9Dbw==(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, Int32 #=z2MTuBsI=)
   at #=z_GbJzc4L1qGmx9Afm0aHRaBhgfh81huYL$d3Q9oud2tT.#=zTIO9yhqnG8le(#=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=z4aRUUKOeDYxw, #=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, #=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zoTmku_E1NA7b, Int32 #=z2MTuBsI=, Stack`1 #=zT0Mh8xVdFg6E, #=zpeKV3fK126a4eR8xZQD1UpQjWFoN5ju8tTk4hj0= #=z02KkDt4H2TZX, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=zoRzduQpcgKaq)
   at #=z_GbJzc4L1qGmx9Afm0aHRaBhgfh81huYL$d3Q9oud2tT.#=zRW7v_ieaQiRQ(List`1 #=zq$hssOA=, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=z4aRUUKOeDYxw, #=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, Int32 #=z2MTuBsI=, Stack`1 #=zT0Mh8xVdFg6E, #=zpeKV3fK126a4eR8xZQD1UpQjWFoN5ju8tTk4hj0= #=zpaYXpYU=, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=zl8yKEfIlQTUY)
   at #=z_GbJzc4L1qGmx9Afm0aHRaBhgfh81huYL$d3Q9oud2tT.#=zLbZHOAPePUHusF9Dbw==(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, Int32 #=z2MTuBsI=, #=zpeKV3fK126a4eR8xZQD1UpQjWFoN5ju8tTk4hj0= #=z02KkDt4H2TZX, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=zoRzduQpcgKaq)
   at #=z_GbJzc4L1qGmx9Afm0aHRaBhgfh81huYL$d3Q9oud2tT.#=zLbZHOAPePUHusF9Dbw==(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, Int32 #=z2MTuBsI=)
   at #=zoMiPA3XWOaOp9KqNa2hBT$U3004B17Hp59VfKjc=.#=zLbZHOAPePUHusF9Dbw==(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zs$oXhrk=, Int32 #=z2MTuBsI=)
   at #=zwFr_rQlSNxJAXWr58xYqoVD625AWyBdAua1X4Yg=.#=z7JQjRFLlMSrC(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zoTmku_E1NA7b, Int32 #=zHMb4q9IiP8s6, #=zpeKV3fK126a4eR8xZQD1UpQjWFoN5ju8tTk4hj0= #=zOqP8UQzxjUqSMPrWUw==, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=zl8yKEfIlQTUY, List`1 #=zCYE2d8ghbdB1)
   at #=zoMiPA3XWOaOp9KqNa2hBT$U3004B17Hp59VfKjc=.#=z7JQjRFLlMSrC(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zoTmku_E1NA7b, Int32 #=zHMb4q9IiP8s6, #=zpeKV3fK126a4eR8xZQD1UpQjWFoN5ju8tTk4hj0= #=zOqP8UQzxjUqSMPrWUw==, #=zs0jtGuNpSMAaDQptV0iXao_YA13qtb_$6ajQXJo= #=zoRzduQpcgKaq, List`1 #=zCYE2d8ghbdB1)
   at #=zoMiPA3XWOaOp9KqNa2hBT$U3004B17Hp59VfKjc=.#=z7JQjRFLlMSrC(#=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=zoTmku_E1NA7b, Int32 #=zHMb4q9IiP8s6)
   at #=zwFr_rQlSNxJAXWr58xYqoVD625AWyBdAua1X4Yg=.#=zvk1EKNHVWSJ1(Int32 #=zwzhV033EhMTH, Boolean #=zUBnlJjtO4M1Q, #=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=z2kDhL2MXHQKC)
   at #=zoMiPA3XWOaOp9KqNa2hBT$U3004B17Hp59VfKjc=.#=zvk1EKNHVWSJ1(Int32 #=zwzhV033EhMTH, #=z53o0atZY$LnASGCXrdj8v9PSuYyxxv1NGb80fGY= #=z2kDhL2MXHQKC)
   at #=z3raz2QsEGMM3pv0cdeGDGo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FicE=(#=zuTu8FT0$o6s8fUQQz1JtbS6wXWcm #=zeJDrXYU=, #=zwmfDxpGLZSqZ4GAkWV0La2y277om #=zf0fMN3Y=)
   at #=zwmfDxpGLZSqZ4GAkWV0La2y277om.#=zKcxFicE=(#=zuTu8FT0$o6s8fUQQz1JtbS6wXWcm #=zeJDrXYU=)
   at #=zL6Vj3Og6_JzvX4Gm3_lgEYMyZGKU.#=z1d3vuEo=()
   at #=zL6Vj3Og6_JzvX4Gm3_lgEYMyZGKU.MoveNext()
   at #=zt_IZGtinRyTWeL4mnjVhkgI0SjA5O_1oJg==.#=zozQBzZUpKj5n(#=zdt8lLBk3$HPwav1XmdTlvRc= #=zO4dKBj_W61lH0GGLgw==, #=zwmfDxpGLZSqZ4GAkWV0La2y277om[] #=zYxqKnTEnk87q, #=zuTu8FT0$o6s8fUQQz1JtbS6wXWcm #=zeJDrXYU=, TimeSpan #=zd8xDpC8=)
   at #=zicvjhVXIFbVJvzHHr9dN$qzQ74hK.Render(#=zuTu8FT0$o6s8fUQQz1JtbS6wXWcm #=zeJDrXYU=, TimeSpan #=zd8xDpC8=, #=zt5Zv_olaYL9l1dCL9yBWuPU=[] #=zsy0$r$I=)
   at #=z_vBYH06eUazFzIOsurwlReIs33$K.Render(#=zuTu8FT0$o6s8fUQQz1JtbS6wXWcm #=zeJDrXYU=, #=zAJf5knY= #=z_R$Qewk=, TimeSpan #=zd8xDpC8=)
   at #=z_vBYH06eUazFzIOsurwlReIs33$K.Render(#=zuTu8FT0$o6s8fUQQz1JtbS6wXWcm #=zeJDrXYU=, #=zAJf5knY= #=z_R$Qewk=)
   at #=z9YNBd3PWBYXKj20HU_rwBaRhKz3R.#=zDE9B1zw=(Stream #=zO2FGWncL3ouD, Document #=zhIq3gn2tyPBl, HtmlLoadOptions #=zE1pPT3IS0Eqd, String #=zQXY7vm0cF2L1)
   at #=z9YNBd3PWBYXKj20HU_rwBaRhKz3R.#=zDE9B1zw=(Stream #=zO2FGWncL3ouD, Document #=zhIq3gn2tyPBl, HtmlLoadOptions #=zE1pPT3IS0Eqd)
   at Aspose.Pdf.Document.#=zofxKmy8=(Stream #=zZRmoOhs=, LoadOptions #=zauRjRxU=)
   at Aspose.Pdf.Document..ctor(Stream input, LoadOptions options)
   at Aspose.Test.Pdf.Program.Main(String[] args) in /Users/schmitch/projects/schmitch/dotnet/Aspose.Test.Pdf/Aspose.Test.Pdf/Program.cs:line 26

Process finished with exit code 0.

Here is my sample Project, however a developer still needs to copy a license file into the Project folder with the name Aspose.PDF.lic
demo.zip (1.1 KB)

Changing the HTML does not change a fact. I mean I have the simpliest html that can be used.
My Platform:
macOS Mojave
Version: 10.14.5
dotnet --version
2.2.106


#14

@cschmitt

We are setting up the environment and will get back to you with our findings soon.


#15

anything new about the issue?


#16

@cschmitt

We are checking the details and will share our findings with you within a couple of days. We appreciate your patience and cooperation in this regard.


#17

@cschmitt

Thank you for being patient.

We have managed to reproduce the exception in our environment. A ticket with ID PDFNET-46706 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.