分享一个pdf阅读控件moonpdf.ocx的调用
By
admin
at 2021-06-20 • 0人收藏 • 1107人看过
这个ocx可以查看, 旋转,放大和缩小pdf
注意: 开源协议是AGPL , 意味着你用了它, 就要开源, 所以慎重使用
ocx开源项目地址:https://www.github.com/lengkristy/MoonPDF
项目参考的是开源pdf , 第三方库使用开源的mupdf,库版本使用mupdf-1.15.0,库的下载地址为:https://mupdf.com/downloads/
本aardio工程和ocx文件下载:
链接:https://pan.baidu.com/s/1b08aLwQqFN4n5bvxZwsuxA
提取码:genp
复制这段内容后打开百度网盘手机App,操作更方便哦
import win.ui; /*DSG{{*/ var winform = win.form(text="aardio form";right=896;bottom=492) winform.add( bk={cls="bk";left=0;top=30;right=896;bottom=493;bgcolor=8421376;db=1;dl=1;dr=1;dt=1;z=1}; button={cls="button";text="关于";left=1;top=5;right=69;bottom=26;dl=1;dt=1;z=3}; button10={cls="button";text="逆时针";left=710;top=5;right=765;bottom=26;dr=1;dt=1;z=8}; button11={cls="button";text="放大";left=770;top=5;right=834;bottom=26;dr=1;dt=1;z=9}; button12={cls="button";text="缩小";left=838;top=5;right=896;bottom=26;dr=1;dt=1;z=10}; button2={cls="button";text="开/关右键菜单";left=77;top=5;right=173;bottom=26;dl=1;dt=1;z=4}; button3={cls="button";text="打开文件";left=182;top=5;right=263;bottom=26;dl=1;dt=1;z=5}; button7={cls="button";text="本页另存为..";left=357;top=5;right=449;bottom=26;dl=1;dt=1;z=6}; button9={cls="button";text="顺时针";left=656;top=5;right=707;bottom=26;dr=1;dt=1;z=7}; combobox={cls="combobox";left=271;top=6;right=351;bottom=26;dl=1;dt=1;edge=1;font=LOGFONT(h=-8);items={};mode="dropdownlist";z=11}; static={cls="static";left=2;top=32;right=894;bottom=491;bgcolor=15780518;db=1;dl=1;dr=1;dt=1;notify=1;z=2} ) /*}}*/ import console console.open() import fsys.dlg; var moon = winform.static.createEmbed("MOONPDF.MoonPDFCtrl.1") var moonObj = moon._object; winform.button.oncommand = function(id,event){ moonObj.AboutBox() } winform.button2.oncommand = function(id,event){ moonObj.SetPopMenuVisiable(true); } winform.button3.oncommand = function(id,event){ var path = fsys.dlg.save("PDF文件|*.pdf"); if(path){ moonObj.OpenLocalPdf(path); var pageNum = moonObj.GetPdfPageCount(); var pageIndex = moonObj.GetCurrentPageIndex(); for(i=1;pageNum;1){ winform.combobox.add(i++"/"++pageNum); } winform.combobox.selIndex = pageIndex; } } winform.combobox.onListChange= function(){ //moonObj.EnableScrollToPage(true);//默认已开启 moonObj.GotoPage(winform.combobox.selIndex); } winform.button7.oncommand = function(id,event){ var path = fsys.dlg.save("PDF文件|*.pdf"); if(path){ moonObj.ExtractPageToSave(moonObj.GetCurrentPageIndex(),path); } } //winform.button8.oncommand = function(id,event){ //moonObj.EnableScrollToZoom(true); //} winform.button9.oncommand = function(id,event){ moonObj.PdfClockwiseRotation()//顺时针 } winform.button10.oncommand = function(id,event){ moonObj.PdfContrarotate()//逆时针 } winform.button11.oncommand = function(id,event){ moonObj.PdfZoomIn() } winform.button12.oncommand = function(id,event){ moonObj.PdfZoomOut() } winform.show(); win.loopMessage();
登录后方可回帖