如何告诉转换命令跳过pdf中的一页?

如何告诉转换命令跳过pdf中的一页?

我想拆分 PDF 页面,因为它当时扫描了两页,我发现这很有用命令:

convert in.pdf -crop 50%x0 +repage -density 400 out.pdf

但现在我希望此命令跳过拆分某些页面并按原样在最终重新分页结果中使用它们。

有什么命令或方法可以做到这一点吗?

答案1

  1. 我希望您设置-density正确,以便在重新光栅化过程中不会降低图像质量。不过,我认为-density 400应该先来pdf.in才能见效。

  2. 我希望您的走廊扫描仪的 pdf 文件是安全的,特别是它不是内部的 Postscript 文件。我还希望您有一个安全版本GS(IM 调用它进行 pdf/ps/... 转换。)关联, 关联。 ( gs --version≥9.24)

  3. 无论如何,关于前两点,对于扫描仪生成的pdf文件我会推荐通过程序启动pdfimages提取扫描的页面。就像是

   pdfimages -list in.pdf        # show info

   rm temporary*                 # remove temporary files
   rm DOcrop*                    # remove our option files

   pdfimages -all in.pdf temporary    # -all for natural (original) format    
  
   # make your choices; can be done manually by  touch  program
   for x in termporary*; do
        gopen "$x"            # view the file
        echo "File $x: <Enter> for crop, <Ctrl-D> for keep"
        read  &&    touch DOcrop-"$x"
   done
   for x in termporary*; do
        [ -e DOcrop-"$x" ] && mogrify -crop 50%x0 +repage "$x"
   done

   convert temporary*  out.pdf      # some options?
  1. 您可以convert pdf.in[0-1,7] ...仅使用指定的页面。参见 7。

  2. 您可以使用pdftkqpdf、等工具pdfselect+pdfunify来选择和/或重新组织页面

  3. 对于带有矢量图形或文本的 pdf(不适合扫描的页面),可以使用pdfcropTeX

  4. convert可以有很长的命令行。看来你需要使用堆栈操作如果你这样做,就像convert in.pdf[0-9] \( in.pdf[10] -crop ... \) ... 使前十页不变,而第十一页被裁剪。如果没有\( \),裁剪操作将应用于所有前面的页面。

  5. IM和GM有脚本工具,我不知道。

相关内容