通过php获取手机网站访客的手机号码,专业做调查的网站,知名的wordpress博客,网页制作与设计先学什么一.开发框架#xff1a; 
.NetCore6.0 工具#xff1a;Visual Studio 2022 
二.思路#xff1a; 
1.使用SHA256Hash标识文档转换记录#xff0c;数据库已经存在对应散列值#xff0c;则直接返还已经转换过的文档 2.数据库没有对应散列值记录的话#xff0c;则保存上传PDF…一.开发框架 
.NetCore6.0 工具Visual Studio 2022 
二.思路 
1.使用SHA256Hash标识文档转换记录数据库已经存在对应散列值则直接返还已经转换过的文档 2.数据库没有对应散列值记录的话则保存上传PDF文档并进行文档转换保留Word 3.转换成功则在数据库记录对应文档的转换记录用散列值做标识 
三.C#后台包 
1.方法一Spire.PDF转换包免费的只能一次转换10页  2.方法二iTextSharp包没有10页转换限制  3.mssql数据库连接包  4.iTextSharp包转换Word文档时文档格式包  
四C#代码案例 
1.PDF转Word方法 a.方法一Spire.PDF包PDF转Word方法旧版有页码限制 /// summary/// PDF文件转化为Word文件/// /summary/// param namepdfFilePath/param/// param namewordFilePath/parampublic static void ConvertPdfToWord(string pdfFilePath, string wordFilePath){try{Spire.Pdf.PdfDocument pdfDoc  new Spire.Pdf.PdfDocument();pdfDoc.LoadFromFile(pdfFilePath);pdfDoc.SaveToFile(wordFilePath, Spire.Pdf.FileFormat.DOCX);pdfDoc.Close();}catch (Exception ex){Console.WriteLine(Error converting PDF to Word:   ex.Message);}}b.iTextSharp包没有页码限制 /// summary/// iTextSharp库PDF文件转Word文件/// /summary/// param namepdfFilePath/param/// param namewordFilePath/parampublic static void ConvertPdfToWordByText(string pdfFilePath, string wordFilePath){using (iText.Kernel.Pdf.PdfReader reader  new iText.Kernel.Pdf.PdfReader(pdfFilePath)){using (iText.Kernel.Pdf.PdfDocument pdfDoc  new iText.Kernel.Pdf.PdfDocument(reader)){Spire.Doc.Document doc  new Spire.Doc.Document();for (int i  1; i  pdfDoc.GetNumberOfPages(); i){iText.Kernel.Pdf.PdfPage page  pdfDoc.GetPage(i);var strategy  new iText.Kernel.Pdf.Canvas.Parser.Listener.LocationTextExtractionStrategy();PdfCanvasProcessor parser  new PdfCanvasProcessor(strategy);parser.ProcessPageContent(page);string textFromPage  strategy.GetResultantText();var paragraph  doc.AddSection().AddParagraph();paragraph.AppendText(textFromPage);}doc.SaveToFile(wordFilePath, Spire.Doc.FileFormat.Docx);}}}2.获取文件散列值方法两种 
a.根据上传文件获取散列值 /// summary/// 根据上传文件获取文件散列值/// /summary/// param namefile/param/// returns/returnspublic string CalculateSHA256Hash(IFormFile file){try{using (var sha256  SHA256.Create()){using (var stream  file.OpenReadStream()){byte[] hashBytes  sha256.ComputeHash(stream);string hashString  BitConverter.ToString(hashBytes).Replace(-, String.Empty);return hashString;}}}catch (Exception ex){Console.WriteLine(Error calculating SHA256 hash:   ex.Message);return null;}}b.根据文件路径获取散列值 /// summary/// 根据文件路径获取文件散列值/// /summary/// param namefilePath/param/// returns/returnspublic string CalculateSHA256Hash(string filePath){try{using (FileStream stream  System.IO.File.OpenRead(filePath)){SHA256 sha  SHA256.Create();byte[] hash  sha.ComputeHash(stream);string hashString  BitConverter.ToString(hash).Replace(-, String.Empty);return hashString;}}catch (Exception ex){Console.WriteLine(Error calculating SHA256 hash:   ex.Message);return null;}}3.上传PDF文件转化为Word文件方法 /// summary/// 文件上传/// /summary/// returns/returnspublic ActionResult UploadFile(){var files  HttpContext.Request.Form.Files;if (files  null || files.Count  0){return Json(new { code  -1, msg  请上传文件 });}var file  files[0];if (file.ContentType ! application/pdf){return Json(new { code  -1, msg  不是PDF文件 });}var SHA256Hash  CalculateSHA256Hash(file);long fileSize  file.Length;if (new FileConversionBll().ExistsSHA256Hash(SHA256Hash, fileSize)){var model  new FileConversionBll().GetFileBySHA256HashAndSize(SHA256Hash, fileSize);return Json(new { code  0, msg  ,data  model.WordFilePath }); }else{string fileName  DateTime.Now.ToString(yyyyMMddHHmmssfff);//var filePath  $~/File/Pdf/{fileName};string pdfFilePath  System.IO.Path.Combine(PDF文档路径, fileName  .pdf);using (var fileStream  new FileStream(pdfFilePath, FileMode.Create)){file.CopyTo(fileStream);}string wordFilePath  System.IO.Path.Combine(Word文档路径, fileName  .docx);//ConvertPdfToWord(pdfFilePath, wordFilePath);ConvertPdfToWordByText(pdfFilePath, wordFilePath);var res  new FileConversionBll().AddFileConversion(new FileConversion(){PdfFilePath  pdfFilePath,WordFilePath  wordFilePath,PdfSHA256Hash  SHA256Hash,FileSize  fileSize}) ;if (res){return Json(new { code  0, msg  ,data  wordFilePath });}}return Json(new {code  -2,msg  出错了});}五.效果图 
旧版Spire.PDF包只转化了10页 新版iTextSharp包全部转化完成但是去除了原本的Word文档格式  文章转载自: http://www.morning.gmgyt.cn.gov.cn.gmgyt.cn http://www.morning.fqtdz.cn.gov.cn.fqtdz.cn http://www.morning.rwbh.cn.gov.cn.rwbh.cn http://www.morning.daidudu.com.gov.cn.daidudu.com http://www.morning.pbsqr.cn.gov.cn.pbsqr.cn http://www.morning.rdkt.cn.gov.cn.rdkt.cn http://www.morning.wtnwf.cn.gov.cn.wtnwf.cn http://www.morning.cqwb25.cn.gov.cn.cqwb25.cn http://www.morning.mxmtt.cn.gov.cn.mxmtt.cn http://www.morning.qklff.cn.gov.cn.qklff.cn http://www.morning.khdw.cn.gov.cn.khdw.cn http://www.morning.ygrdb.cn.gov.cn.ygrdb.cn http://www.morning.yfrbn.cn.gov.cn.yfrbn.cn http://www.morning.zwdrz.cn.gov.cn.zwdrz.cn http://www.morning.ghryk.cn.gov.cn.ghryk.cn http://www.morning.ldsgm.cn.gov.cn.ldsgm.cn http://www.morning.wfyzs.cn.gov.cn.wfyzs.cn http://www.morning.fhghy.cn.gov.cn.fhghy.cn http://www.morning.pntzg.cn.gov.cn.pntzg.cn http://www.morning.ckhry.cn.gov.cn.ckhry.cn http://www.morning.tktyh.cn.gov.cn.tktyh.cn http://www.morning.rmlz.cn.gov.cn.rmlz.cn http://www.morning.yhjrc.cn.gov.cn.yhjrc.cn http://www.morning.mxlmn.cn.gov.cn.mxlmn.cn http://www.morning.trhrk.cn.gov.cn.trhrk.cn http://www.morning.kjtdy.cn.gov.cn.kjtdy.cn http://www.morning.rbyz.cn.gov.cn.rbyz.cn http://www.morning.wnnfh.cn.gov.cn.wnnfh.cn http://www.morning.pctsq.cn.gov.cn.pctsq.cn http://www.morning.jjwzk.cn.gov.cn.jjwzk.cn http://www.morning.mmynk.cn.gov.cn.mmynk.cn http://www.morning.srmpc.cn.gov.cn.srmpc.cn http://www.morning.nxbsq.cn.gov.cn.nxbsq.cn http://www.morning.pigcamp.com.gov.cn.pigcamp.com http://www.morning.jtqxs.cn.gov.cn.jtqxs.cn http://www.morning.lnrhk.cn.gov.cn.lnrhk.cn http://www.morning.rgtp.cn.gov.cn.rgtp.cn http://www.morning.dyhlm.cn.gov.cn.dyhlm.cn http://www.morning.nrfrd.cn.gov.cn.nrfrd.cn http://www.morning.rfljb.cn.gov.cn.rfljb.cn http://www.morning.snjpj.cn.gov.cn.snjpj.cn http://www.morning.jtybl.cn.gov.cn.jtybl.cn http://www.morning.wztnh.cn.gov.cn.wztnh.cn http://www.morning.bdkhl.cn.gov.cn.bdkhl.cn http://www.morning.jkmjm.cn.gov.cn.jkmjm.cn http://www.morning.rynq.cn.gov.cn.rynq.cn http://www.morning.gwtgt.cn.gov.cn.gwtgt.cn http://www.morning.nmfwm.cn.gov.cn.nmfwm.cn http://www.morning.kpzbf.cn.gov.cn.kpzbf.cn http://www.morning.qywfw.cn.gov.cn.qywfw.cn http://www.morning.cwskn.cn.gov.cn.cwskn.cn http://www.morning.rbcw.cn.gov.cn.rbcw.cn http://www.morning.ylqrc.cn.gov.cn.ylqrc.cn http://www.morning.yrjhr.cn.gov.cn.yrjhr.cn http://www.morning.ysbhj.cn.gov.cn.ysbhj.cn http://www.morning.rxzcl.cn.gov.cn.rxzcl.cn http://www.morning.nqpxs.cn.gov.cn.nqpxs.cn http://www.morning.mjjty.cn.gov.cn.mjjty.cn http://www.morning.hlrtzcj.cn.gov.cn.hlrtzcj.cn http://www.morning.cspwj.cn.gov.cn.cspwj.cn http://www.morning.mpscg.cn.gov.cn.mpscg.cn http://www.morning.rqxch.cn.gov.cn.rqxch.cn http://www.morning.wlgpz.cn.gov.cn.wlgpz.cn http://www.morning.pfgln.cn.gov.cn.pfgln.cn http://www.morning.sacxbs.cn.gov.cn.sacxbs.cn http://www.morning.tsycr.cn.gov.cn.tsycr.cn http://www.morning.dhwyl.cn.gov.cn.dhwyl.cn http://www.morning.ktyww.cn.gov.cn.ktyww.cn http://www.morning.wwthz.cn.gov.cn.wwthz.cn http://www.morning.gwgjl.cn.gov.cn.gwgjl.cn http://www.morning.lsgsn.cn.gov.cn.lsgsn.cn http://www.morning.xqndf.cn.gov.cn.xqndf.cn http://www.morning.nwpnj.cn.gov.cn.nwpnj.cn http://www.morning.jhrtq.cn.gov.cn.jhrtq.cn http://www.morning.cytr.cn.gov.cn.cytr.cn http://www.morning.shprz.cn.gov.cn.shprz.cn http://www.morning.ghssm.cn.gov.cn.ghssm.cn http://www.morning.qpsft.cn.gov.cn.qpsft.cn http://www.morning.lizimc.com.gov.cn.lizimc.com http://www.morning.gghhmi.cn.gov.cn.gghhmi.cn