日常办公中,你是否常遇到这样的困扰:客户发来的多张JPG设计图需要整理成PDF归档,手机拍摄的纸质文档照片想合并成规范文件,却找不到简单高效的转换方法?今天给大家推荐一款宝藏工具——在线批量JPG转PDF工具,无需安装软件,拖拽上传即可快速搞定,彻底解放你的双手!
这款工具的操作门槛几乎为零,哪怕是电脑小白也能轻松上手。打开网页后,只需点击上传区域,或直接将多张JPG、PNG图片拖拽至指定位置,系统会自动生成清晰预览,还能显示每张图片的原始文件名,方便你核对内容。预览时若发现不需要的图片,鼠标悬浮即可点击删除,整理过程灵活又便捷。
点击“批量生成PDF”按钮后,工具会自动处理每张图片,每张图片都将独立生成PDF文件,文件名与原图保持一致,无需后续手动重命名。转换过程全程在浏览器内完成,无需等待上传至云端,既保证了文件的安全性,又大大提升了处理速度,哪怕是几十张图片也能快速搞定。
无论是职场人士整理工作文档、学生归档学习资料,还是自由职业者处理客户文件,这款在线JPG转PDF工具都能完美适配需求。无需占用电脑内存,随时随地打开网页就能使用,让文件格式转换变得简单又高效!
下载地址: https://llqyjb.lanzoub.com/iqbBz3covgif
赶紧收藏起来,下次需要转换图片格式时,直接上手即用~ 你还在等什么?快去体验这款实用工具,让办公效率再上一个台阶!
源代码如下,复制保存为.html即可使用:
<!DOCTYPE html>
<html lang=”zh-CN”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>批量JPG转PDF工具</title>
<script src=”https://cdn.tailwindcss.com”></script>
<script src=”https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js”></script>
<script src=”https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js”></script>
</head>
<body class=”bg-gray-100 min-h-screen p-4 md:p-8″>
<div class=”max-w-3xl mx-auto bg-white rounded-xl shadow-md p-6″>
<h1 class=”text-2xl font-bold text-center text-gray-800 mb-6″>批量JPG转PDF</h1>
<!– 上传区域 –>
<div class=”border-2 border-dashed border-gray-300 rounded-lg p-8 text-center mb-6 hover:border-blue-500 transition-colors”>
<input type=”file” id=”fileInput” accept=”image/jpeg,image/png” multiple class=”hidden”>
<label for=”fileInput” class=”cursor-pointer”>
<svg xmlns=”http://www.w3.org/2000/svg” class=”h-16 w-16 mx-auto text-gray-400 mb-4″ fill=”none” viewBox=”0 0 24 24″ stroke=”currentColor”>
<path stroke-linecap=”round” stroke-linejoin=”round” stroke-width=”2″ d=”M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12″ />
</svg>
<p class=”text-gray-600″>点击或拖拽多张JPG/PNG图片到此处</p>
<p class=”text-gray-400 text-sm mt-2″>每张图片独立生成PDF,文件名与原图一致</p>
</label>
</div>
<!– 图片预览区域 –>
<div id=”previewContainer” class=”grid grid-cols-2 md:grid-cols-3 gap-4 mb-6 max-h-64 overflow-y-auto p-2 border border-gray-200 rounded-lg”>
<p class=”col-span-full text-center text-gray-400″ id=”emptyTip”>暂无图片,请上传</p>
</div>
<!– 操作按钮 –>
<div class=”flex flex-wrap gap-3 justify-center”>
<button id=”clearBtn” class=”px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300 transition-colors disabled:opacity-50 disabled:cursor-not-allowed” disabled>清空图片</button>
<button id=”convertBtn” class=”px-6 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed” disabled>批量生成PDF</button>
</div>
<!– 转换状态提示 –>
<div id=”statusTip” class=”mt-4 text-center text-gray-600 hidden”>
<svg xmlns=”http://www.w3.org/2000/svg” class=”h-6 w-6 inline-block animate-spin mr-2″ fill=”none” viewBox=”0 0 24 24″ stroke=”currentColor”>
<path stroke-linecap=”round” stroke-linejoin=”round” stroke-width=”2″ d=”M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15″ />
</svg>
正在批量生成PDF,请稍候…
</div>
</div>
<script>
var _0x9gc;const fileInput=document[‘\u0067\u0065\u0074\u0045\u006C\u0065\u006D\u0065\u006E\u0074\u0042\u0079\u0049\u0064’](“\u0066\u0069\u006C\u0065\u0049\u006E\u0070\u0075\u0074”);_0x9gc=(960592^960594)+(663295^663289);const previewContainer=document[‘\u0067\u0065\u0074\u0045\u006C\u0065\u006D\u0065\u006E\u0074\u0042\u0079\u0049\u0064’](“\u0070\u0072\u0065\u0076\u0069\u0065\u0077\u0043\u006F\u006E\u0074\u0061\u0069\u006E\u0065\u0072”);const emptyTip=document[‘\u0067\u0065\u0074\u0045\u006C\u0065\u006D\u0065\u006E\u0074\u0042\u0079\u0049\u0064’](“\u0065\u006D\u0070\u0074\u0079\u0054\u0069\u0070”);var _0xb67bd;const clearBtn=document[‘\u0067\u0065\u0074\u0045\u006C\u0065\u006D\u0065\u006E\u0074\u0042\u0079\u0049\u0064’](“ntBraelc”.split(“”).reverse().join(“”));_0xb67bd=(782293^782292)+(257445^257444);const convertBtn=document[‘\u0067\u0065\u0074\u0045\u006C\u0065\u006D\u0065\u006E\u0074\u0042\u0079\u0049\u0064’](“ntBtrevnoc”.split(“”).reverse().join(“”));var _0x_0xaed;const statusTip=document[‘\u0067\u0065\u0074\u0045\u006C\u0065\u006D\u0065\u006E\u0074\u0042\u0079\u0049\u0064’](“\u0073\u0074\u0061\u0074\u0075\u0073\u0054\u0069\u0070”);_0x_0xaed=(368186^368178)+(581701^581703);let imageFiles=[];fileInput[‘\u0061\u0064\u0064\u0045\u0076\u0065\u006E\u0074\u004C\u0069\u0073\u0074\u0065\u006E\u0065\u0072’](“\u0063\u0068\u0061\u006E\u0067\u0065”,handleFileUpload);[“\u0064\u0072\u0061\u0067\u0065\u006E\u0074\u0065\u0072″,”revogard”.split(“”).reverse().join(“”),”evaelgard”.split(“”).reverse().join(“”),”pord”.split(“”).reverse().join(“”)][‘\u0066\u006F\u0072\u0045\u0061\u0063\u0068’](eventName=>{document[‘\u0062\u006F\u0064\u0079’][‘\u0061\u0064\u0064\u0045\u0076\u0065\u006E\u0074\u004C\u0069\u0073\u0074\u0065\u006E\u0065\u0072’](eventName,preventDefaults,false);});function preventDefaults(e){e[‘\u0070\u0072\u0065\u0076\u0065\u006E\u0074\u0044\u0065\u0066\u0061\u0075\u006C\u0074’]();e[‘\u0073\u0074\u006F\u0070\u0050\u0072\u006F\u0070\u0061\u0067\u0061\u0074\u0069\u006F\u006E’]();}[“\u0064\u0072\u0061\u0067\u0065\u006E\u0074\u0065\u0072″,”revogard”.split(“”).reverse().join(“”)][‘\u0066\u006F\u0072\u0045\u0061\u0063\u0068’](eventName=>{document[‘\u0071\u0075\u0065\u0072\u0079\u0053\u0065\u006C\u0065\u0063\u0074\u006F\u0072’](“\u002E\u0062\u006F\u0072\u0064\u0065\u0072\u002D\u0064\u0061\u0073\u0068\u0065\u0064”)[‘\u0061\u0064\u0064\u0045\u0076\u0065\u006E\u0074\u004C\u0069\u0073\u0074\u0065\u006E\u0065\u0072’](eventName,highlight,false);});[“\u0064\u0072\u0061\u0067\u006C\u0065\u0061\u0076\u0065″,”pord”.split(“”).reverse().join(“”)][‘\u0066\u006F\u0072\u0045\u0061\u0063\u0068’](eventName=>{document[‘\u0071\u0075\u0065\u0072\u0079\u0053\u0065\u006C\u0065\u0063\u0074\u006F\u0072’](“dehsad-redrob.”.split(“”).reverse().join(“”))[‘\u0061\u0064\u0064\u0045\u0076\u0065\u006E\u0074\u004C\u0069\u0073\u0074\u0065\u006E\u0065\u0072’](eventName,unhighlight,false);});function highlight(){document[‘\u0071\u0075\u0065\u0072\u0079\u0053\u0065\u006C\u0065\u0063\u0074\u006F\u0072’](“\u002E\u0062\u006F\u0072\u0064\u0065\u0072\u002D\u0064\u0061\u0073\u0068\u0065\u0064”)[‘\u0063\u006C\u0061\u0073\u0073\u004C\u0069\u0073\u0074’][‘\u0061\u0064\u0064’](“\u0062\u006F\u0072\u0064\u0065\u0072\u002D\u0062\u006C\u0075\u0065\u002D\u0035\u0030\u0030″,”05-eulb-gb”.split(“”).reverse().join(“”));}function unhighlight(){document[‘\u0071\u0075\u0065\u0072\u0079\u0053\u0065\u006C\u0065\u0063\u0074\u006F\u0072’](“\u002E\u0062\u006F\u0072\u0064\u0065\u0072\u002D\u0064\u0061\u0073\u0068\u0065\u0064”)[‘\u0063\u006C\u0061\u0073\u0073\u004C\u0069\u0073\u0074’][‘\u0072\u0065\u006D\u006F\u0076\u0065’](“005-eulb-redrob”.split(“”).reverse().join(“”),”\u0062\u0067\u002D\u0062\u006C\u0075\u0065\u002D\u0035\u0030″);}document[‘\u0071\u0075\u0065\u0072\u0079\u0053\u0065\u006C\u0065\u0063\u0074\u006F\u0072’](“\u002E\u0062\u006F\u0072\u0064\u0065\u0072\u002D\u0064\u0061\u0073\u0068\u0065\u0064”)[‘\u0061\u0064\u0064\u0045\u0076\u0065\u006E\u0074\u004C\u0069\u0073\u0074\u0065\u006E\u0065\u0072’](“pord”.split(“”).reverse().join(“”),handleDrop,false);function handleDrop(e){const _0xdf_0xbb5=e[‘\u0064\u0061\u0074\u0061\u0054\u0072\u0061\u006E\u0073\u0066\u0065\u0072’];var _0xb8b84c=(963996^963992)+(993417^993421);const _0x66e=_0xdf_0xbb5[‘\u0066\u0069\u006C\u0065\u0073′];_0xb8b84c=’\u0064\u0068\u006C\u006C\u0066\u0063’;if(_0x66e[‘\u006C\u0065\u006E\u0067\u0074\u0068’]>(752998^752998)){handleFiles(_0x66e);}}function handleFileUpload(e){var _0x1c29d=(593508^593506)+(138781^138782);const _0x62021b=e[‘\u0074\u0061\u0072\u0067\u0065\u0074’][‘\u0066\u0069\u006C\u0065\u0073’];_0x1c29d=389249^389251;if(_0x62021b[‘\u006C\u0065\u006E\u0067\u0074\u0068’]>(716735^716735)){handleFiles(_0x62021b);fileInput[‘\u0076\u0061\u006C\u0075\u0065’]=”;}}function handleFiles(files){emptyTip[‘\u0073\u0074\u0079\u006C\u0065’][‘\u0064\u0069\u0073\u0070\u006C\u0061\u0079’]=”\u006E\u006F\u006E\u0065″;Array[‘\u0066\u0072\u006F\u006D’](files)[‘\u0066\u006F\u0072\u0045\u0061\u0063\u0068’](file=>{if(file[‘\u0074\u0079\u0070\u0065’][‘\u006D\u0061\u0074\u0063\u0068’](“\u0069\u006D\u0061\u0067\u0065\u002F\u006A\u0070\u0065\u0067”)||file[‘\u0074\u0079\u0070\u0065’][‘\u006D\u0061\u0074\u0063\u0068’](“\u0069\u006D\u0061\u0067\u0065\u002F\u0070\u006E\u0067″)){const _0xa0fcf=new FileReader();_0xa0fcf[‘\u006F\u006E\u006C\u006F\u0061\u0064’]=function(e){var _0x4dcc3b=(441502^441497)+(714444^714442);const _0x9233e=e[‘\u0074\u0061\u0072\u0067\u0065\u0074’][‘\u0072\u0065\u0073\u0075\u006C\u0074′];_0x4dcc3b=’\u006F\u0063\u0063\u006E\u006C\u006C’;imageFiles[‘\u0070\u0075\u0073\u0068’]({‘\u0075\u0072\u006C’:_0x9233e,’\u0066\u0069\u006C\u0065′:file,’\u006F\u0072\u0069\u0067\u0069\u006E\u0061\u006C\u004E\u0061\u006D\u0065′:file[‘\u006E\u0061\u006D\u0065’],”fileType”:file[‘\u0074\u0079\u0070\u0065’]});renderPreview(_0x9233e,imageFiles[‘\u006C\u0065\u006E\u0067\u0074\u0068’]-(108512^108513),file[‘\u006E\u0061\u006D\u0065’]);updateButtons();};_0xa0fcf[‘\u0072\u0065\u0061\u0064\u0041\u0073\u0044\u0061\u0074\u0061\u0055\u0052\u004C’](file);}});}function renderPreview(imageUrl,index,fileName){const _0x69c2fe=document[‘\u0063\u0072\u0065\u0061\u0074\u0065\u0045\u006C\u0065\u006D\u0065\u006E\u0074’](“\u0064\u0069\u0076″);_0x69c2fe[‘\u0063\u006C\u0061\u0073\u0073\u004E\u0061\u006D\u0065’]=”wodahs:revoh ms-wodahs neddih-wolfrevo dednuor 05-yarg-gb puorg evitaler”.split(“”).reverse().join(“”);_0x69c2fe[‘\u0064\u0061\u0074\u0061\u0073\u0065\u0074’][‘\u0069\u006E\u0064\u0065\u0078’]=index;_0x69c2fe[‘\u0069\u006E\u006E\u0065\u0072\u0048\u0054\u004D\u004C’]=`
<img src=”${imageUrl}” alt=”${fileName}” class=”w-full h-32 object-cover”>
<div class=”p-2 bg-white/80 text-xs text-gray-700 truncate”>${fileName}</div>
<button class=”absolute top-2 right-2 bg-red-500 text-white rounded-full w-6 h-6 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity” onclick=”removeImage(${index})”>×</button>
`;previewContainer[‘\u0061\u0070\u0070\u0065\u006E\u0064\u0043\u0068\u0069\u006C\u0064’](_0x69c2fe);}window[‘\u0072\u0065\u006D\u006F\u0076\u0065\u0049\u006D\u0061\u0067\u0065’]=function(index){imageFiles[‘\u0073\u0070\u006C\u0069\u0063\u0065’](index,172018^172019);previewContainer[‘\u0069\u006E\u006E\u0065\u0072\u0048\u0054\u004D\u004C’]=”;if(imageFiles[‘\u006C\u0065\u006E\u0067\u0074\u0068’]===(997578^997578)){emptyTip[‘\u0073\u0074\u0079\u006C\u0065’][‘\u0064\u0069\u0073\u0070\u006C\u0061\u0079’]=”\u0062\u006C\u006F\u0063\u006B”;}else{imageFiles[‘\u0066\u006F\u0072\u0045\u0061\u0063\u0068’]((img,i)=>renderPreview(img[‘\u0075\u0072\u006C’],i,img[‘\u006F\u0072\u0069\u0067\u0069\u006E\u0061\u006C\u004E\u0061\u006D\u0065’]));}updateButtons();};function updateButtons(){var _0xcc9d9g=(856207^856204)+(198312^198318);const _0x42c39f=imageFiles[‘\u006C\u0065\u006E\u0067\u0074\u0068’]>(634158^634158);_0xcc9d9g=(539485^539480)+(573414^573410);clearBtn[‘\u0064\u0069\u0073\u0061\u0062\u006C\u0065\u0064’]=!_0x42c39f;convertBtn[‘\u0064\u0069\u0073\u0061\u0062\u006C\u0065\u0064’]=!_0x42c39f;}clearBtn[‘\u0061\u0064\u0064\u0045\u0076\u0065\u006E\u0074\u004C\u0069\u0073\u0074\u0065\u006E\u0065\u0072’](“kcilc”.split(“”).reverse().join(“”),function(){imageFiles=[];previewContainer[‘\u0069\u006E\u006E\u0065\u0072\u0048\u0054\u004D\u004C’]=”;emptyTip[‘\u0073\u0074\u0079\u006C\u0065’][‘\u0064\u0069\u0073\u0070\u006C\u0061\u0079’]=”kcolb”.split(“”).reverse().join(“”);updateButtons();});convertBtn[‘\u0061\u0064\u0064\u0045\u0076\u0065\u006E\u0074\u004C\u0069\u0073\u0074\u0065\u006E\u0065\u0072’](“kcilc”.split(“”).reverse().join(“”),async function(){statusTip[‘\u0063\u006C\u0061\u0073\u0073\u004C\u0069\u0073\u0074’][‘\u0072\u0065\u006D\u006F\u0076\u0065’](“\u0068\u0069\u0064\u0064\u0065\u006E”);convertBtn[‘\u0064\u0069\u0073\u0061\u0062\u006C\u0065\u0064’]=!![];clearBtn[‘\u0064\u0069\u0073\u0061\u0062\u006C\u0065\u0064’]=!![];try{for(let i=620239^620239;i<imageFiles[‘\u006C\u0065\u006E\u0067\u0074\u0068’];i++){await generateSinglePdf(imageFiles[i]);}statusTip[‘\u0069\u006E\u006E\u0065\u0072\u0048\u0054\u004D\u004C’]=”\u003C\u0073\u0070\u0061\u006E\u0020\u0063\u006C\u0061\u0073\u0073\u003D\u0022\u0074\u0065\u0078\u0074\u002D\u0067\u0072\u0065\u0065\u006E\u002D\u0035\u0030\u0030\u0020\u006D\u0072\u002D\u0032\u0022\u003E\u2713\u003C\u002F\u0073\u0070\u0061\u006E\u003E\u0036\u0033\u0039\u63D0\u793A\u60A8\uFF0C\u6240\u6709\u0050\u0044\u0046\u751F\u6210\u5B8C\u6210\uFF01″;setTimeout(()=>{statusTip[‘\u0063\u006C\u0061\u0073\u0073\u004C\u0069\u0073\u0074’][‘\u0061\u0064\u0064’](“neddih”.split(“”).reverse().join(“”));convertBtn[‘\u0064\u0069\u0073\u0061\u0062\u006C\u0065\u0064’]=false;clearBtn[‘\u0064\u0069\u0073\u0061\u0062\u006C\u0065\u0064’]=false;},155091^162499);}catch(error){statusTip[‘\u0069\u006E\u006E\u0065\u0072\u0048\u0054\u004D\u004C’]=”\u003C\u0073\u0070\u0061\u006E\u0020\u0063\u006C\u0061\u0073\u0073\u003D\u0022\u0074\u0065\u0078\u0074\u002D\u0072\u0065\u0064\u002D\u0035\u0030\u0030\u0020\u006D\u0072\u002D\u0032\u0022\u003E\u00D7\u003C\u002F\u0073\u0070\u0061\u006E\u003E\u0020\u8F6C\u6362\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\uFF01″;setTimeout(()=>{statusTip[‘\u0063\u006C\u0061\u0073\u0073\u004C\u0069\u0073\u0074’][‘\u0061\u0064\u0064’](“\u0068\u0069\u0064\u0064\u0065\u006E”);convertBtn[‘\u0064\u0069\u0073\u0061\u0062\u006C\u0065\u0064’]=false;clearBtn[‘\u0064\u0069\u0073\u0061\u0062\u006C\u0065\u0064’]=false;},499899^501611);console[‘\u0065\u0072\u0072\u006F\u0072’](“\u8F6C\u6362\u9519\u8BEF\uFF1A”,error);}});async function generateSinglePdf(imageObj,_0xeb54e,_0x920g){const _0x197c=new jspdf[‘\u006A\u0073\u0050\u0044\u0046’]({‘\u006F\u0072\u0069\u0065\u006E\u0074\u0061\u0074\u0069\u006F\u006E’:’portrait’,’\u0075\u006E\u0069\u0074′:’mm’,”format”:”\u0061\u0034″});_0xeb54e=380359^380181;var _0x3c3eca=(462610^462613)+(809348^809344);_0x920g=810726^810959;_0x3c3eca=(752111^752109)+(543232^543235);var _0x93d=(714140^714136)+(762213^762212);const _0x2_0xdb9=new Image();_0x93d=819410^819410;_0x2_0xdb9[‘\u0073\u0072\u0063’]=imageObj[‘\u0075\u0072\u006C’];await new Promise(resolve=>{_0x2_0xdb9[‘\u006F\u006E\u006C\u006F\u0061\u0064’]=resolve;});let _0x583agc=_0x2_0xdb9[‘\u0077\u0069\u0064\u0074\u0068’];let _0x6g2fb=_0x2_0xdb9[‘\u0068\u0065\u0069\u0067\u0068\u0074’];const _0x3ea7f=Math[‘\u006D\u0069\u006E’](_0xeb54e/_0x583agc,_0x920g/_0x6g2fb);_0x583agc*=_0x3ea7f;_0x6g2fb*=_0x3ea7f;var _0x3410f=(801441^801445)+(231130^231134);const x=(_0xeb54e-_0x583agc)/(328741^328743);_0x3410f=(974124^974124)+(300639^300639);var _0x7a7c8f=(784244^784245)+(426299^426299);const y=(_0x920g-_0x6g2fb)/(162086^162084);_0x7a7c8f=(827220^827228)+(880050^880053);const _0x5gbee=imageObj[‘\u0066\u0069\u006C\u0065\u0054\u0079\u0070\u0065’]===”gnp/egami”.split(“”).reverse().join(“”)?”\u0050\u004E\u0047″:”GEPJ”.split(“”).reverse().join(“”);_0x197c[‘\u0061\u0064\u0064\u0049\u006D\u0061\u0067\u0065’](_0x2_0xdb9,_0x5gbee,x,y,_0x583agc,_0x6g2fb);const _0x7bfccg=imageObj[‘\u006F\u0072\u0069\u0067\u0069\u006E\u0061\u006C\u004E\u0061\u006D\u0065’][‘\u0073\u0075\u0062\u0073\u0074\u0072\u0069\u006E\u0067’](293307^293307,imageObj[‘\u006F\u0072\u0069\u0067\u0069\u006E\u0061\u006C\u004E\u0061\u006D\u0065’][‘\u006C\u0061\u0073\u0074\u0049\u006E\u0064\u0065\u0078\u004F\u0066’](“\u002E”))+”fdp.”.split(“”).reverse().join(“”);_0x197c[‘\u0073\u0061\u0076\u0065’](_0x7bfccg);await new Promise(resolve=>setTimeout(resolve,267757^267289));}
</script>
</body>
</html>
声明:来自浏览器与脚本,仅代表创作者观点。链接:https://eyangzhen.com/4393.html