public void ConvertToImage(string filePath, int resolution) { //先将Word转换为PDF文件 string pdfPath; try { using (WordToPdf convert = new WordToPdf()) { pdfPath = convert.ToPdf(filePath); } } catch (COMException) { pdfPath = Path.ChangeExtension(filePath, "pdf"); if (!File.Exists(pdfPath)) { Aspose.Words.Document doc = new Aspose.Words.Document(filePath); doc.Save(pdfPath, Aspose.Words.SaveFormat.Pdf); } } //再将PDF转换为图片 PdfConversion converter = new PdfConversion() { CallBack = CallBack }; converter.ConvertToImage(pdfPath, resolution); }
public void ConvertToImage(string filePath, int resolution) { Aspose.Slides.Presentation doc = new Aspose.Slides.Presentation(filePath); //先将ppt转换为PDF文件 string tmpPdfPath = Path.ChangeExtension(filePath, "pdf"); doc.Save(tmpPdfPath, Aspose.Slides.Export.SaveFormat.Pdf); //再将PDF转换为图片 PdfConversion converter = new PdfConversion() { CallBack = CallBack }; converter.ConvertToImage(filePath, resolution); }
public void ConvertToImage(string filePath, int resolution) { Aspose.Cells.Workbook doc = new Aspose.Cells.Workbook(filePath); //先将Excel转换为PDF临时文件 string pdfPath = Path.ChangeExtension(filePath, "pdf"); doc.Save(pdfPath, Aspose.Cells.SaveFormat.Pdf); //再将PDF转换为图片 PdfConversion converter = new PdfConversion() { CallBack = CallBack }; converter.ConvertToImage(filePath, resolution); }