-
Has anyone used Verify with EVO PDF ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
not that i know of. |
Beta Was this translation helpful? Give feedback.
-
I wrote the following code to get EVO PDF working: private static ConversionResult ConvertPdfToImages(Stream stream, IReadOnlyDictionary<string, object> settings)
{
var pdfToImageConverter = new PdfToImageConverter();
pdfToImageConverter.LicenseKey = "XXX==";
var pages = new List<Target>();
// set the handler to be called when a page was converted
pdfToImageConverter.PageConvertedEvent += args =>
{
// get the image object and page number from even handler argument
Image pdfPageImageObj = args.PdfPageImage.ImageObject;
int pageNumber = args.PdfPageImage.PageNumber;
var pageStream = new MemoryStream();
pdfPageImageObj.Save(pageStream, ImageFormat.Png);
args.PdfPageImage.Dispose();
var target = new Target("png", pageStream);
pages.Add(target);
};
pdfToImageConverter.ConvertPdfPagesToImageInEvent(stream);
return new ConversionResult(new { }, pages);
} Register it with: VerifierSettings.RegisterFileConverter("pdf", ConvertPdfToImages); (I recommend also registering Verify.ImageSharp.Compare to automatically compare the PNG pages.) You'll need "EvoPdf.PdfToImage.NetCore.x64" (or similar) NuGet package. As you can see above code is not finished (hard-coded license key and no extra PDF information). But I moved away to another free PDF to image converter. |
Beta Was this translation helpful? Give feedback.
I wrote the following code to get EVO PDF working: