When trying to convert txt file using below code snippet I get this exception:
“Could not load file or assembly ‘Aspose.HtmlOld, Version=17.1.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The system cannot find the file specified.”
using (var fileStream = new FileStream(@“c:\aa\test.txt”, FileMode.Open))
{
using (var sr = new StreamReader(fileStream, Encoding.UTF8))
{
string line;
var pdf = new Aspose.Pdf.Generator.Pdf();
pdf.PageSetup.PageHeight = Aspose.Pdf.Generator.PageSize.A4Height;
var section = pdf.Sections.Add();
while ((line = sr.ReadLine()) != null)
{
var paragraph = new Aspose.Pdf.Generator.Text(section, line);
section.Paragraphs.Add(paragraph);
}
var b = pdf.GetBuffer();
}
}
I’m using the latest Aspose dlls available for .NET 3.5 (17.1.0.0)
Edit: The same happens when converting tif, png, jpg, gif or bmp to pdf.
Best regards,
Bartek
Hi Joao,
Hi,
Thank you for your answer.
Please make sure you test it with .NET 3.5
I did a few tests and the issue occurs also for Aspose.Pdf.dll 16.12.0.0.
It works fine with Aspose 16.10.0.0 and before.
Best regards,
Bartek
Hi Bartek,
Hi,
using new DOM approach also throws an exception. I noticed that when referencing dll from path and Aspose.Pdf.dll is not present in GAC it works fine. When it is deployed to GAC (the only Aspose dll) issue comes back.
/Bartek
Hi Bartek,
DOM approach:
using (var tr = new StreamReader(@“c:\aa\test.txt”))
{
var doc = new Document();
Page page = doc.Pages.Add();
string line;
while ((line = tr.ReadLine()) != null)
{
var text = new TextFragment(line);
page.Paragraphs.Add(text);
}
doc.Save(@“c:\aa\TexttoPDF_out.pdf”);
}
gives similar exception:
Could not load file or assembly ‘Aspose.Font, Version=17.1.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The system cannot find the file specified.
We have verified that Aspose.Pdf.dll refers both: Aspose.HtmlOld.dll and Aspose.Font.dll.
Both issues occur only if Aspose.PDF.dll is deployed to GAC (if not and dll is taken from disc then conversion works fine).
Tested in LINQPad 2.45.05
Issue occurs also in web app (w3wp process .NET 3.5).
I enclose script used for tests.
Hi Bartek,
I got the same exception using your project (VS2010).
Reproduced on 2 different boxes.
I attach system information of our boxes.
Hi Joao,
Hi,
Is release date with the fix already known? I’d like to inform client about delivery time.
Best regards,
Bartłomiej Chojnowski
Hi Bartłomiej,
Hi Asad,
Hi Jonas,