Notebook

これは日々の作業を通して学んだことや毎日の生活で気づいたことをを記録しておく備忘録である。

HTML ファイル生成日時: 2025/01/08 21:34:38.759 (台灣標準時)

PDF ファイルの一部だけを取り出す方法

PDF ファイルの一部だけを取り出すには、 pdfjam や pdfcrop というコマン ドを利用すればよいようでござる。 pkgsrc では、 pdfjam は print/pdfjam を、 pdfcrop は graphics/tex-pdfcrop をインストールすることで利用でき るようになるようでござる。

pdfjam は以下のように使えばよいようでござる。


% wget https://texwiki.texjp.org/files/tiger.pdf--2025-01-08 11:55:26--  https://texwiki.texjp.org/files/tiger.pdf
Resolving texwiki.texjp.org (texwiki.texjp.org)... 133.130.98.34
Connecting to texwiki.texjp.org (texwiki.texjp.org)|133.130.98.34|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 41391 (40K) [application/pdf]
Saving to: ‘tiger.pdf’

tiger.pdf           100%[===================>]  40.42K  --.-KB/s    in 0.001s  

2025-01-08 11:55:26 (32.0 MB/s) - ‘tiger.pdf’ saved [41391/41391]
% pdfjam --trim '2.0cm 3.0cm 4.0cm 5.0cm' --clip true --outfile tiger_trimmed.pdf tiger.pdf
trap: '9' cannot be caught
trap: '9' cannot be caught
          ----
  pdfjam: This is pdfjam version 2.08.
  pdfjam: Reading any site-wide or user-specific defaults...
          (none found)
  pdfjam: Effective call for this run of pdfjam:
          /usr/pkg/bin/pdfjam --trim '2.0cm 3.0cm 4.0cm 5.0cm' --clip 'true' --outfile tiger_trimmed.pdf -- tiger.pdf - 
  pdfjam: Calling pdflatex...
  pdfjam: Finished.  Output was to 'tiger_trimmed.pdf'.

trim オプションに与える四つの数字は切り取る領域の範囲で、それぞれ左、 下、右、上から切り捨てる幅の長さを与えるようでござる。


     --KEY VALUE
                  Specify options to '\includepdfmerge', in the LaTeX
                  'pdfpages' package.  Here KEY is the name of any of the
                  many options for '\includepdfmerge', and VALUE is a
                  corresponding value.  Examples are
                      --nup 2x1     (for 2-up side-by-side imposition)
                      --scale 0.7   (to scale all input pages to 70% size)
                      --offset '1cm 0.5cm'
                                    (to offset all pages -- note the quotes!)
                      --frame true  (to put a frame round each input page)
                      --trim '1cm 2cm 1cm 2cm' --clip true
                                    (to trim those amounts from left, bottom,
                                     right and top, respectively, of input 
                                     pages) 
                  etc., etc.  For more information see the manual for
                  the 'pdfpages' package, at
                  http://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages
* '--' can be used to signal that there are no more options to come.



Frequently accessed files

  1. Computer___Python/20220518_0.html
  2. Computer___Network/20230726_00.html
  3. Misc___Taiwan/20240207_00.html
  4. Computer___Network/20230516_00.html
  5. Computer___FreeBSD/20220621_0.html
  6. Computer___Python/20220715_0.html
  7. Computer___Network/20230508_00.html
  8. Food___Taiwan/20220429_0.html
  9. Computer___Network/20240130_00.html
  10. Computer___Network/20240416_00.html
  11. Computer___Python/20220410_0.html
  12. Computer___NetBSD/20220817_3.html
  13. Computer___NetBSD/20230119_00.html
  14. Computer___Python/20221013_0.html
  15. Computer___Debian/20210223_1.html
  16. Computer___Python/20210124_0.html
  17. Computer___NetBSD/20220428_0.html
  18. Computer___NetBSD/20220818_1.html
  19. Computer___NetBSD/20240101_02.html
  20. Computer___Python/20240101_00.html
  21. Science___Math/20220420_0.html
  22. Computer___TeX/20231107_00.html
  23. Computer___Network/20220413_1.html
  24. Computer___NetBSD/20220808_0.html
  25. Computer___TeX/20230503_00.html
  26. Science___Astronomy/20220503_0.html
  27. Computer___NetBSD/20230515_00.html
  28. Computer___NetBSD/20210127_0.html
  29. Computer___Python/20220816_1.html
  30. Computer___Python/20230717_01.html


HTML file generated by Kinoshita Daisuke.