首页
/
每日頭條
/
科技
/
pdf如何添加頁面
pdf如何添加頁面
更新时间:2025-07-11 17:29:25

如何在pdf中添加自己小工具,以下示範添加一個打圈圈功能的插件

新建文本文檔.txt

把下面代碼複制粘貼到文件中保存并改名qq.js

插件放在安裝目錄下

設置一下

工具就出現

global.cs = 1; //count 開始号碼

global.cs1 = 8; //字體大小

global.cs2 = 10; //圈圈大小

var dialog1 =

{

initialize: function(dialog){

}

, commit: function(dialog)

{

// called when OK pressed

var results = dialog.store();

global.cs = results["fnum"];

global.cs1 = results["tnum"];

global.cs2 = results["qnum"];

}

, description:

{

name: "Personal Data", // Dialog box title

align_children: "align_left", width: 120, height: 200, elements: [

{

type: "cluster", name: "參數", align_children: "align_left",

elements: [

{

type: "view", align_children: "align_row", elements: [

{

type: "static_text", name: "開始号碼: "

}

,

{

item_id: "fnum", type: "edit_text", alignment: "align_fill",

width: 80, height: 20

}

]

}

,

{

type: "view", align_children: "align_row", elements: [

{

type: "static_text", name: "字體大小: "

}

,

{

item_id: "tnum", type: "edit_text", alignment: "align_fill",

width: 80, height: 20

}

]

}

,

{

type: "view", align_children: "align_row", elements: [

{

type: "static_text", name: "圈圈大小: "

}

,

{

item_id: "qnum", type: "edit_text", alignment: "align_fill",

width: 80, height: 20

}

]

}

]

}

,

{

alignment: "align_center", type: "ok_cancel", ok_name: "Ok",

cancel_name: "Cancel"

}

]

}

};

var myscipt = "\n" "var Dx=global.cs2;\n"

"var x1=this.mouseX-parseInt(Dx);\n" "var x2=this.mouseX parseInt(Dx);\n"

"var y1=this.mouseY-parseInt(Dx);\n"

"var y2=this.mouseY parseInt(Dx);\n" "var rr=new Array(4);\n"

"rr[0]=x1;\n" "rr[1]=y1;\n" "rr[2]=x2;\n" "rr[3]=y2;\n"

"var annot = this.addAnnot({\n" "page: this.pageNum,\n"

"type: \"Circle\",\n" "rect: rr,\n" "readonly : true,\n"

"strokeColor :color.red ,\n" "fillColor:color.transparent,\n"

"name: \"圓\"\n" "});\n"

"var m = (new Matrix2D).fromRotated(this,this.pageNum);\n"

"var mInv = m.invert();\n" "r= mInv.transform(rr);\n"

"r=r.toString();\n" "r = r.split(\",\");\n"

"var count=parseInt(global.cs );\n"

"var f = this.addField(\"qq\" count, \"text\",this.pageNum,[r[0], r[1], r[2], r[3]] );\n" "f.delay = true;\n" "f.alignment = \"center\";\n" "f.textSize=parseInt(global.cs1);\n" "f.value=count;\n" "f.readonly = false;\n" "f.borderStyle = border.s;\n" "f.lineWidth = 0;\n" "f.strokeColor = color.transparent;\n" "f.delay = false;\n"function addbottononpage()

{

if (this.getField("圈圈") == null)

{

var aRect = this.getPageBox(

{

nPage: this.pageNum

}

); //獲取當前頁大小

var f = this.addField("圈圈", "button", this.pageNum, aRect);

//增加一個當前頁大小一樣得按鈕

f.delay = true;

f.setAction("MouseDown", myscipt); //設置鼠标按下動作

f.highlight = highlight.n;

f.readonly = false;

f.borderStyle = border.s;

f.lineWidth = 0;

f.strokeColor = color.transparent;

f.delay = false;

}

app.execDialog(dialog1);

}

function removestop()

{

if (this.getField("圈圈") != null)

this.removeField("圈圈");

}

// 加入菜單color.red

app.addMenuItem(

{

cName: "快速打圈圈", cUser: "打圈圈", cParent: "Document", cExec:

"addbottononpage();", cEnable: "event.rc = (event.target != null);",

nPos: 0

}

);

//加入按鈕

app.addToolButton(

{

cName: "打圈圈", cLabel: "打圈圈", cEnable: "event.rc = (app.doc != null);",

cExec: "addbottononpage();"

}

);

app.addToolButton(

{

cName: "STOP", cLabel: "STOP", cEnable: "event.rc = (app.doc != null);",

cExec: "removestop();"

}

);

// end of script

pdf如何添加頁面(pdf中添加小工具方法)1

pdf如何添加頁面(pdf中添加小工具方法)2

pdf如何添加頁面(pdf中添加小工具方法)3

,
Comments
Welcome to tft每日頭條 comments! Please keep conversations courteous and on-topic. To fosterproductive and respectful conversations, you may see comments from our Community Managers.
Sign up to post
Sort by
Show More Comments
推荐阅读
簡單牛逼的電腦桌面
簡單牛逼的電腦桌面
當工作文檔越來越多,電腦程序越來越多;着急找重要的工作文件成了一件繁重有困難的事情,每次關鍵時刻總是掉鍊子,肯定也有很多小夥伴和我一樣都想要一個幹淨清爽的電腦桌面,很多時候一個簡簡單單清爽的桌面可以給自己帶來一天的好心情;也能通過一個簡單清...
2025-07-11
如何用錄好的視頻發直播
如何用錄好的視頻發直播
如何用錄好的視頻發直播?手機先點擊控制中心的【錄像】,或者從軟件直接下載一些電影也是可以的,現在小編就來說說關于如何用錄好的視頻發直播?下面内容希望能幫助到你,我們來一起看看吧!如何用錄好的視頻發直播手機先點擊控制中心的【錄像】,或者從軟件...
2025-07-11
賽爾号中最強大的四個精靈
賽爾号中最強大的四個精靈
賽爾号精靈的淘汰速度現在看起來是非常驚人的,一周的速度還不至于,不過一個月的時間足以讓巅峰來一次小洗牌,而一年的時間也足夠淘汰一年前的所有精靈,這就是目前賽爾号的現狀,而在衆多被淘汰的精靈中不乏曾經被稱為最強的王者,如今卻被官方遺忘而再也沒...
2025-07-11
nvme固态适合當移動硬盤用嗎
nvme固态适合當移動硬盤用嗎
寫在前面前段時間把Windows電腦換成了Macmini,M1芯片果然沒有讓我失望,性能強勁、系統流暢,應對日常碼字、修圖、剪視頻等工作綽綽有餘。不過,這邊還沒爽幾天呢,512GB的硬盤就已經容量告急。當初我在定制Macmini的時候,51...
2025-07-11
常新定時器質量如何
常新定時器質量如何
Due是一款由新加坡開發者LinJunjie開發的提醒事項應用。它的主要特點是:添加、處理任務快速方便,提醒功能強大。此外,支持自然語義識别和URLScheme特性也是它的特色。Due的基礎功能Due的功能可以分為三大闆塊,分别是「Remi...
2025-07-11
Copyright 2023-2025 - www.tftnews.com All Rights Reserved