TransWikia.com

I need a barcode in a PDF/A

TeX - LaTeX Asked on April 25, 2021

as in the title, I need a (simple 128) barcode and I need the PDF/A standard. I know how to do both separately. But pdfx won’t run with latex so I cannot create a DVI and so on, which I need for the pst-barcode package:

! pdfTeX error (pdfmapline): not allowed in DVI mode (pdfoutput <= 0). pdfmapline

Is there a way to have a bar code and PDF/A without pst-barcode that works with pdfLatex? Thank you very much!

Edit: using the code in the answer below the following terminal output is produced (truncated a bit):

C:testlat>xelatex --shell-escape -output-driver="xdvipdfmx -z 0" xeBar.tex
This is XeTeX, Version 3.14159265-2.6-0.999992 (MiKTeX 2.9.7380 64-bit)
entering extended mode
(xeBar.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06>
[...]
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/latex/hyperrefpsdextra.
def")
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/colorprofilesco
lorprofiles.sty"
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/colorprofilesco
lorprofiles.tex"))
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/stringencse-asc
ii-print.def")
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/latex/pdfxAdobeColorPro
files.tex")
** pdfx: No file xeBar.xmpdata . Metadata will be incomplete!
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/latex/baseifthen.sty")
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/latex/xmpinclxmpincl.st
y")
Using XMP template file: pdfa.xmp
)
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/latex/pst-barcodepst-ba
rcode.sty"
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/latex/pstrickspstricks.
sty"
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/latex/toolsshellesc.sty
")
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/xkeyvalpst-xkey
.tex"
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/latex/xkeyvalxkeyval.st
y"
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/xkeyvalxkeyval.
tex"
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/xkeyvalxkvutils
.tex"))))
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/pstrickspstrick
s.tex"
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/pstrickspst-fp.
tex" `pst-fp' v0.05, 2010/01/17 (hv))
[...]
`PSTricks' v2.97  <2019/05/11> (tvz,hv)

("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/xelatex/xetex-pstricksp
stricks.con"
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/pstricksxdvipdf
mx.cfg"))
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/xelatex/xetex-pstricksp
stricks.con"
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/pstricksxdvipdf
mx.cfg"
Using PSTricks configuration for XeTeX+xdvipdfmx
)))
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/pstrickspst-fp.
tex")
>>> Loading XeTeX special macros

("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/pstrickspstrick
s-xetex.def"))
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/pst-barcodepst-
barcode.tex" `PST-barcode' v0.18, 2017/08/22 (tb,hv)
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/latex/marginnotemarginn
ote.sty")))
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/latex/l3backendl3backen
d-xdvipdfmx.def") (xeBar.aux)
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/latex/basets1cmr.fd")
ABD: EveryShipout initializing macros
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/latex/hyperrefnameref.s
ty"
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/latex/refcountrefcount.
sty")
("C:UsersDev06AppDataLocalProgramsMiKTeX 2.9tex/generic/gettitlestringg
ettitlestring.sty")) (xeBar.out) (xeBar.out) [1] (xeBar.aux) )stdin -> stdout
[1
xdvipdfmx:warning: Could not find any valid object.
xdvipdfmx:warning: Filtering file via command -->mgs.exe -q -dNOPAUSE -dBATCH -dEPSCrop -sPAPERSIZE=a0 -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dAutoRotatePages=/None -sOutputFile="C:/Users/Dev06/AppData/Local/Temp/mikDCFC.tmp" "C:/Users/Dev06/AppData/Local/Temp/mikDCFB.tmp" -c quit<-- failed.
xdvipdfmx:warning: Image format conversion for PSTricks failed.
xdvipdfmx:warning: Interpreting special command pst: (ps:) failed.
xdvipdfmx:warning: >> at page="1" position="(148.712, 595.198)" (in PDF)
xdvipdfmx:warning: >> xxx "pst:  tx@Dict begin STP newpath 0.8 SLW 0 0 0  setrgbcolor   gs"
]
11723 bytes written

One Answer

You can use PSTricks packages with XeLaTeX, which is also supported by pdfx. According to the documentation of pdfx (page 1 in a footnote) you need the following command:

xelatex --shell-escape -output-driver="xdvipdfmx -z 0" <filename>.tex

MWE:

documentclass{article}
usepackage[a-1b]{pdfx}
usepackage{pst-barcode}
begin{document}
begin{pspicture}(2.5,1in)
psbarcode{01335583}{includetext}{ean8}
end{pspicture}
end{document}

Result:

enter image description here

Answered by Marijn on April 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP