2

I am trying to create a QR code with latex, no example I have tried works.

barcode-test.tex

\documentclass{article}
\usepackage[a-1b]{pdfx}
\usepackage{pst-barcode}
\begin{document}
    \begin{pspicture}(25mm,25mm)
        \psbarcode[]{1234}{}{qrcode}
    \end{pspicture}
\end{document}

partial output from "pdflatex -synctex=1 -interaction=nonstopmode /home/dfear/Pickle\ IT/documents/forms\ TEMP/work-order-form.tex"

\c@lor@to@ps ->\PSTricks 
                         _Not_Configured_For_This_Format
l.6             \psbarcode[]{1234}{}{qrcode}
                                  
! Undefined control sequence.
\XC@usec@lor ...lashchar color@#1#2\endcsname \@@ 
                                                  \fi \space 
l.6             \psbarcode[]{1234}{}{qrcode}
                                  
[1

What I am doing wrong?

2
  • 3
    pdftex can't process pstricks. Try with lualatex. Commented Feb 28 at 22:43
  • run it with lualatex instead of pdflatex
    – user187802
    Commented Feb 29 at 10:53

1 Answer 1

1

If you want to use pdfLaTeX then you can use the auto-pst-pdf package which automatically extracts PSTricks code from the document, runs it through latex-dvips-ps2pdf-pdfcrop, and inserts the resulting graphic in the document. This requires the -shell-escape compilation flag.

Another issue is that the auto-pst-pdf toolchain does not support pdfx. The preamble is copied as it is for the creation of the PSTricks graphics, so you should make pdfx conditional in order to be used for the regular pdfLaTeX run but not for the PSTricks processing.

MWE:

\documentclass{article}
\usepackage{auto-pst-pdf}
\ifpdf
\usepackage[a-1b]{pdfx}
\fi
\usepackage{pst-barcode}
\begin{document}
    \begin{pspicture}(25mm,25mm)
        \psbarcode[]{1234}{}{qrcode}
    \end{pspicture}
\end{document}

You must log in to answer this question.

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