Word to picture uses the Aspose component, Aspose.word.dll
public bool word2png (string docfile, string pngdir, out int Pngcount) { imagesaveoptions options = new imagesaveoptions (SaveFormat.Png); options. Resolution = 300; options. Prettyformat = true; options. useantialiasing = true; pngcount = 0; try { aspose.wordS.document doc = new aspose.words.document (docfile); for (int i = 0; i < doc. pagecount; i++) { options. pageindex = i; doc. Save (pngdir + i + ". png", options); pngCount++; } return true; } catch { return false; } }
PDF to picture is using the Aspose.pdf.dll component
public bool pdf2png (String srcpdfpath, string despicpath) { try { Aspose.Pdf.Document pdf = new Aspose.Pdf.Document (Srcpdfpath); for (int pagecount = 1; pagecount <= pdf. pages.count; pagecount++) { using (Filestream imagestream = new filestream ( despicpath + "\" + pagecount + ". png", filemode.create) { //create resolution object aspose.pdf.devices.resolution resolution = new aspose.pdf.devices.resolution (; ) Aspose.pdf.devices.pngdevice pngdevice = new aspose.pdf.devices.pngdevice (resolution); //convert a particular page and save the image to stream pngdevice.process (PDF. Pages[pagecount], imagestream); //close stream imagestream.close (); } } return true; } catch ( Exception e) { return false; } }
C # Word to picture PDF to picture