以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]全局代码算定义变量时出现如图错误 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=194554) |
-- 作者:2900819580 -- 发布时间:2024/12/20 17:21:00 -- [求助]全局代码算定义变量时出现如图错误 此主题相关图片如下:截屏图片2024122001.jpg Public Enum Definition One = 1 Two = 2 Three = 3 Four = 4 Five = 5 Six = 6 Seven = 7 Eight = 8 Nine = 9 Ten = 10 End Enum \'\'\' <summary> \'\'\' 将PDF文档转换为图片的方法 \'\'\' </summary> \'\'\' <param name="pdfInputPath">PDF文件路径</param> \'\'\' <param name="imageOutputPath">图片输出路径</param> \'\'\' <param name="imageName">生成图片的名字</param> \'\'\' <param name="startPageNum">从PDF文档的第几页开始转换</param> \'\'\' <param name="endPageNum">从PDF文档的第几页开始停止转换</param> \'\'\' <param name="imageFormat">设置所需图片格式</param> \'\'\' <param name="definition">设置图片的清晰度,数字越大越清晰</param> Public Sub ConvertPDF2Image(pdfInputPath As String, imageOutputPath As String, imageName As String, startPageNum As Integer, endPageNum As Integer, imageFormat As ImageFormat, _ definition As Definition) Dim pdfFile__1 As O2S.Components.PDFRender4NET.PDFFile = O2S.Components.PDFRender4NET.PDFFile.Open(pdfInputPath) If Not IO.Directory.Exists(imageOutputPath) Then IO.Directory.CreateDirectory(imageOutputPath) End If \' validate pageNum If startPageNum <= 0 Then startPageNum = 1 End If If endPageNum > pdfFile__1.PageCount Then endPageNum = pdfFile__1.PageCount End If If startPageNum > endPageNum Then Dim tempPageNum As Integer = startPageNum startPageNum = endPageNum endPageNum = startPageNum End If \' start to convert each page For i As Integer = startPageNum To endPageNum Dim pageImage As Bitmap = pdfFile__1.GetPageImage(i - 1, 56 * CInt(definition)) pageImage.Save(imageOutputPath & imageName & i.ToString() & "." & imageFormat.ToString(), imageFormat) pageImage.Dispose() Next pdfFile__1.Dispose() End Sub [此贴子已经被作者于2024/12/20 17:22:22编辑过]
|
-- 作者:有点蓝 -- 发布时间:2024/12/20 17:36:00 -- 把使用的第三方dll放到Foxtable安装目录,然后添加引用:http://www.foxtable.com/webhelp/topics/1936.htm |
-- 作者:2900819580 -- 发布时间:2024/12/20 17:40:00 -- f 此主题相关图片如下:aa20241220021.jpg 老师Dll在安装文件夹内。
|
-- 作者:有点蓝 -- 发布时间:2024/12/21 8:39:00 -- 添加引用了吗。或者使用vs测试通过后再搬到Foxtable里 |