KTUGFaq

KTUG FAQ

α:
йȣ:
Emacs Makes All Computing Simple
媛„寃⑸„;FrontPage&value=/FrontPage占쏙옙占쏙옙LayOut&value=LayOut/TitleIndexKC2008/KCmenu&value=/FrontPageOmega-CJK&value=NewEnviron › PDFManipulation
PDF ϰų ϴ AdobeAcrobat ̿ϴ Ϲ̴. ׷ α׷ α׷̴. AdobeAcrobat ̿ ʰ PDF ϴ ƺ.

1 PDF ȯ
1.1 n-up
1.2 Merge
1.3 PDF ʾ ġ
2 PDF Cropping
2.1 pdfcrop.pl
2.2 PDFTeX ۼϴ
2.3
3 PDF Select ()
3.1 ConTeXt texexec ϴ
3.1.1 Ϻ
3.1.2 ϴ Shell ũƮ
3.2 PDFPages ̿ϴ
3.2.1 Ϻ
3.2.2 ϴ Shell Script
3.3 pdftk ϴ
3.3.1 Ϻ
3.3.2 徿 ҷ
3.3.3 PDF ϳ
4 Booklet
5 PDF
6 PDFJam
7 ׹ ƿƼ

[]

1 PDF ȯ

[]

1.1 n-up

PDF ʾ  μϴ . PDFPages Ű ̿Ѵ. KTUGOperate:4615

ֺ ؼ 迭ϴ , 1x2 up 츦 д. PDF testin.pdf , testout.tex ۼѴ.
\documentclass[a4paper]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-,nup=1x2,landscape,frame=false]{testin.pdf}
\end{document}

PDFLaTeX Ѵ.
#> pdflatex testout

pdfpages.sty ϴ \includepdf ̿ϴµ, ʸ ̸ .
\includepdf[nup=1x2,landscape,pages=4-7]{foo.pdf}
\includepdf[nup=1x2,landscape,pages=4-7,turn=false]{foo.pdf}
\includepdf[nup=2x2,pages=1-4,column]{foo.pdf}

¦ʺ ϴ ϱ Ͽ ó
\includepdf[nup=2x2,pages={{},5-7}]{foo.pdf}

nup
\includepdf[nup=2x2,pages=1-4,frame]{foo.pdf}

Ϻθ trimν header footer ϰ ʹٸ
\includepdf[nup=2x2,pages=1-4,
            trim= 0 40mm 0 40mm,
            clip]{foo.pdf}

nup ȣ ̰ ʹٸ
\includepdf[nup=2x2,pages=1-4,pagecommand={\thispagestyle{plain}}]{foo.pdf}

[]

1.2 Merge

See PDFMerge.

[]

1.3 PDF ʾ ġ

PDF Ͽ ļ ϳ PDF ǵ ϴ from KTUGOperate:4663 (by Karnes)

˰ ִٰ Դϴ. ؼ a.pdf b.pdf , PDF 10̶ ϰڽϴ.

