ajaxray / ajaxray/merge2pdf

Improved page selection

未关闭
#2 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement good first issue
主要语言
Go
星标
89
派生
18
PR 合并指标
30 天内没有已合并 PR

描述

### The Problem
Currently, this library supports the following format for specifying page numbers of input PDF document:

input-pdf-name.pdf~<page-number>[,<page-number>]*
That means comma-separated page numbers after the file name joined with a `~`. For example -
```
merge2pdf output.pdf input1.pdf~1 input2.pdf input3.pdf~2,3,4
```
This will merge 1st page of input1.pdf, full input2.pdf and 2nd, 3rd, 4th page of input3.pdf.

So we have to mention every page number specifically. It's fine when the command is being executed from an application. But this is not an easy option in case of running the command manually, especially when we have a large number of pages.

### Proposal for improvement

To make it easy to provide page numbers, we can add support for the following formats to specify input pages.

1. Fixed range of inclusive sequence numbers separated with `-`.
Example: `2-7` will mean 2nd to 7th pages
2. Open-ended range. To indicate the last page, `$` will be used as the anchor character.
Example: `4-$` will mean 4th page to last page
3. Combining page number formats. All supported formats (including current one) can be used combinedly
Example: `1,2,5-7,11-$` will include 1,2,5,6,7 and 11 to last page

Notes:
1. The current page number format is parsed in [this function](https://github.com/ajaxray/merge2pdf/blob/81562d54b705d8f5e76c95de3198bc4c630510fd/source.go#L107).
2. Based on #1 by @JohnnyMclain12

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。