-
-
Save sergio9508/cc22f508b094271ab259161a365a13db to your computer and use it in GitHub Desktop.
Convert PDF base 64 to image base64
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static List<string> ConvertPdfToImages(string documento) | |
{ | |
var images = Conversion.ToImages(documento, null, 150); | |
var result = new List<string>(); | |
foreach (var image in images) | |
{ | |
SKImage imagen = SKImage.FromPixels(image.PeekPixels()); | |
SKData encoded = imagen.Encode(); | |
Stream stream = encoded.AsStream(); | |
stream.Position = 0; | |
using MemoryStream ms = new MemoryStream(); | |
stream.CopyTo(ms); | |
var base64 = ms.ToArray(); | |
result.Add(Convert.ToBase64String(base64)); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using library PDFtoImage https://www.nuget.org/packages/PDFtoImage