total.tex ۼմϴ.
\documentclass{article}
\usepackage{pdfpages}
\makeatletter
\def\for#1#2#3{\@ifnextchar[{\@for@{#1}{#2}{#3}}{\@for@{#1}{#2}{#3}[1]}}
\long\def\@for@#1#2#3[#4]#5{\setcounter{#1}{#3}\addtocounter{#1}{1}%
        \edef\for@loopend{\arabic{#1}}%
        \setcounter{#1}{#2}%
        \loop
        \ifnum \expandafter\the\csname c@#1\endcsname < \for@loopend\relax
        #5\addtocounter{#1}{#4}\repeat}
\newcounter{repeatcnt}
\makeatother

\begin{document}
\for{repeatcnt}{1}{10}{%
        \includepdfmerge{a.pdf,\therepeatcnt,b.pdf,\therepeatcnt}
}
\end{document}

pdflatex total.tex ϸ total.pdf ֽϴ. Ű澲ð, \includepdfmerge ȿ ڰ ޸ иǾ ִٴ Ͻø Դϴ. for Loop ϴ ϴ.

[]

2 PDF Cropping

PS PS2Eps Bounding Box ݴϴ. PDF Bounding Box /MediaBox ڷ PS Bounding Box ȿ ϴ. PDF Bounding Box Ȯϰ ˰ ebb غϴ.

MediaBox ߸Ǿ ̸ ϰų, ū PDF ߶󳻴 Դϴ.

[]

2.1 pdfcrop.pl

Heiko Oberdiek ۼ Perl ũƮԴϴ. pdfcrop.pl --help ȭԴϴ.
PDFCROP 1.2, 2002/11/04 - Copyright (c) 2002 by Heiko Oberdiek.
Syntax:   pdfcrop [options] <input[.pdf]> [output file]
Function: Margins are calculated and removed for each page in the file.
Options:                                                    (defaults:)
  --help              print usage
  --(no)verbose       verbose printing                      (false)
  --(no)debug         debug informations                    (false)
  --gscmd _name_      call of ghostscript                   (gswin32c)
  --pdftexcmd _name_  call of pdfTeX                        (pdftex)
  --margins "left top right bottom"                 (0 0 0 0)
                      add extra margins, unit is bp. If only one number is
                      given, then it is used for all margins, in the case
                      of two numbers they are also used for right and bottom.
  --(no)clip          clipping support, if margins are set  (false)
  --(no)hires         using '%%HiResBoundingBox'            (false)
                      instead of '%%BoundingBox'
Examples:
  pdfcrop.pl --margins 10 input.pdf output.pdf
  pdfcrop.pl --margins '5 10 5 20' --clip input.pdf output.pdf

windows TeX Live 2010 pdfcrop.pl pdfcrop ̶ θ ˴ϴ.

[]

2.2 PDFTeX ۼϴ

from KTUGOperate:4284 (by ̰) ƿƼ PDF ȯ , AdobeIllustrator ѱ Font Ͽ PDF Ϻΰ Ghostscript о ֽϴ. ̷ , .tex ۼϿ PDFTeX ϸ PDF ϴ ũ⸸ŭ ߶ ֽϴ. ainput.pdf ,
\def\pdffile{ainput.pdf}                % <-- file ̸ 
\def\page #1 [#2 #3 #4 #5]{%
  \count0=#1\relax
  \setbox0=\hbox{%
    \pdfximage page #1{\pdffile}%
    \pdfrefximage\pdflastximage
  }%
  \pdfhorigin=-#2bp\relax
  \pdfvorigin=#3bp\relax
  \pdfpagewidth=#4bp\relax
  \advance\pdfpagewidth by -#2bp\relax
  \pdfpageheight=#5bp\relax
  \advance\pdfpageheight by -#3bp\relax
  \ht0=\pdfpageheight
  \shipout\box0\relax
}
\page 1 [40 290 552 552]             % <-- ȣ  BoundingBox 
\end
aoutput.tex ϰ մϴ.
#> pdftex aoutput

[]

2.3

DVIPDFMx ̿Ͽ PDF ϴ. ( Uploads:pdfcroptestinput.pdf )
#> perl pdfcrop.pl --clip pdfcroptestinput.pdf pdfcroptestoutput.pdf
PDF ϴ. Uploads:pdfcroptestoutput.pdf

[]

3 PDF Select ()

[]

3.1 ConTeXt texexec ϴ

[]

3.1.1 Ϻ

cf. KTUGOperate:7332 (by DohyunKim)

Ϸ texexec --pdfselect . orig.pdf 1 test1.pdf Ѵ.
#> texexec --pdfselect --selection=1 --batch --result=test1.pdf orig.pdf

, 1 10 PDF Ϸ , Perl ̿Ͽ,
for(1..10) {
  system("texexec --pdfselect --selection=$_ --batch --result=test$_.pdf orig.pdf");
}

[]

3.1.2 ϴ Shell ũƮ

texexec ϴ Shell Script .(Claus Gerhardt )

#!/bin/sh
##
# pdfsel.sh
# pdfselect
#
# $1= selected pages either in form of a list x,y,z or in form of range x:y or as odd #resp. even
#filenename without suffix pdf, the resulting file is named filename-ext.pdf
# Claus Gerhardt
##


# EXTENSIONS : "*"
# OSTYPES    : "****"

for file; do
location=$(dirname "$file")
cd "${location}" && \
texexec --pdfselect --batch --silent --selection="$1" --result="${file}-ext.pdf" "${file}.pdf" \
&& rm -f "${file}-ext.tui" && rm -f "${file}-ext.tmp" && rm -f "texexec.tex" \
&& rm -f "texexec.tmp" && rm -f "texexec.tui" && rm -f "mprun.mp" rm -f "mpgraph.mp" \
&& rm -f "${file}-ext.log"
done

[]

3.2 PDFPages ̿ϴ

[]

3.2.1 Ϻ

KTUGOperate:7342 (by ̰)

1 10 ϴ .

#!/usr/bin/perl

for(1..10) {
open(OUT,">test$_.tex") or die "Cannot write 'test$_.tex'";
print OUT << "EOF";
\\documentclass[a4paper]{article}
\\usepackage{pdfpages}
\\begin{document}
\\includepdf[pages=$_]{orig.pdf}
\\end{document}
EOF
close OUT;
system("pdflatex --interaction batchmode test$_");
unlink "test$_.tex","test$_.log","test$_.aux";
}

[]

3.2.2 ϴ Shell Script

pdfsel.sh
#!/bin/sh

PAGENUM=$1
OUTFILE=$2-ext-$1.tex

echo '\documentclass{article}' > $OUTFILE
echo '\usepackage{pdfpages}' >> $OUTFILE
echo '\begin{document}' >> $OUTFILE
echo '\includepdf[pages='$PAGENUM']{'$2'.pdf}' >> $OUTFILE
echo '\end{document}' >> $OUTFILE
pdflatex --interaction=batchmode $OUTFILE

#> sh pdfsel.sh 13 test
(Է Ȯ .pdf . ù° ڴ Ϸ , ι° ڴ Է. test-ext-13.pdf .)

DOS Batchfile.
@echo off
rem pdfsel.bat
echo \documentclass{article} > %2-ext-%1.tex
echo \usepackage[pdftex]{graphicx} >> %2-ext-%1.tex
echo \usepackage{pdfpages} >> %2-ext-%1.tex
echo \begin{document} >> %2-ext-%1.tex
echo \includepdf[pages=%1]{%2.pdf} >> %2-ext-%1.tex
echo \end{document} >> %2-ext-%1.tex
pdflatex --interaction=batchmode %2-ext-%1
del %2-ext-%1.aux
rem del %2-ext-%1.log
del %2-ext-%1.tex

(!) pdfsel.bat ̿Ͽ Windows , 1 10 ϳ PDF test.pdf ϴ .
#> for /L %i IN (1,1,10) DO call pdfsel.bat %i test


[]

3.3 pdftk ϴ

PDFtk http://www.accesspdf.com/pdftk/ freewareε ϴ ⸻ PDF Merge, ȣȭ پ ɵ Ѵ.

[]

3.3.1 Ϻ

Dz 1ʿ 12ʱ ׸ 14ʺ ϴ ̴.
pdftk A=in.pdf cat A1-12 A14-end output out.pdf
/(ѱ ϳ?) ϴ.
pdftk A=in1.pdf B=in2.pdf cat B1 A1-7even A1-7odd output out1.pdf

[]

3.3.2 徿 ҷ

ɾ ϸ ȴ.
pdftk input.pdf burst

[]

3.3.3 PDF ϳ

ɾ ϸ ȴ. in1.pdf, in2.pdf out1.pdf
pdftk in1.pdf in2.pdf cat output out1.pdf
or 
pdftk A=in1.pdf B=in2.pdf cat A B output out1.pdf
*.pdf out1.pdf
pdftk *.pdf cat output out1.pdf
  • ó : pdftk --help message
[]

4 Booklet

PDF Booklet̶ ʿ  μϿ μ  öϸ åڰ ǵ ϴ ̴. PDFPages Ű, \includepdf signature ɼ ̿Ѵ. , signature 4 ǵ ϴ ̴. 11 ¥ PDF ϳ ְ, ̰ åڸ 츦 غ. ̸ doc.pdf ϰ, aout.tex ۼѴ.
%%-----------
\documentclass{article}
\usepackage[pdftex]{graphicx}
\usepackage{pdfpages}

\begin{document}
\pagestyle{empty}
\includepdf[pages=-,signature=12,landscape]{doc.pdf}
\end{document}
%%------------

Ͽ Ͽ PDFLaTeX ϸ aout.pdf . PDF μϿ   öغ.

signature ɼ ִ nup ɼ ǹϴ. ׻ 1x2 Ǵ 2x1 PDF ̴.

ڵȭִ DohyunKim Perl Script. KTUGBoard:3167

[]

5 PDF

KTUGOperate:12845
PDF / Encryption

DVIPDFMx ̿Ͽ ȣ ɰų μ Ǵ ؽƮ / ϴ ϴ . ̰ DVIPDFMx ̴.



dvipdfmx.cfg ȳ ִ.
% Permission flag for PDF encryption: Revision will be 3 if the key size
% is greater than 40 bits.
%
% 0x0004 (Revision 2) Print the document.
%        (Revision 3) Print the document (possibly not at the highest quality
%        level, depending on whether bit 12[0x0800] is also set).
% 0x0008 Modify the contents of the document by operations other than those
%        controlled by bits 6[0x0020], 9[0x0100], and 11[0x0400].
% 0x0010 (Revision 2) Copy or otherwise extract text and graphics from the
%        document, including extracting text and graphics (in support of
%        accessibility to disabled users or for other purposes).
%        (Revision 3) Copy or otherwise extract text and grphics from the
%        document by operations other than that controlled by bit 10[0x0200].
% 0x0020 Add or modify text annotations, fill in interactive form fields,
%        and, if bit 4[0x0008] is also set, create or modify interactive
%        form fields (including signature fields).
%
% (Revision 3 only)
% 0x0100 Fill in existing interactive form fields (including signature
%        fields), even if bit 6 is clear.
% 0x0200 Extract text and graphics (in support of accessibility to disabled
%        users or for other purposes).
% 0x0400 Assemble the document (insert, rotate, or delete pages and create
%        bookmarks or thumbnail images), even if bit 4 is clear.
% 0x0800 Print the document to a representation from which a faithful digital
%        copy of the PDF content could be generated. When this bit is clear
%        (and bit 3 is set), printing is limited to a low-level representation
%        of the appearance, possibly of degraded quality.

⺻ P 0x003Cε, ̰ 40Ʈ ȼؿ شϴ ̴.  0x0010(Copy and Extract)0x003C 0x0010 ָ ȴ.
#> dvipdfmx -S -P 0x002C foo
н带 µ, ι°( °) User Password н带 ʰ ִ.

128Ʈ Revesion 3 ɼ ̿Ϸ ȴ.
#> dvipdfmx -K 128 -S -P 0x0D00 foo
Ʈ ϸ鼭 /⸸ Ϸ Ѵ.
#> dvipdfmx -K 128 -S -P 0x082C foo


[]

7 ׹ ƿƼ

TeX PDF ٷ ƿƼ .
  1. PDFill

  2. PDFTools
    PDF ġ(Merge) pdcat, ϴ pdsel, pdsplit, ؽƮ PDF ٲٴ txt2pdf, ׹ۿ ϸũ ߰, ũ ߰ ִ ƿƼ Ѵ.

  3. PDFtk
    PDF Toolkit. See PDFtk.

  4. Multivalent Tools
  5. [http]KLDPBBS Windows PostScript Ϸ Ʈ ϱ, PS PDF

  6. pyPDF


^
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2011-09-28 13:40:31
Processing time 0.0900 sec