1

I have a pdf form created in latex. A MWE is shown below:

NON-WORKING EXAMPLE: work-order-form.barcode-example.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}

WORKING EXAMPLE: work-order-form.barcode-working-example.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}

The difference between the non-working and working is: The working example has:

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

where as the non-working example has:

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

Example of working code, given as answer.

The command to compile both examples is: pdflatex -shell-escape -synctex=1 -interaction=nonstopmode "<FILENAME>".tex

The result of running the non-working example is that page one is blank, then on page 2 only the environment containing the logo is shown. The environment on page 2 is followed by a page break. The next environment (displaying the title of the form) is shown on page 3.

What have I overlooked or don't know?

1

1 Answer 1

1

your first (not working example) slightly modified for running it with 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{} 

[...]

You didn't provide your image, so I used

\usepackage[demo]{graphicx}

which gives the black box:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .