pechkin 导出https路径的图片

使用Pechkin.Synchronized可以方便导出html为pdf,但是对于https路径的图片并不支持,仅支持http路径下的图片

解决方案:图片使用本地绝对路径(相对于服务器)

以下是我获取本地绝对路径的方法

     #region 获得当前绝对路径 /// <summary> /// 获得当前绝对路径 /// </summary> /// <param>指定的路径</param> /// <returns>绝对路径</returns> public static string GetMapPath(string strPath) { if (strPath.ToLower().StartsWith("http://")|| strPath.ToLower().StartsWith("https://")) { return strPath; } if (HttpContext.Current != null) { return HttpContext.Current.Server.MapPath(strPath); } else //非web程序引用 { strPath = strPath.Replace("http://www.likecs.com/", "\\"); if (strPath.StartsWith("\\") || strPath.StartsWith("~")) { strPath = strPath.Substring(strPath.IndexOf('\\', 1)).TrimStart('\\'); } return System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strPath); } } #endregion

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpfwgd.html