PDF 페이지 사용 시 페이지 순서 변경

PDF 페이지 사용 시 페이지 순서 변경

다음 예를 고려하십시오.

파일:B.tex

\documentclass[
  12pt,
  landscape
]{article}

\usepackage[
  a6paper
]{geometry}
\usepackage{multido}


\newenvironment{navn}{%
  \setlength{\topskip}{0pt}%
  \centering
  \vspace*{\fill}%
  \nointerlineskip
  \Huge
  % \sbox0{Front}%
  % \showthe\ht0
}{%
  \par
  \vspace*{\fill}%
  % \setlength{\showboxdepth}{\maxdimen}%
  % \setlength{\showboxbreadth}{\maxdimen}%
  % \tracingonline=1 %
  % \showlists
}

\pagestyle{empty}


\begin{document}

\multido{\i = 1+1}{16}{%
\begin{navn}
  Front
\end{navn}
\newpage}

\end{document}

파일:C.tex

\documentclass[
  12pt,
  landscape
]{article}

\usepackage[
  a6paper
]{geometry}
\usepackage{multido}


\newenvironment{navn}{%
  \setlength{\topskip}{0pt}%
  \centering
  \vspace*{\fill}%
  \nointerlineskip
  \Huge
  % \sbox0{XYZ}%
  % \showthe\ht0
}{%
  \par
  \vspace{\fill}%
  % \setlength{\showboxdepth}{\maxdimen}%
  % \setlength{\showboxbreadth}{\maxdimen}%
  % \tracingonline=1 %
  % \showlists
}

\pagestyle{empty}


\begin{document}

\multido{\i = 1+1}{16}{%
\begin{navn}
  \thepage
\end{navn}
\newpage}

\end{document}

파일:A.tex

\documentclass[
  a4paper
]{article}

\usepackage{pdfpages}

\begin{document}

\includepdf[
  nup = 2x4,
  pages = -,
  frame = true
]{B}

\includepdf[
  nup = 2x4,
  pages = -
]{C}

\end{document}

(문서는 실제로는 훨씬 더 큽니다. B.tex)C.tex

질문

업데이트됨

페이지 순서를 어떻게 바꾸나요 A.pdf?

Bp1, Bp2, ..., Bpn, Cp1, Cp2, ..., Cpn

에게

Bp1, ..., Bp8, Cp1, ..., Cp8, [...], Bp(n-8), ..., Bpn, Cp(n-8), Cpn

임의의 n에 대해?

즉, 의 페이지만 첫 번째 페이지에 있고 의 페이지만 두 번째 페이지에 있기를 A.pdf원합니다 .B.pdfC.pdf

답변1

이전 코드를 삭제했으므로 이 답변은 귀하의 질문에 대한 최신 편집 내용과 일치합니다.

아래 코드는 원하는 작업을 수행합니다. 페이지 양이 같은지 확인하고 C.pdf, 그렇지 않은 경우 더 적은 페이지의 마지막 페이지까지 인쇄합니다( 한 페이지와 다른 페이지에 B.pdf양면 방식으로 ). , 그 후에는 더 많은 페이지가 있는 나머지 페이지를 인쇄합니다. 두 PDF의 모든 페이지 대신 고정된 최대 페이지를 제공할 수 있는 선택적 인수를 허용합니다(고정 최대 페이지를 사용하면 두 PDF에 해당 페이지가 있는지 확인되지 않습니다). ).BC

\documentclass[
  a4paper
]{article}

\usepackage{pdfpages}

