图片批量下载加转pdf

图片批量下载

需要安装curl 和 magick 工具
curl 一般电脑都是自带的,用于批量下载图片
magick工具,用于合并pdf文档,安装 :
首先,确保你已经安装了 ImageMagick,并且其 magick 命令在你的命令行可用。你可以从 ImageMagick 官方网站 下载并安装。

执行示例:
get.bat 33 诱骗态BB84量子密钥分配产品检测规范 https://hbba.sacinfo.org.cn/hbba_onlineRead_page/c70f8def4f4d93e816c0110a46135725063b5022cb598cb3a0cd1e83892dc8b8/

代码如下

@echo off

REM Check if required arguments are provided
if "%1" == "" goto :USAGE
if "%2" == "" goto :USAGE
if "%3" == "" goto :USAGE

set end=%1
set destination_folder=%2
set url=%3

REM Create the destination folder if it doesn't exist
mkdir "%destination_folder%" 2>nul

REM Download the files
for /l %%i in (0, 1, %end%) do (
    curl "%url%/%%i.png" -o "%destination_folder%\temp.png"
    setlocal enabledelayedexpansion
    set "file_index=000%%i"
    set "file_index=!file_index:~-3!"
    ren "%destination_folder%\temp.png" "!file_index!.png"
    endlocal
)

REM Convert images to PDF using ImageMagick
magick convert "%destination_folder%\*.png" "%destination_folder%.pdf"

goto :END

:USAGE
echo Usage: %0 ^<end^> ^<destination_folder^> ^<url^>
echo Example: %0 20 量子保密通信网络架构 "https://hbba.sacinfo.org.cn/hbba_onlineRead_page/405a2747ea434bc6a46bd3445194cfecc222d2159a8a2c2b907abfb259bc6d27/"
exit /b 1

:END


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值