For diff with another. This is a problem with DevExpress Lib.
I have code below. On calling AddRubberStampAnnotation i have null reference exception without any stacktrace inside lib. Streams not empty, so i have no idea wtf. Using FilePath instead of Stream does not make any changes.
My goal are combine stamp(its full A4 pdf doc with all pages of pdf doc) My usings are
<PackageReference Include="DevExpress.Document.Processor" Version="22.1.4" />
<PackageReference Include="DevExpress.Drawing" Version="22.1.4" />
<PackageReference Include="DevExpress.Pdf.Core" Version="22.1.4" />
<PackageReference Include="DevExpress.Pdf.Drawing" Version="22.1.4" />
public static byte[] MergeWithStampDevEx(this byte[] doc, byte[] stamp)
{
using var docStream = new MemoryStream(doc);
using var outStream = new MemoryStream();
using var stampStream = new MemoryStream(stamp);
using var proccessor = new PdfDocumentProcessor();
proccessor.LoadDocument(docStream);
var rec = proccessor.Document.Pages[0].CropBox;
foreach (var page in proccessor.DocumentFacade.Pages)
{
var stampFacade = page.AddRubberStampAnnotation(rec, stampStream, page.PageNumber);
stampFacade.Opacity = WatermarkTransparentState;
}
proccessor.SaveDocument(outStream);
return outStream.ToArray();
}
Maybe ill must choose another way and its imposible?
Im tried to debug, but didnt see anything empty. So i have no ideas. From my code nothing is null, all have values and seems ok, so This question not usefull to detect a problem. One more - not enough stacktrace from deep of devexpress that is problem.