%% This is part of the OpTeX project, see http://petr.olsak.net/optex

\_codedecl \pdfprimitive {LuaTeX initialization code <2020-02-21>} % preloaded in format

\_let\_pdfpagewidth        \pagewidth
\_let\_pdfpageheight       \pageheight
\_let\_pdfadjustspacing    \adjustspacing
\_let\_pdfprotrudechars    \protrudechars
\_let\_pdfnoligatures      \ignoreligaturesinfont
\_let\_pdffontexpand       \expandglyphsinfont
\_let\_pdfcopyfont         \copyfont
\_let\_pdfxform            \saveboxresource
\_let\_pdflastxform        \lastsavedboxresourceindex
\_let\_pdfrefxform         \useboxresource
\_let\_pdfximage           \saveimageresource
\_let\_pdflastximage       \lastsavedimageresourceindex
\_let\_pdflastximagepages  \lastsavedimageresourcepages
\_let\_pdfrefximage        \useimageresource
\_let\_pdfsavepos          \savepos
\_let\_pdflastxpos         \lastxpos
\_let\_pdflastypos         \lastypos
\_let\_pdfoutput           \outputmode
\_let\_pdfdraftmode        \draftmode
\_let\_pdfpxdimen          \pxdimen
\_let\_pdfinsertht         \insertht
\_let\_pdfnormaldeviate    \normaldeviate
\_let\_pdfuniformdeviate   \uniformdeviate
\_let\_pdfsetrandomseed    \setrandomseed
\_let\_pdfrandomseed       \randomseed
\_let\_pdfprimitive        \primitive
\_let\_ifpdfprimitive      \ifprimitive
\_let\_ifpdfabsnum         \ifabsnum
\_let\_ifpdfabsdim         \ifabsdim

\_public
   \pdfpagewidth \pdfpageheight \pdfadjustspacing \pdfprotrudechars
   \pdfnoligatures \pdffontexpand \pdfcopyfont \pdfxform \pdflastxform
   \pdfrefxform \pdfximage \pdflastximage \pdflastximagepages \pdfrefximage
   \pdfsavepos \pdflastxpos \pdflastypos \pdfoutput \pdfdraftmode \pdfpxdimen
   \pdfinsertht \pdfnormaldeviate \pdfuniformdeviate \pdfsetrandomseed
   \pdfrandomseed \pdfprimitive \ifpdfprimitive \ifpdfabsnum \ifpdfabsdim ;

\_directlua {tex.enableprimitives('pdf',{'tracingfonts'})}

\_protected\_def \_pdftexversion     {\_numexpr 140\_relax}
           \_def \_pdftexrevision    {7}
\_protected\_def \_pdflastlink       {\_numexpr\_pdffeedback lastlink\_relax}
\_protected\_def \_pdfretval         {\_numexpr\_pdffeedback retval\_relax}
\_protected\_def \_pdflastobj        {\_numexpr\_pdffeedback lastobj\_relax}
\_protected\_def \_pdflastannot      {\_numexpr\_pdffeedback lastannot\_relax}
           \_def \_pdfxformname      {\_pdffeedback xformname}
           \_def \_pdfcreationdate   {\_pdffeedback creationdate}
           \_def \_pdffontname       {\_pdffeedback fontname}
           \_def \_pdffontobjnum     {\_pdffeedback fontobjnum}
           \_def \_pdffontsize       {\_pdffeedback fontsize}
           \_def \_pdfpageref        {\_pdffeedback pageref}
           \_def \_pdfcolorstackinit {\_pdffeedback colorstackinit}
\_protected\_def \_pdfliteral        {\_pdfextension literal}
\_protected\_def \_pdfcolorstack     {\_pdfextension colorstack}
\_protected\_def \_pdfsetmatrix      {\_pdfextension setmatrix}
\_protected\_def \_pdfsave           {\_pdfextension save\_relax}
\_protected\_def \_pdfrestore        {\_pdfextension restore\_relax}
\_protected\_def \_pdfobj            {\_pdfextension obj }
\_protected\_def \_pdfrefobj         {\_pdfextension refobj }
\_protected\_def \_pdfannot          {\_pdfextension annot }
\_protected\_def \_pdfstartlink      {\_pdfextension startlink }
\_protected\_def \_pdfendlink        {\_pdfextension endlink\_relax}
\_protected\_def \_pdfoutline        {\_pdfextension outline }
\_protected\_def \_pdfdest           {\_pdfextension dest }
\_protected\_def \_pdfthread         {\_pdfextension thread }
\_protected\_def \_pdfstartthread    {\_pdfextension startthread }
\_protected\_def \_pdfendthread      {\_pdfextension endthread\_relax}
\_protected\_def \_pdfinfo           {\_pdfextension info }
\_protected\_def \_pdfcatalog        {\_pdfextension catalog }
\_protected\_def \_pdfnames          {\_pdfextension names }
\_protected\_def \_pdfincludechars   {\_pdfextension includechars }
\_protected\_def \_pdffontattr       {\_pdfextension fontattr }
\_protected\_def \_pdfmapfile        {\_pdfextension mapfile }
\_protected\_def \_pdfmapline        {\_pdfextension mapline }
\_protected\_def \_pdftrailer        {\_pdfextension trailer }
\_protected\_def \_pdfglyphtounicode {\_pdfextension glyphtounicode }

