为什么将工作示例代码复制到现有文档时 pst-barcode 不显示二维码

为什么将工作示例代码复制到现有文档时 pst-barcode 不显示二维码

我有一个用 latex 创建的 pdf 表单。MWE 如下所示:

非工作示例:工作订单表格.条形码示例.tex

\documentclass[14pt,a4paper]{extarticle}

%\pdfminorversion=6
\usepackage{auto-pst-pdf}
\ifpdf
\usepackage[a-1b]{pdfx}
\fi
\usepackage{pst-barcode}
\newcommand{\workOrderID}{4798}


\usepackage{xcolor}
\usepackage{multicol}
%\pdfminorversion=6
%\usepackage[pdfa]{hyperref}
\usepackage{hyperref}
%\usepackage{eforms}
\usepackage{graphicx}
\usepackage[left=15mm,right=15mm,top=6mm,bottom=13mm]{geometry}
\usepackage{float}

\usepackage{multirow}
\usepackage{tabularx}

\usepackage{titlesec}

\makeatletter\def\PDFForm@@Name#1{} 

\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}

\renewcommand\LayoutTextField[2]{%
    #1 \raisebox{-3.0pt}{#2}%
}
\newlength\templength
\newcommand{\DefaultTextField}[2][]{%
    \settowidth\templength{#2 }%
    \mbox{\TextField[align=0,bordercolor=0.78 0.78 0.75,backgroundcolor={},#1,height=3.55ex,width=\dimexpr\linewidth-\templength]{#2}}%
}
\newlength\templengthtwo
\newcommand{\DefaultTextFieldMultiline}[2][]{%
    \settowidth\templengthtwo{#2 }%
    \mbox{\TextField[align=0,bordercolor=0.78 0.78 0.75,backgroundcolor={},#1,width=\dimexpr\linewidth-\templengthtwo]{#2}}%
}
\renewcommand\LayoutCheckField[2]{%
    \raisebox{-1.0pt}{#2}\hspace*{2mm}#1%
}
\newcommand{\DefaultCheckBox}[2][]{%
    \mbox{\CheckBox[bordercolor=0 0 0,backgroundcolor={},borderwidth=0.4mm,height=5mm,width=5mm,#1]{#2}}%
}

\newenvironment{changemargin}[2]{%
    \begin{list}{}{%
            \setlength{\topsep}{0pt}%
            \setlength{\leftmargin}{#1}%
            \setlength{\rightmargin}{#2}%
            \setlength{\listparindent}{\parindent}%
            \setlength{\itemindent}{\parindent}%
            \setlength{\parsep}{\parskip}%
        }%
        \item[]}{\end{list}}

\titleformat{\section}
{\normalfont\fontsize{14}{14}\bfseries}{\thesection}{0.8em}{}

\makeatother
\begin{document}

%\def\DefaultHeightofText[12pt]
\def\DefaultHeightofText{14pt}%

\begin{Form}
    \begin{changemargin}{-1.25cm}{-1.25cm}
        \begin{minipage}{0.33\linewidth}
            \includegraphics[width=6.5cm]{/home/dfear/Pickle IT/documents/stationary/logo/2020 update/pickleit-header-2022update.CMYK.png}
        \end{minipage}%
        \begin{minipage}{0.18\linewidth}
        \footnotesize
        67 St Peters Rise, \newline
        Bishopsworth, \newline
        Bristol, BS13 7NA.
        \end{minipage}%
        \begin{minipage}{0.21\linewidth}
        \footnotesize
        t: 07708 200287 \newline
        e: [email protected] \newline
        w: www.pickle-it.co.uk
        \end{minipage}
        \begin{minipage}[t]{0.28\linewidth}
        %\TextField[name=invID,height=12mm]{INV}
        \raisebox{2ex}{\large\color[rgb]{0.502 0 0}\textbf{INV }} \TextField[bordercolor=0.78 0.78 0.75,height=5ex,charsize=18pt,name=workOrderID]{}\newline
        \raisebox{2ex}{\large\color[rgb]{1 1 1}\textbf{ INV }} \begin{pspicture}(15mm,15mm) \psbarcode[]{\workOrderID}{}{qrcode} \end{pspicture}
        \end{minipage}
    \end{changemargin}  

    \begin{center}
        \vspace{-9.1ex}
        \underline{\large\textbf{Work Order}}
        \vspace{-2.6ex}
    \end{center}
        
\end{Form}
\end{document}

工作示例:工作订单表.条形码工作示例.tex

\documentclass[14pt,a4paper]{extarticle}

%\pdfminorversion=6
\usepackage{auto-pst-pdf}
\ifpdf
\usepackage[a-1b]{pdfx}
\fi
\usepackage{pst-barcode}
\newcommand{\workOrderID}{4798}


\usepackage{xcolor}
\usepackage{multicol}
%\pdfminorversion=6
%\usepackage[pdfa]{hyperref}
\usepackage{hyperref}
%\usepackage{eforms}
\usepackage{graphicx}
\usepackage[left=15mm,right=15mm,top=6mm,bottom=13mm]{geometry}
\usepackage{float}

\usepackage{multirow}
\usepackage{tabularx}

\usepackage{titlesec}

\makeatletter\def\PDFForm@@Name#1{} 

\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}

\renewcommand\LayoutTextField[2]{%
    #1 \raisebox{-3.0pt}{#2}%
}
\newlength\templength
\newcommand{\DefaultTextField}[2][]{%
    \settowidth\templength{#2 }%
    \mbox{\TextField[align=0,bordercolor=0.78 0.78 0.75,backgroundcolor={},#1,height=3.55ex,width=\dimexpr\linewidth-\templength]{#2}}%
}
\newlength\templengthtwo
\newcommand{\DefaultTextFieldMultiline}[2][]{%
    \settowidth\templengthtwo{#2 }%
    \mbox{\TextField[align=0,bordercolor=0.78 0.78 0.75,backgroundcolor={},#1,width=\dimexpr\linewidth-\templengthtwo]{#2}}%
}
\renewcommand\LayoutCheckField[2]{%
    \raisebox{-1.0pt}{#2}\hspace*{2mm}#1%
}
\newcommand{\DefaultCheckBox}[2][]{%
    \mbox{\CheckBox[bordercolor=0 0 0,backgroundcolor={},borderwidth=0.4mm,height=5mm,width=5mm,#1]{#2}}%
}

\newenvironment{changemargin}[2]{%
    \begin{list}{}{%
            \setlength{\topsep}{0pt}%
            \setlength{\leftmargin}{#1}%
            \setlength{\rightmargin}{#2}%
            \setlength{\listparindent}{\parindent}%
            \setlength{\itemindent}{\parindent}%
            \setlength{\parsep}{\parskip}%
        }%
        \item[]}{\end{list}}

\titleformat{\section}
{\normalfont\fontsize{14}{14}\bfseries}{\thesection}{0.8em}{}

\makeatother
\begin{document}

%\def\DefaultHeightofText[12pt]
\def\DefaultHeightofText{14pt}%

\begin{Form}
    \begin{changemargin}{-1.25cm}{-1.25cm}
        \begin{minipage}{0.33\linewidth}
            \includegraphics[width=6.5cm]{/home/dfear/Pickle IT/documents/stationary/logo/2020 update/pickleit-header-2022update.CMYK.png}
        \end{minipage}%
        \begin{minipage}{0.18\linewidth}
        \footnotesize
        67 St Peters Rise, \newline
        Bishopsworth, \newline
        Bristol, BS13 7NA.
        \end{minipage}%
        \begin{minipage}{0.21\linewidth}
        \footnotesize
        t: 07708 200287 \newline
        e: [email protected] \newline
        w: www.pickle-it.co.uk
        \end{minipage}
        \begin{minipage}[t]{0.28\linewidth}
        %\TextField[name=invID,height=12mm]{INV}
        \raisebox{2ex}{\large\color[rgb]{0.502 0 0}\textbf{INV }} \TextField[bordercolor=0.78 0.78 0.75,height=5ex,charsize=18pt,name=workOrderID]{}\newline
        \raisebox{2ex}{\large\color[rgb]{1 1 1}\textbf{ INV }} \includegraphics[width=70px]{/home/dfear/Pickle IT/documents/projects/software/qrcode.png}
        \end{minipage}
    \end{changemargin}  

    \begin{center}
        \vspace{-9.1ex}
        \underline{\large\textbf{Work Order}}
        \vspace{-2.6ex}
    \end{center}
        
\end{Form}
\end{document}

非工作与工作之间的区别是:工作示例具有:

\includegraphics[width=70px]{/home/dfear/Pickle IT/documents/projects/software/qrcode.png}

而非工作示例如下:

\begin{pspicture}(15mm,15mm) \psbarcode[]{\workOrderID}{}{qrcode} \end{pspicture}

例子工作代码,作为答案给出。

编译两个示例的命令是:pdflatex -shell-escape -synctex=1 -interaction=nonstopmode "<FILENAME>".tex

运行不工作的示例的结果是第一页是空白的,然后第二页只显示包含徽标的环境。第二页的环境后面是分页符。下一个环境(显示表单的标题)显示在第 3 页。

我忽略了什么或者不知道什么?

答案1

您的第一个(不起作用的示例)稍微修改了一下以便运行它lualatex

\documentclass[14pt,a4paper]{extarticle}

\usepackage{fontspec}
\usepackage[a-1b]{pdfx}
\usepackage{pst-barcode}
\newcommand{\workOrderID}{4798}
\usepackage{xcolor}
\usepackage{multicol}

%\usepackage{eforms}
\usepackage[demo]{graphicx}
\usepackage[left=15mm,right=15mm,top=6mm,bottom=13mm]{geometry}
\usepackage{float}

\usepackage{multirow}
\usepackage{tabularx}

\usepackage{titlesec}

%\pdfminorversion=6
%\usepackage[pdfa]{hyperref}
\usepackage{hyperref}

\makeatletter\def\PDFForm@@Name#1{} 

[...]

你没有提供图片,所以我用了

\usepackage[demo]{graphicx}

得到黑匣子:

在此处输入图片描述

相关内容