-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28028e9
commit 9b9298a
Showing
12 changed files
with
210 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
Geekits 始终 100% 免费,如果你想支持我们的工作,你也可以向身边有需要的人推荐我们的产品,良好的用户群体将促进我们的完善;或者,提出你的宝贵意见,帮助我们改进产品。 | ||
|
||
欲了解更多关于 Geekits 的信息,请访问 [Geekits 用户手册](https://www.ygeeker.com/support/geekits/intro)。 | ||
|
||
也欢迎你加入我们的社区,和大家一起交流,讨论,分享。或前往 YGeeker 官网探索我们创造的更多精彩内容。 | ||
|
||
- 官网: [www.ygeeker.com](https://www.ygeeker.com) | ||
- QQ 群: [923724755](https://i.ibb.co/BGfwRcX/image.png) | ||
- 小红书: [@RiverTwilight](https://www.xiaohongshu.com/user/profile/608e28ee000000000100bc65?xhsshare=CopyLink&appuid=608e28ee000000000100bc65&apptime=1712575215) | ||
- 小红书: [@RiverTwilight](https://www.xiaohongshu.com/user/profile/608e28ee000000000100bc65) | ||
|
||
如果你想将你的产品展示在首页,请前往这个 [Issue](https://github.com/RiverTwilight/Geekits/issues/64) 提交友链。 | ||
|
||
#### 相关资源 | ||
|
||
- [三年生生不息:开发云极客工具,我学到了什么?](https://mp.weixin.qq.com/s/cRvj5nGNKLeZMt12CrUuTg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
name: "PDF Merge" | ||
status: "beta" | ||
icon: "/api/icon?iconColor=fff&iconName=PictureAsPdf&backgroundColor1=888" | ||
channel: media | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
name: "PDF 合并" | ||
status: "beta" | ||
icon: "/api/icon?iconColor=fff&iconName=PictureAsPdf&backgroundColor1=888" | ||
channel: media | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import React, { useState } from "react"; | ||
import { PDFDocument } from "pdf-lib"; | ||
import { | ||
Box, | ||
Button, | ||
List, | ||
ListItem, | ||
ListItemText, | ||
IconButton, | ||
Typography, | ||
Paper, | ||
} from "@mui/material"; | ||
import { | ||
Delete as DeleteIcon, | ||
ArrowUpward as ArrowUpwardIcon, | ||
ArrowDownward as ArrowDownwardIcon, | ||
Merge as MergeIcon, | ||
Upload as UploadIcon, | ||
} from "@mui/icons-material"; | ||
import FilePicker from "@/components/FilePicker"; | ||
import { saveFile } from "@/utils/fileSaver"; | ||
|
||
const PdfMerger: React.FC = () => { | ||
const [pdfFiles, setPdfFiles] = useState<File[]>([]); | ||
|
||
const handleFileUpload = (file: File) => { | ||
setPdfFiles((prevFiles) => [...prevFiles, file]); | ||
}; | ||
|
||
const handleRemoveFile = (index: number) => { | ||
setPdfFiles((prevFiles) => prevFiles.filter((_, i) => i !== index)); | ||
}; | ||
|
||
const handleMoveFile = (index: number, direction: "up" | "down") => { | ||
setPdfFiles((prevFiles) => { | ||
const newFiles = [...prevFiles]; | ||
const newIndex = direction === "up" ? index - 1 : index + 1; | ||
[newFiles[index], newFiles[newIndex]] = [ | ||
newFiles[newIndex], | ||
newFiles[index], | ||
]; | ||
return newFiles; | ||
}); | ||
}; | ||
|
||
const handleMergePDFs = async () => { | ||
const mergedPdf = await PDFDocument.create(); | ||
|
||
for (const file of pdfFiles) { | ||
const pdfBytes = await file.arrayBuffer(); | ||
const pdf = await PDFDocument.load(pdfBytes); | ||
const copiedPages = await mergedPdf.copyPages( | ||
pdf, | ||
pdf.getPageIndices() | ||
); | ||
copiedPages.forEach((page) => mergedPdf.addPage(page)); | ||
} | ||
|
||
const pdfBytes = await mergedPdf.save(); | ||
const blob = new Blob([pdfBytes], { type: "application/pdf" }); | ||
saveFile({ file: blob, filename: "merged.pdf", type: "pdf" }); | ||
}; | ||
|
||
return ( | ||
<Box sx={{ maxWidth: 600, margin: "auto", p: 3 }}> | ||
<Typography variant="h4" gutterBottom> | ||
PDF Merger | ||
</Typography> | ||
<Paper elevation={3} sx={{ p: 2, mb: 2 }}> | ||
<FilePicker | ||
enableDrag={true} | ||
fileType="application/pdf" | ||
handleFileUpload={handleFileUpload} | ||
customButton={ | ||
<Button variant="contained" startIcon={<UploadIcon />}> | ||
Add PDF | ||
</Button> | ||
} | ||
/> | ||
</Paper> | ||
<List> | ||
{pdfFiles.map((file, index) => ( | ||
<ListItem | ||
key={index} | ||
secondaryAction={ | ||
<Box> | ||
<IconButton | ||
edge="end" | ||
aria-label="move up" | ||
onClick={() => handleMoveFile(index, "up")} | ||
disabled={index === 0} | ||
> | ||
<ArrowUpwardIcon /> | ||
</IconButton> | ||
<IconButton | ||
edge="end" | ||
aria-label="move down" | ||
onClick={() => | ||
handleMoveFile(index, "down") | ||
} | ||
disabled={index === pdfFiles.length - 1} | ||
> | ||
<ArrowDownwardIcon /> | ||
</IconButton> | ||
<IconButton | ||
edge="end" | ||
aria-label="delete" | ||
onClick={() => handleRemoveFile(index)} | ||
> | ||
<DeleteIcon /> | ||
</IconButton> | ||
</Box> | ||
} | ||
> | ||
<ListItemText primary={file.name} /> | ||
</ListItem> | ||
))} | ||
</List> | ||
<Box sx={{ mt: 2, display: "flex", justifyContent: "center" }}> | ||
<Button | ||
variant="contained" | ||
color="primary" | ||
startIcon={<MergeIcon />} | ||
onClick={handleMergePDFs} | ||
disabled={pdfFiles.length < 2} | ||
> | ||
Merge PDFs | ||
</Button> | ||
</Box> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default PdfMerger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"zh-CN":{"homePage.meta.description":"轻盈好用的在线工具,无需下载即可免费使用 30+ 工具,解决生活学习工作中的大小问题","homePage.meta.title":"首页","homePage.appSection.Media":"图片视频","homePage.searchBarAriaLabel":"在此键入以搜索","homePage.searchBarPlaceholder":"搜索(Ctrl+F)","navbar.home":"首页","navbar.donation":"免费捐赠","navbar.about":"关于","navbar.settings":"设置","navbar.downloadApp.tooltip":"Geekits APP 带来更快的速度,离线使用,以及更好的体验","navbar.downloadApp.label":"试试 Geekits APP","navbar.feedback":"反馈","navbar.copyright.subtitle":"Geekits 完全开源和免费","navbar.copyright.title":"YGeeker 出品","navbar.log":"更新日志","channel.life":"生活常用","channel.ai":"人工智能","channel.image":"图片视频","channel.developer":"编程开发","channel.external":"第三方APP","channel.wip":"开发中","appMenu.github":"在 GitHub 上编辑","appMenu.bookmark":"收藏","appMenu.bookmark.undo":"移除收藏","settings.language.title":"语言","settings.language.auto":"跟随系统","settings.language.zh_cn":"简体中文","settings.language.en_us":"English","donation.paid.title":"付费方式","feedback.send":"提交","feedback.hero":"我们会阅读每一条反馈","feedback.subtitle":"你可以畅所欲言","feedback.debug":"发送错误日志","feedback.content.placeholder":"输入内容","feedback.contact.placeholder":"适合我们联系你的方式","general.chooseFile":"选择文件","general.confirm":"确认","general.save":"保存","general.download":"下载","qrcode.basic.title":"基本","qrcode.basic.placeholder":"链接或文本","qrcode.basic.type":"类型","qrcode.basic.wifi":"WI-FI","qrcode.basic.text":"文本","qrcode.advanced.title":"高级","qrcode.advanced.icon":"图标","qrcode.advanced.light":"亮色","qrcode.advanced.dark":"暗色","aboutPage.meta.title":"关于","app.decision.addOption":"添加选项","app.decision.savePreset":"保存预设","app.decision.currentOption":"当前备选项","app.roman.inputHint":"输入整数","app.urlcleaner.confirmBtn":"净化","app.urlcleaner.ruleTitle":"规则"},"en-US":{"homePage.meta.description":"Your all-in-one digital toolkit. 30+ free tools including AI chat, calculators, converters, and creative utilities. Solve daily challenges effortlessly.","homePage.meta.title":"Home","homePage.appSection.Media":"Media","homePage.searchBarAriaLabel":"Type to Search","homePage.searchBarPlaceholder":"Search (Ctrl+F)","navbar.home":"Home","navbar.donation":"Free Donation","navbar.about":"About","navbar.settings":"Settings","navbar.downloadApp.tooltip":"Geekits app allows faster access, offline use, and more.","navbar.downloadApp.label":"Try Geekits App","navbar.feedback":"Feedback","navbar.copyright.subtitle":"Geekits is 100% open source and free","navbar.copyright.title":"Created by YGeeker","navbar.log":"What’s New","channel.life":"Lifestyle","channel.ai":"AI","channel.image":"Media Process","channel.developer":"Developer","channel.external":"External App","channel.wip":"WIP","appMenu.github":"Edit on GitHub","appMenu.bookmark":"Bookmark","appMenu.bookmark.undo":"Remove Bookmark","settings.language.title":"Language","settings.language.auto":"Auto","settings.language.zh_cn":"简体中文","settings.language.en_us":"English","donation.paid.title":"Paid Option","feedback.send":"Submit","feedback.hero":"We Read Every Feedback","feedback.subtitle":"New app request, bug report, or anything you want to tell us.","feedback.debug":"Send Error Log","feedback.content.placeholder":"Write something you want to tell us","feedback.contact.placeholder":"How can we contact you?","general.chooseFile":"Choose File","general.confirm":"Confirm","general.save":"Save","general.download":"Download","qrcode.basic.title":"Basic","qrcode.basic.placeholder":"URL or Text","qrcode.basic.type":"Type","qrcode.basic.wifi":"WI-FI","qrcode.basic.text":"Text","qrcode.advanced.title":"Advanced","qrcode.advanced.icon":"Icon","qrcode.advanced.light":"Light Color","qrcode.advanced.dark":"Dark Color","aboutPage.meta.title":"About","app.decision.addOption":"Add Option","app.decision.savePreset":"Save Preset","app.decision.currentOption":"Current Options","app.roman.inputHint":"Input integer","app.urlcleaner.confirmBtn":"Clean URL","app.urlcleaner.ruleTitle":"Rules"},"zh-HK":{"homePage.searchBarPlaceholder":"搜寻"}} | ||
{"zh-CN":{"homePage.meta.description":"轻盈好用的在线工具,无需下载即可免费使用 30+ 工具,解决生活学习工作中的大小问题","homePage.meta.title":"首页","homePage.appSection.Media":"图片视频","homePage.searchBarAriaLabel":"在此键入以搜索","homePage.searchBarPlaceholder":"搜索(Ctrl+F)","navbar.home":"首页","navbar.donation":"免费捐赠","navbar.about":"关于","navbar.settings":"设置","navbar.downloadApp.tooltip":"Geekits APP 带来更快的速度,离线使用,以及更好的体验","navbar.downloadApp.label":"试试 Geekits APP","navbar.feedback":"反馈","navbar.copyright.subtitle":"Geekits 完全开源和免费","navbar.copyright.title":"YGeeker 出品","navbar.log":"更新日志","channel.life":"生活常用","channel.ai":"人工智能","channel.image":"图片视频","channel.developer":"编程开发","channel.external":"第三方APP","channel.wip":"开发中","appMenu.github":"在 GitHub 上编辑","appMenu.bookmark":"收藏","appMenu.bookmark.undo":"移除收藏","settings.language.title":"语言","settings.language.auto":"跟随系统","settings.language.zh_cn":"简体中文","settings.language.en_us":"English","donation.paid.title":"付费方式","feedback.send":"提交","feedback.hero":"我们会阅读每一条反馈","feedback.subtitle":"你可以畅所欲言","feedback.debug":"发送错误日志","feedback.content.placeholder":"输入内容","feedback.contact.placeholder":"适合我们联系你的方式","general.chooseFile":"选择文件","general.confirm":"确认","general.save":"保存","general.download":"下载","qrcode.basic.title":"基本","qrcode.basic.placeholder":"链接或文本","qrcode.basic.type":"类型","qrcode.basic.wifi":"WI-FI","qrcode.basic.text":"文本","qrcode.advanced.title":"高级","qrcode.advanced.icon":"图标","qrcode.advanced.light":"亮色","qrcode.advanced.dark":"暗色","aboutPage.meta.title":"关于","app.decision.addOption":"添加选项","app.decision.savePreset":"保存预设","app.decision.currentOption":"当前备选项","app.roman.inputHint":"输入整数","app.urlcleaner.confirmBtn":"净化","app.urlcleaner.ruleTitle":"规则"},"en-US":{"homePage.meta.description":"Your all-in-one digital toolkit. 30+ free tools including AI chat, calculators, converters, and creative utilities. Solve daily challenges effortlessly.","homePage.meta.title":"Home","homePage.appSection.Media":"Media","homePage.searchBarAriaLabel":"Type to Search","homePage.searchBarPlaceholder":"Search (Ctrl+F)","navbar.home":"Home","navbar.donation":"Donation","navbar.about":"About","navbar.settings":"Settings","navbar.downloadApp.tooltip":"Geekits app allows faster access, offline use, and more.","navbar.downloadApp.label":"Try Geekits App","navbar.feedback":"Feedback","navbar.copyright.subtitle":"Geekits is 100% open source and free","navbar.copyright.title":"Created by YGeeker","navbar.log":"What’s New","channel.life":"Lifestyle","channel.ai":"AI","channel.image":"Media Process","channel.developer":"Developer","channel.external":"External App","channel.wip":"WIP","appMenu.github":"Edit on GitHub","appMenu.bookmark":"Bookmark","appMenu.bookmark.undo":"Remove Bookmark","settings.language.title":"Language","settings.language.auto":"Auto","settings.language.zh_cn":"简体中文","settings.language.en_us":"English","donation.paid.title":"Paid Option","feedback.send":"Submit","feedback.hero":"We Read Every Feedback","feedback.subtitle":"New app request, bug report, or anything you want to tell us.","feedback.debug":"Send Error Log","feedback.content.placeholder":"Write something you want to tell us","feedback.contact.placeholder":"How can we contact you?","general.chooseFile":"Choose File","general.confirm":"Confirm","general.save":"Save","general.download":"Download","qrcode.basic.title":"Basic","qrcode.basic.placeholder":"URL or Text","qrcode.basic.type":"Type","qrcode.basic.wifi":"WI-FI","qrcode.basic.text":"Text","qrcode.advanced.title":"Advanced","qrcode.advanced.icon":"Icon","qrcode.advanced.light":"Light Color","qrcode.advanced.dark":"Dark Color","aboutPage.meta.title":"About","app.decision.addOption":"Add Option","app.decision.savePreset":"Save Preset","app.decision.currentOption":"Current Options","app.roman.inputHint":"Input integer","app.urlcleaner.confirmBtn":"Clean URL","app.urlcleaner.ruleTitle":"Rules"},"zh-HK":{"homePage.searchBarPlaceholder":"搜寻"}} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters