Hello,
I just discovered Aspose products, and I’m trying to debug this code below (in a C#.NET Framewokr 4.7.2 solution) :
Pdf pdf = new Pdf();
Section section = pdf.Sections.Add();
Aspose.Pdf.Generator.Text text = new Aspose.Pdf.Generator.Text(section, html);
text.IsHtmlTagSupported = true;
text.IsHtml5Supported = true;
section.Paragraphs.Add(text);
Aspose.Pdf.Generator.HeaderFooter hHeader = new Aspose.Pdf.Generator.HeaderFooter(section);
section.OddHeader = hHeader;
section.EvenHeader = hHeader;
Aspose.Pdf.Generator.Image tHeader = new Aspose.Pdf.Generator.Image(section);
ImageInfo info = new ImageInfo();
info.File = LogoApplicationUrl;
info.FixWidth = 200;
tHeader.ImageInfo = info;
hHeader.Paragraphs.Add(tHeader);
PKCS1 signature = new PKCS1(Server.MapPath(Url.Content("~/Signatures/MrsSmith.pfx")), "Key");
signature.Reason = Const.SIGNATURE_REASON;
signature.ShowProperties = false;
signature.Date = [value];
PdfFileSignature pdfSign = new PdfFileSignature();
pdfSign.BindPdf(pdf);
pdfSign.SignatureAppearance = Server.MapPath(Url.Content("~/Images/Logo.jpg"));
pdfSign.Sign(1, Const.SIGNATURE_REASON, string.Empty, string.Empty, true, rect, signature);
MemoryStream output = new MemoryStream();
pdfSign.Save(output);
output.Position = 0;
return output;
There is a first bug in line:
pdfSign.BindPdf(pdf); --> ‘Server not found 404’
If I comment the Signature block at the end, another error occurs on the line:
pdfSign.Save(output); --> : NullReferenceException - Exception message: The facade is not initialized correctly. Please provide pdf document to the process.
I spent hours seeking for similar issues in the Internet, but I found nothing.
Except advice about the Aspose version (I work on old version 4.0.0, but I cannot upgrade it)
Could you please help?
Thank you in advance