\_protected\_edef\_pdfcompresslevel       {\_pdfvariable compresslevel}
\_protected\_edef\_pdfobjcompresslevel    {\_pdfvariable objcompresslevel}
\_protected\_edef\_pdfdecimaldigits       {\_pdfvariable decimaldigits}
\_protected\_edef\_pdfgamma               {\_pdfvariable gamma}
\_protected\_edef\_pdfimageresolution     {\_pdfvariable imageresolution}
\_protected\_edef\_pdfimageapplygamma     {\_pdfvariable imageapplygamma}
\_protected\_edef\_pdfimagegamma          {\_pdfvariable imagegamma}
\_protected\_edef\_pdfimagehicolor        {\_pdfvariable imagehicolor}
\_protected\_edef\_pdfimageaddfilename    {\_pdfvariable imageaddfilename}
\_protected\_edef\_pdfpkresolution        {\_pdfvariable pkresolution}
\_protected\_edef\_pdfinclusioncopyfonts  {\_pdfvariable inclusioncopyfonts}
\_protected\_edef\_pdfinclusionerrorlevel {\_pdfvariable inclusionerrorlevel}
\_protected\_edef\_pdfgentounicode        {\_pdfvariable gentounicode}
\_protected\_edef\_pdfpagebox             {\_pdfvariable pagebox}
\_protected\_edef\_pdfminorversion        {\_pdfvariable minorversion}
\_protected\_edef\_pdfuniqueresname       {\_pdfvariable uniqueresname}
\_protected\_edef\_pdfhorigin             {\_pdfvariable horigin}
\_protected\_edef\_pdfvorigin             {\_pdfvariable vorigin}
\_protected\_edef\_pdflinkmargin          {\_pdfvariable linkmargin}
\_protected\_edef\_pdfdestmargin          {\_pdfvariable destmargin}
\_protected\_edef\_pdfthreadmargin        {\_pdfvariable threadmargin}
\_protected\_edef\_pdfpagesattr           {\_pdfvariable pagesattr}
\_protected\_edef\_pdfpageattr            {\_pdfvariable pageattr}
\_protected\_edef\_pdfpageresources       {\_pdfvariable pageresources}
\_protected\_edef\_pdfxformattr           {\_pdfvariable xformattr}
\_protected\_edef\_pdfxformresources      {\_pdfvariable xformresources}
\_protected\_edef\_pdfpkmode              {\_pdfvariable pkmode}

\_public
   \pdftexversion \pdftexrevision \pdflastlink \pdfretval \pdflastobj
   \pdflastannot \pdfxformname \pdfcreationdate \pdffontname \pdffontobjnum
   \pdffontsize \pdfpageref \pdfcolorstackinit \pdfliteral \pdfcolorstack
   \pdfsetmatrix \pdfsave \pdfrestore \pdfobj \pdfrefobj \pdfannot
   \pdfstartlink \pdfendlink \pdfoutline \pdfdest \pdfthread \pdfstartthread
   \pdfendthread \pdfinfo \pdfcatalog \pdfnames \pdfincludechars \pdffontattr
   \pdfmapfile \pdfmapline \pdftrailer \pdfglyphtounicode \pdfcompresslevel
   \pdfobjcompresslevel \pdfdecimaldigits \pdfgamma \pdfimageresolution
   \pdfimageapplygamma \pdfimagegamma \pdfimagehicolor \pdfimageaddfilename
   \pdfpkresolution \pdfinclusioncopyfonts \pdfinclusionerrorlevel
   \pdfgentounicode \pdfpagebox \pdfminorversion \pdfuniqueresname \pdfhorigin
   \pdfvorigin \pdflinkmargin \pdfdestmargin \pdfthreadmargin \pdfpagesattr
   \pdfpageattr \pdfpageresources \pdfxformattr \pdfxformresources \pdfpkmode ;

\_pdfminorversion     = 5
\_pdfobjcompresslevel = 2
\_pdfcompresslevel    = 9
\_pdfdecimaldigits    = 3
\_pdfpkresolution     = 600

\_endcode

Common pdf\TeX/ primitives equivalents are declared here. Initial values are set.
