Im Using .NET Core 3.1.
Im loading PDF from HTML file like this:
string htmlContent = File.ReadAllText("someFileWithHtml.txt");
string filename = Guid.NewGuid() + ".pdf";
var options = new AsposeHtml.Saving.PdfSaveOptions();
options.PageSetup.AnyPage.Margin.Bottom = new LengthOrAuto(Unit.FromPixels(85));
options.PageSetup.AnyPage.Margin.Top = new LengthOrAuto(Unit.FromPixels(75));
options.PageSetup.AnyPage.Margin.Left = new LengthOrAuto(Unit.FromPixels(20));
options.PageSetup.AnyPage.Margin.Right = new LengthOrAuto(Unit.FromPixels(20));
Aspose.Html.Converters.Converter.ConvertHTML(htmlContent, ".", options, filename);
Then, i want to add Stamp
into this file:
var fileStamp = new PdfFileStamp();
var stamp = new Stamp();
fileStamp.BindPdf(filename);
stamp.BindLogo(new FormattedText(
"Hello World",
new FontColor(0, 0, 0),
FontStyle.TimesRoman,
EncodingType.Cp1250,
false,
12));
stamp.SetOrigin(220, 800);
fileStamp.AddStamp(stamp);
fileStamp.Save(filename);
fileStamp.Close();
from this code i get an exception:
at Aspose.Pdf.Text.Font..ctor(#=zNHBl9bv5dKBFxtt9xgExszk= #=zg4LwFFM=)
at #=zrqioYeoeEV9SrAkxSuXwlXH5Ifyvlj21WdquE7oNTcGPoqO1Sd3yyi8=.#=zdLqnfTBuN$M4C$2UFip31dB2LdAV(String #=zpnc7MyM=, Font #=zg4LwFFM=, Font& #=zMKyPsWYDEY$fJObf78seVyY=)
at Aspose.Pdf.Text.TextSegment.set_Text(String value)
at Aspose.Pdf.Text.TextFragment.set_Text(String value)
at Aspose.Pdf.TextStamp.Put(Page page)
at Aspose.Pdf.Page.AddStamp(Stamp stamp)
at Aspose.Pdf.Facades.PdfFileStamp.#=z3WlzkzaWU5CT(Stamp #=zT1DBf1I=, Int32 #=zZfJaCY7K7AMe)
at Aspose.Pdf.Facades.PdfFileStamp.#=z3WlzkzaWU5CT(Stamp #=zT1DBf1I=)
at Aspose.Pdf.Facades.PdfFileStamp.AddStamp(Stamp stamp)
.. and so on...
My question is, how to add Stamp
using Aspose.PDF on Linux? It happend to any file that i uploading to my method (as htmlContent
). I cant attach any html file as example