% Adapted based on tex-ini-files 2016-04-15: luatexconfig.tex

% Load shared (PDF) settings in LuaMetaTeX

\begingroup
  \catcode`\{=1 %
  \catcode`\}=2 %
  \catcode`\#=6 %
  \def\list{%
      {compresslevel}%
      {decimaldigits}%
      {horigin}%
      {minorversion}%
      {objcompresslevel}%
      {pkresolution}%
      {vorigin}%
  }%
  % LuaMetaTeX doesn't have \pdfoutput, etc.:
  % emulate names where appropriate
  \let\pdfoutput\outputmode
  \let\pdfpageheight\pageheight
  \let\pdfpagewidth\pagewidth
  \def\do#1{%
    \ifx\relax#1\else
      \expandafter\edef\csname pdf#1\endcsname{\pdfvariable #1}%
      \expandafter\do
    \fi
  }%
  \expandafter\do\list\relax
  % The file pdftexconfig.tex contains only <primitive> = <value> lines
  % so can now be read using the (emulated) primitives
  % This needs to be global so set \globaldefs for the rest of the group
  \globaldefs=1 %
  % \input{pdftexconfig}%
  % Copied in here because the original uses `true` dimensions which aren't supported
  \pdfoutput           = 1

  % Paper size: dimensions given in absolute terms
  \pdfpageheight       = 297 mm
  \pdfpagewidth        = 210 mm

  % Enable PDF 1.5 output and thus more compression
  \pdfminorversion     = 5
  \pdfobjcompresslevel = 2

  % Low-level settings unlikely ever to need to change
  \pdfcompresslevel    = 9
  \pdfdecimaldigits    = 3
  \pdfpkresolution     = 600
  \pdfhorigin          = 1 in
  \pdfvorigin          = 1 in
  % Pick up on a request for DVI mode and apply it whilst \pdfoutput is
  % still defined
  \ifx\dvimode\relax
    \pdfoutput=0 %
  \fi
  \let\dvimode\undefined
\endgroup
