public static List <Dictionary <string, object> > FindPage(int stratPage, int page) { // 指定 Dictionary List集合存储每次查询的图片相关信息 List <Dictionary <string, object> > list = new List <Dictionary <string, object> >(); int pdfCount = AsposeFileToImg.getPDFCount(projectPath + "imgs/aaa.pdf"); // 分解相应页数的文档图片 AsposeFileToImg.FileToImg(projectPath + "imgs/aaa.pdf", stratPage, page); // 获取文件名 string filename = Path.GetFileNameWithoutExtension(projectPath + "imgs/aaa.pdf").ToLower(); // 判断文件夹是否存在 //if (Directory.Exists(projectPath + "imgs/" + filename)) //{ // DirectoryInfo dir = new DirectoryInfo(projectPath + "imgs/" + filename); // FileInfo[] fiList = dir.GetFiles(); // Console.WriteLine(fiList); //} int num = ((stratPage - 1) * page) + 1; // 判断当前获取的内容是否超过了文档页数大小 if (pdfCount >= (num + page)) { for (int i = num; i < num + page; i++) { productData(list, i, filename); } } // 页数超过文档页进行处理 if (pdfCount < (num + page) && num < pdfCount) { for (int i = num; i < pdfCount + 1; i++) { productData(list, i, filename); } } return(list); }
/// <summary> /// 页面加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { // 获取文档总页数 pageTate = AsposeFileToImg.getPDFCount(projectPath + "imgs/aaa.pdf").ToString(); }