I’m generating a preview image of a PDF using PngDevice. None of the text in this PDF is rendered to the image.
I’ve attached the sample PDF and the image output.
I’m using the following code to generate the image:
MemoryStream stream = new MemoryStream();
Document pdfDocument = new Document(sourceFileInfo.FullFilePath);<span style="color: rgb(43, 145, 175); ">Page</span> firstPage = pdfDocument.Pages.Cast<<span style="color: rgb(43, 145, 175); ">Page</span>>().First(); <span style="color: rgb(43, 145, 175); ">PngDevice</span> pngDevice = <span style="color: blue; ">new</span> <span style="color: rgb(43, 145, 175); ">PngDevice</span>((<span style="color: blue; ">int</span>)firstPage.MediaBox.Width, (<span style="color: blue; ">int</span>)firstPage.MediaBox.Height); pngDevice.Process(firstPage, stream);</pre></div>