I searched quite a bit and did not find this exact scenario, so I apologize if it is a duplicate.
Hi Matt,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thank you for sharing the sample code.
You will need to make a small update in your code to make it work. Please set the position of the stream to 0 before reading its contents. Please see the following updated code for your reference (Specially Bold part):
// Create a FileStream object to read the imag file
FileStream fs = File.OpenRead(@"D:\AP Data\December2012\input.pdf");
// Read the image into Byte array
byte[] pdfBytes = new byte[fs.Length];
fs.Read(pdfBytes, 0, pdfBytes.Length);
using (var stream = new MemoryStream(pdfBytes))
{
var converter = new PdfConverter();
converter.BindPdf(stream);
converter.StartPage = 1;
converter.EndPage = 1;
converter.DoConvert();
using (var outStream = new MemoryStream())
{
converter.GetNextImage(outStream, ImageFormat.Jpeg);
var outBytes = new byte[outStream.Length];
outStream.Position = 0;
outStream.Read(outBytes, 0, outBytes.Length);
File.WriteAllBytes(@"D:\AP Data\December2012\output.jpg", outBytes);
}
converter.Close();
}
Please feel free to contact support in case you need any further assistance.
Thank You & Best Regards,
Oh my, I now feel foolish. Thank you!
Hi Matt,