\newcount\maxpages
\newcount\curpage
\newcount\untilpage
\makeatletter
\newif\if@pdfdingsunbalance
\newcount\@testmaxpages
\newcommand{\@incpdfdings}[3]{\includepdf[nup=2x4,pages={#1-#2},frame=true]{#3}}
\newcommand{\incpdfdings}[3][]{%
    \ifx\relax#1\relax%
        \pdfximage{#2}%
        \maxpages=\pdflastximagepages%
        \pdfximage{#3}%
        \@testmaxpages=\pdflastximagepages%
        \ifnum\maxpages<\@testmaxpages%
            \@pdfdingsunbalancetrue%
            \def\@pdfdingsmore{#3}%
        \else\ifnum\@testmaxpages<\maxpages%
            \@pdfdingsunbalancetrue%
            \def\@pdfdingsmore{#2}%
            \maxpages=\@testmaxpages%
        \fi\fi%
    \else%
        \maxpages=#1%
    \fi%
    \curpage=0%
    \loop\ifnum\maxpages>\curpage%
        \advance\curpage by 1%
        \untilpage=\numexpr\curpage+7\relax%
        \ifnum\maxpages>\untilpage\else%
            \untilpage=\maxpages%
        \fi%
        \@incpdfdings{\the\curpage}{\the\untilpage}{#2}%
        \@incpdfdings{\the\curpage}{\the\untilpage}{#3}%
        \advance\curpage by 7%
    \repeat%
    \if@pdfdingsunbalance%
        \advance\maxpages by 1%
        \@incpdfdings{\the\maxpages}{}{\@pdfdingsmore}%
    \fi%
}
\makeatother

\begin{document}
\incpdfdings{B.pdf}{C.pdf}
\end{document}

편집: 어쨌든 오류 감지를 게시하겠습니다(경고가 표시됨).

\documentclass[
  a4paper
]{article}

\usepackage{pdfpages}

\newcount\maxpages
\newcount\curpage
\newcount\untilpage
\makeatletter
\newif\if@pdfdingsunbalance
\newcount\@testmaxpages
\newcommand{\@incpdfdings}[3]{\includepdf[nup=2x4,pages={#1-#2},frame=true]{#3}}
\newcommand{\incpdfdings}[3][]{%
    \ifx\relax#1\relax%
        \pdfximage{#2}%
        \maxpages=\pdflastximagepages%
        \pdfximage{#3}%
        \@testmaxpages=\pdflastximagepages%
        \ifnum\maxpages<\@testmaxpages%
            \@pdfdingsunbalancetrue%
            \def\@pdfdingsmore{#3}%
        \else\ifnum\@testmaxpages<\maxpages%
            \@pdfdingsunbalancetrue%
            \def\@pdfdingsmore{#2}%
            \maxpages=\@testmaxpages%
        \fi\fi%
    \else%
        \maxpages=#1%
        \pdfximage{#2}%
        \@testmaxpages=\pdflastximagepages%
        \ifnum\maxpages>\@testmaxpages%
            \@latex@warning{The file #2 you wanted to be printed with
                incpdfdings doesn't have enough pages to match your request in
                the optional argument}%
            \maxpages=\@testmaxpages%
        \fi%
        \pdfximage{#3}%
        \@testmaxpages=\pdflastximagepages%
        \ifnum#1>\@testmaxpages%
            \@latex@warning{The file #3 you wanted to be printed with
                incpdfdings doesn't have enough pages to match your request in
                the optional argument}%
            \ifnum\maxpages>\@testmaxpages%
                \maxpages=\@testmaxpages%
        \fi\fi%
    \fi%
    \curpage=0%
    \loop\ifnum\maxpages>\curpage%
        \advance\curpage by 1%
        \untilpage=\numexpr\curpage+7\relax%
        \ifnum\maxpages>\untilpage\else%
            \untilpage=\maxpages%
        \fi%
        \@incpdfdings{\the\curpage}{\the\untilpage}{#2}%
        \@incpdfdings{\the\curpage}{\the\untilpage}{#3}%
        \advance\curpage by 7%
    \repeat%
    \if@pdfdingsunbalance%
        \advance\maxpages by 1%
        \@incpdfdings{\the\maxpages}{}{\@pdfdingsmore}%
    \fi%
}
\makeatother

\begin{document}
\incpdfdings[60]{B.pdf}{C.pdf}
\end{document}

답변2

두 개의 PDF 파일을 하나로 결합한 다음 두 번째로 문서 C에 추가하는 것이 더 효율적일 수 있습니다. JavaScript에 익숙하다면 이 링크가 유용할 수 있습니다.http://www.planetpdf.com/developer/article.asp?ContentID=collating_pdfs_using_javascrip&rh%20s_fa

아니면 이 온라인 서비스 https://www.sejda.com/en/alternate-mix-pdf

관련 정보