PngToPdf 1.0.0

dotnet tool install --global PngToPdf --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local PngToPdf --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=PngToPdf&version=1.0.0
                    
nuke :add-package PngToPdf --version 1.0.0
                    

PngToPdf

一个将PNG和其他图片格式转换为PDF的命令行工具。

功能特点

  • 支持多种图片格式(PNG、JPG、JPEG、BMP、GIF、TIFF)
  • 支持处理单个文件、多个文件或整个文件夹
  • 可以选择保持原始图片尺寸或适应页面尺寸
  • 提供清晰的命令行帮助信息
  • 可以作为全局工具安装,随时随地使用

安装

dotnet tool install --global PngToPdf

使用方法

pngtopdf -i <图片路径或文件夹> -o <输出PDF路径> [-k <是否保持原始尺寸>]

示例

# 将单个图片转换为PDF
pngtopdf -i image.png -o output.pdf

# 将多个图片转换为PDF
pngtopdf -i image1.png image2.jpg -o output.pdf

# 将文件夹中的所有图片转换为PDF
pngtopdf -i C:\Images\ -o output.pdf

# 不保持原始图片尺寸(适应页面)
pngtopdf -i image.png -o output.pdf -k false

参数说明

  • -i, --input <paths>: 输入图片路径,可以是单个文件、多个文件或文件夹
  • -o, --output <path>: 输出PDF文件路径
  • -k, --keep-size <bool>: 保持原始图片尺寸(默认: true)
  • -h, --help: 显示帮助信息

系统要求

  • .NET 9.0 或更高版本
  • Windows 操作系统(由于使用了System.Drawing.Common)

许可证

MIT

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.0.0 115 8/3/2025 1.0.0 is deprecated because it has critical bugs.