Evidlo / remarkable_printer

Native printing to reMarkable.
GNU General Public License v3.0
257 stars 21 forks source link

Failing to print from MacOS #6

Closed Gozala closed 4 years ago

Gozala commented 4 years ago

Here's output of journalctl -f --unit printer which suggest something is wrong with pdf although I'm not sure why

Jul 10 07:21:26 reMarkable printer.arm[770]: Listening on 0.0.0.0:9100
Jul 10 07:21:46 reMarkable printer.arm[770]: Saving PDF to /home/root/.local/share/remarkable/xochitl/e0d00f7b-0bca-4f65-87d2-5f0189269b3e.pdf
Jul 10 07:21:46 reMarkable printer.arm[770]: Invalid PDF
Jul 10 07:21:46 reMarkable systemd[1]: printer.service: Main process exited, code=exited, status=1/FAILURE
Jul 10 07:21:46 reMarkable systemd[1]: printer.service: Failed with result 'exit-code'.
Jul 10 07:21:47 reMarkable systemd[1]: printer.service: Service hold-off time over, scheduling restart.
Jul 10 07:21:47 reMarkable systemd[1]: printer.service: Scheduled restart job, restart counter is at 3.
Jul 10 07:21:47 reMarkable systemd[1]: Stopped Native printing to reMarkable.
Jul 10 07:21:47 reMarkable systemd[1]: Started Native printing to reMarkable.
Jul 10 07:21:47 reMarkable printer.arm[775]: Listening on 0.0.0.0:9100
Evidlo commented 4 years ago

Can you modify printer.service and add -debug after -restart, then make install again?

This should print each line of the PDF as it's received.

Gozala commented 4 years ago

Here's the output with -debug flag on (I stopped service and run it manually as /home/root/printer.arm -debug)

Inline print output(download)
Listening on 0.0.0.0:9100
Saving PDF to /home/root/.local/share/remarkable/xochitl/983a04ec-4cc8-4e69-b74b-ebded029c70b.pdf
[%!PS-Adobe-3.0
]
[%APL_DSC_Encoding: UTF8
]
[%APLProducer: (Version 10.15.5 (Build 19F101) Quartz PS Context)
]
[%%Title: (Test Doc)
]
[%%Creator: (Notes: cgpdftops CUPS filter)
]
[%%CreationDate: (Friday, July 10 2020 00:55:43 PDT)
]
[%%For: (System Administrator)
]
[%%DocumentData: Clean7Bit
]
[%%LanguageLevel: 2
]
[%%PageOrder: Ascend
]
[%RBINumCopies: 1
]
[%%Pages: (atend)
]
[%%BoundingBox: (atend)
]
[%%EndComments
]
[userdict/dscInfo 5 dict dup begin
]
[/Title(Test Doc)def
]
[/Creator(Notes: cgpdftops CUPS filter)def
]
[/CreationDate(Friday, July 10 2020 00:55:43 PDT)def
]
[/For(System Administrator)def
]
[/Pages 1 def
]
[end put
]
[%%BeginProlog
]
[%%BeginFile: lw8_errorhandler-2.0
]
[/currentpacking where 
]
[   { pop /oldpack currentpacking def /setpacking where
]
[       {
]
[           pop false setpacking
]
[       }if
]
[   }if
]
[/$brkpage 64 dict def $brkpage begin
]
[/prnt
]
[ {dup type/stringtype ne{=string cvs}if dup length 6 mul/tx exch def/ty 10 def
]
[  currentpoint/toy exch def/tox exch def 1 setgray newpath
]
[  tox toy 2 sub moveto 0 ty rlineto tx 0 rlineto 0 ty neg rlineto
]
[  closepath fill tox toy moveto 0 setgray show}bind def
]
[/nl{currentpoint exch pop lmargin exch moveto 0 -10 rmoveto}def
]
[/=={/cp 0 def typeprint nl}def
]
[/typeprint{dup type exec}readonly def
]
[/lmargin 72 def
]
[/rmargin 72 def
]
[/tprint
]
[   {dup length cp add rmargin gt{nl/cp 0 def}if
]
[    dup length cp add/cp exch def prnt}readonly def
]
[/cvsprint{=string cvs tprint( )tprint}readonly def
]
[/integertype{cvsprint}readonly def
]
[/realtype{cvsprint}readonly def
]
[/booleantype{cvsprint}readonly def
]
[/operatortype{(--)tprint =string cvs tprint(-- )tprint}readonly def
]
[/marktype{pop(-mark- )tprint}readonly def
]
[/dicttype{pop(-dictionary- )tprint}readonly def
]
[/nulltype{pop(-null- )tprint}readonly def
]
[/filetype{pop(-filestream- )tprint}readonly def
]
[/savetype{pop(-savelevel- )tprint}readonly def
]
[/fonttype{pop(-fontid- )tprint}readonly def
]
[/nametype{dup xcheck not{(/)tprint}if cvsprint}readonly def
]
[/stringtype
]
[ {dup rcheck{(\()tprint tprint(\))tprint}{pop(-string- )tprint}ifelse
]
[ }readonly def
]
[/arraytype
]
[ {dup rcheck{dup xcheck
]
[  {({)tprint{typeprint}forall(})tprint}
]
[  {([)tprint{typeprint}forall(])tprint}ifelse}{pop(-array- )tprint}ifelse
]
[ }readonly def
]
[/packedarraytype
]
[ {dup rcheck{dup xcheck
]
[  {({)tprint{typeprint}forall(})tprint}
]
[  {([)tprint{typeprint}forall(])tprint}ifelse}{pop(-packedarray- )tprint}ifelse
]
[ }readonly def
]
[/courier/Courier findfont 10 scalefont def
]
[end %$brkpage
]
[errordict/handleerror
]
[ {systemdict begin $error begin $brkpage begin newerror
]
[   {/newerror false store 
]
[    vmstatus pop pop 0 ne{grestoreall}if initgraphics courier setfont
]
[    lmargin 720 moveto(ERROR: )prnt errorname prnt
]
[    nl(OFFENDING COMMAND: )prnt/command load prnt
]
[   $error/ostack known{
]
[   $error/ostack get type dup/arraytype eq exch /packedarraytype eq or
]
[   {nl nl(STACK:)prnt nl nl $error/ostack get aload length{==}repeat}if}if
]
[    systemdict/showpage get exec(%%[ Error: )print
]
[    errorname =print(; OffendingCommand: )print/command 
]
[    load =print( ]%%)= flush}if end end end}
]
[dup 0 systemdict put dup 4 $brkpage put bind readonly put
]
[/currentpacking where 
]
[   { pop  /setpacking where
]
[       {
]
[           pop oldpack setpacking
]
[       }if
]
[   }if
]
[%%EndFile
]
[%%BeginFile: cg-pdf.ps
]
[%%Copyright: Copyright 2000-2004 Apple Computer Incorporated.
]
[%%Copyright: All Rights Reserved.
]
[currentpacking true setpacking
]
[/cg_md 141 dict def
]
[cg_md begin
]
[/L3? languagelevel 3 ge def
]
[/bd{bind def}bind def
]
[/ld{load def}bd
]
[/xs{exch store}bd
]
[/xd{exch def}bd
]
[/cmmtx matrix def
]
[mark
]
[/sc/setcolor
]
[/scs/setcolorspace
]
[/dr/defineresource
]
[/fr/findresource
]
[/T/true
]
[/F/false
]
[/d/setdash
]
[/w/setlinewidth
]
[/J/setlinecap
]
[/j/setlinejoin
]
[/M/setmiterlimit
]
[/i/setflat
]
[/rc/rectclip
]
[/rf/rectfill
]
[/rs/rectstroke
]
[/f/fill
]
[/f*/eofill
]
[/sf/selectfont
]
[/s/show
]
[%/as/ashow
]
[/xS/xshow
]
[/yS/yshow
]
[/xyS/xyshow
]
[/S/stroke
]
[/m/moveto
]
[/l/lineto
]
[/c/curveto
]
[/h/closepath
]
[/n/newpath
]
[/q/gsave
]
[/Q/grestore
]
[counttomark 2 idiv
]
[%dup (number of ld's = )print == flush % *** how many 
]
[{ld}repeat pop
]
[/SC{   % CSname
]
[    /ColorSpace fr scs
]
[}bd
]
[/sopr /setoverprint where{pop/setoverprint}{/pop}ifelse ld
]
[/soprm /setoverprintmode where{pop/setoverprintmode}{/pop}ifelse ld
]
[/cgmtx matrix def
]
[/sdmtx{cgmtx currentmatrix pop}bd
]
[/CM {cgmtx setmatrix}bd        % pop the ctm: our gstate ctm on host is now identity
]
[/cm {cmmtx astore CM concat}bd % reset the matrix and then concat
]
[/W{clip newpath}bd
]
[/W*{eoclip newpath}bd
]
[
]
[statusdict begin product end dup (HP) anchorsearch{
]
[    pop pop pop    % pop off the search results
]
[    true
]
[}{
]
[    pop    % previous search result
]
[   (hp) anchorsearch{
]
[   pop pop true
]
[    }{
]
[   pop false
]
[    }ifelse
]
[}ifelse
]
[
]
[{  % HP is the product: we use this method of stroking because of a bug in their clone printers with certain T3 fonts
]
[    { 
]
[   { % charCode Wx Wy
]
[       pop pop % charCode
]
[       (0)dup 0 4 -1 roll put
]
[       F charpath
]
[   }cshow
]
[    }
]
[}{
]
[    {F charpath}
]
[}ifelse
]
[/cply exch bd
]
[/cps {cply stroke}bd
]
[/pgsave 0 def
]
[/bp{/pgsave save store}bd
]
[/ep{pgsave restore showpage}def        % dont' bind
]
[/re{4 2 roll m 1 index 0 rlineto 0 exch rlineto neg 0 rlineto h}bd
]
[
]
[/scrdict 10 dict def
]
[/scrmtx matrix def
]
[/patarray 0 def
]
[/createpat{patarray 3 1 roll put}bd
]
[/makepat{
]
[scrmtx astore pop
]
[gsave
]
[initgraphics
]
[CM 
]
[patarray exch get
]
[scrmtx
]
[makepattern
]
[grestore
]
[setpattern
]
[}bd
]
[
]
[/cg_BeginEPSF{
]
[    userdict save/cg_b4_Inc_state exch put
]
[    userdict/cg_endepsf/cg_EndEPSF load put
]
[    count userdict/cg_op_count 3 -1 roll put 
]
[    countdictstack dup array dictstack userdict/cg_dict_array 3 -1 roll put
]
[    3 sub{end}repeat
]
[    /showpage {} def
]
[    0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin
]
[    10 setmiterlimit [] 0 setdash newpath
]
[    false setstrokeadjust false setoverprint   % don't use F
]
[}bd
]
[/cg_EndEPSF{
]
[  countdictstack 3 sub { end } repeat
]
[  cg_dict_array 3 1 index length 3 sub getinterval
]
[  {begin}forall
]
[  count userdict/cg_op_count get sub{pop}repeat
]
[  userdict/cg_b4_Inc_state get restore
]
[  F setpacking
]
[}bd
]
[
]
[/cg_biproc{currentfile/RunLengthDecode filter}bd
]
[/cg_aiproc{currentfile/ASCII85Decode filter/RunLengthDecode filter}bd
]
[/ImageDataSource 0 def
]
[L3?{
]
[    /cg_mibiproc{pop pop/ImageDataSource{cg_biproc}def}bd
]
[    /cg_miaiproc{pop pop/ImageDataSource{cg_aiproc}def}bd
]
[}{
]
[    /ImageBandMask 0 def
]
[    /ImageBandData 0 def
]
[    /cg_mibiproc{
]
[   string/ImageBandMask xs
]
[   string/ImageBandData xs
]
[   /ImageDataSource{[currentfile/RunLengthDecode filter dup ImageBandMask/readstring cvx
]
[       /pop cvx dup ImageBandData/readstring cvx/pop cvx]cvx bind}bd
]
[    }bd
]
[    /cg_miaiproc{  
]
[   string/ImageBandMask xs
]
[   string/ImageBandData xs
]
[   /ImageDataSource{[currentfile/ASCII85Decode filter/RunLengthDecode filter
]
[       dup ImageBandMask/readstring cvx
]
[       /pop cvx dup ImageBandData/readstring cvx/pop cvx]cvx bind}bd
]
[    }bd
]
[}ifelse
]
[/imsave 0 def
]
[/BI{save/imsave xd mark}bd
]
[/EI{imsave restore}bd
]
[/ID{
]
[counttomark 2 idiv
]
[dup 2 add  % leave room for imagetype and imagematrix
]
[dict begin
]
[{def} repeat
]
[pop        % remove mark
]
[/ImageType 1 def
]
[/ImageMatrix[Width 0 0 Height neg 0 Height]def
]
[currentdict dup/ImageMask known{ImageMask}{F}ifelse exch
]
[% currentdict on stack
]
[L3?{
]
[    dup/MaskedImage known
]
[    { 
]
[   pop
]
[   <<
]
[       /ImageType 3
]
[       /InterleaveType 2
]
[       /DataDict currentdict
]
[       /MaskDict
]
[       <<  /ImageType 1
]
[       /Width Width
]
[       /Height Height
]
[       /ImageMatrix ImageMatrix
]
[       /BitsPerComponent 1
]
[       /Decode [0 1]
]
[       currentdict/Interpolate known
]
[       {/Interpolate Interpolate}if
]
[       >>
]
[   >>
]
[    }if
]
[}if
]
[exch
]
[{imagemask}{image}ifelse   
]
[end    % pop imagedict from dict stack
]
[}bd
]
[
]
[/cguidfix{statusdict begin mark version end
]
[{cvr}stopped{cleartomark 0}{exch pop}ifelse
]
[2012 lt{dup findfont dup length dict begin
]
[{1 index/FID ne 2 index/UniqueID ne and
]
[{def} {pop pop} ifelse}forall
]
[currentdict end definefont pop
]
[}{pop}ifelse
]
[}bd
]
[/t_array 0 def
]
[/t_i 0 def
]
[/t_c 1 string def
]
[/x_proc{ % x y
]
[    exch t_array t_i get add exch moveto
]
[    /t_i t_i 1 add store
]
[}bd
]
[/y_proc{ % x y
]
[    t_array t_i get add moveto
]
[    /t_i t_i 1 add store
]
[}bd
]
[/xy_proc{
]
[        % x y
]
[   t_array t_i 2 copy 1 add get 3 1 roll get 
]
[   4 -1 roll add 3 1 roll add moveto
]
[   /t_i t_i 2 add store
]
[}bd
]
[/sop 0 def     % don't bind sop
]
[/cp_proc/x_proc ld     % default moveto proc is for xwidths only
]
[/base_charpath     % string array
]
[{
]
[    /t_array xs
]
[    /t_i 0 def
]
[    { % char
]
[   t_c 0 3 -1 roll put
]
[        currentpoint
]
[   t_c cply sop
]
[        cp_proc
]
[    }forall
]
[    /t_array 0 def
]
[}bd
]
[/sop/stroke ld     % default sop is stroke. Done here so we don't bind in /base_charpath 
]
[
]
[% default sop is stroke
]
[/nop{}def
]
[/xsp/base_charpath ld
]
[/ysp{/cp_proc/y_proc ld base_charpath/cp_proc/x_proc ld}bd
]
[/xysp{/cp_proc/xy_proc ld base_charpath/cp_proc/x_proc ld}bd
]
[/xmp{/sop/nop ld /cp_proc/x_proc ld base_charpath/sop/stroke ld}bd
]
[/ymp{/sop/nop ld /cp_proc/y_proc ld base_charpath/sop/stroke ld}bd
]
[/xymp{/sop/nop ld /cp_proc/xy_proc ld base_charpath/sop/stroke ld}bd
]
[/refnt{ % newname encoding fontname
]
[findfont dup length dict copy dup
]
[/Encoding 4 -1 roll put 
]
[definefont pop
]
[}bd
]
[/renmfont{ % newname fontname
]
[findfont dup length dict copy definefont pop
]
[}bd
]
[
]
[L3? dup dup{save exch}if
]
[
]
[% languagelevel2 ONLY code goes here
]
[
]
[/Range 0 def
]
[/DataSource 0 def
]
[/val 0 def
]
[/nRange 0 def
]
[/mulRange 0 def
]
[/d0 0 def
]
[/r0 0 def
]
[/di 0 def
]
[/ri 0 def
]
[/a0 0 def
]
[/a1 0 def
]
[/r1 0 def
]
[/r2 0 def
]
[/dx 0 def
]
[/Nsteps 0 def
]
[/sh3tp 0 def
]
[/ymax 0 def
]
[/ymin 0 def
]
[/xmax 0 def
]
[/xmin 0 def
]
[
]
[/setupFunEval % funDict --     % this calculates and sets up a function dict for evaulation.
]
[{
]
[    begin
]
[   /nRange Range length 2 idiv store
]
[   /mulRange   % precompute the range data needed to map a sample value from the table to a range value
]
[           % this data looks like [ range0mul range0min range1mul range1min ... rangeN-1mul rangeN-1min ]
]
[   [ 
]
[       0 1 nRange 1 sub
]
[       { % index
]
[           2 mul/nDim2 xd      % 2*dimension# we are dealing with
]
[           Range nDim2 get     % ymin
]
[           Range nDim2 1 add get   % ymin ymax 
]
[           1 index sub         % ymin (ymax-ymin)
]
[                       % xmin = 0, xmax = 255 (2^bitspersample - 1)
]
[           255 div         % ymin (ymax-ymin)/(xmax - xmin)
]
[           exch            % (ymax-ymin)/(xmax - xmin) ymin
]
[       }for
]
[   ]store
]
[    end
]
[}bd
]
[
]
[/FunEval % val1 fundict -> comp1 comp2 ... compN
]
[{
]
[    begin
]
[   % the value passed in is the base index into the table
]
[   nRange mul /val xd  % compute the actual index to the table
]
[               % since there are nRange entries per base index
]
[   0 1 nRange 1 sub
]
[   {
]
[       dup 2 mul/nDim2 xd % dim
]
[       val % base value to use to do our lookup
]
[       add DataSource exch get %  lookedupval
]
[       mulRange nDim2 get mul  % lookedupval*(ymax-ymin)/(xmax-xmin)
]
[       mulRange nDim2 1 add get % lookedupval*(ymax-ymin)/(xmax-xmin) ymin
]
[       add % interpolated result
]
[   }for    % comp1 comp2 ... compN
]
[    end
]
[}bd
]
[
]
[/max % a b -> max(a, b)
]
[{
]
[   2 copy lt
]
[   {exch pop}{pop}ifelse
]
[}bd
]
[
]
[/sh2
]
[{  % emulation of shading type 2. Assumes shading dictionary is top dictionary on the dict stack
]
[   /Coords load aload pop  % x0 y0 x1 y1
]
[   3 index 3 index translate   % origin is now at beginning point of shading
]
[                   % x0 y0 x1 y1
]
[   3 -1 roll sub   % x0 x1 y1-y0
]
[   3 1 roll exch   % y1-y0 x1 x0
]
[   sub             % y1-y0 x1-x0
]
[   2 copy
]
[   dup mul exch dup mul add sqrt   % length of segment between two points
]
[   dup
]
[   scale  
]
[   atan    % atan (dy/dx)
]
[   %dup (rotation angle = )print ==
]
[   rotate      % now line between 0,0 and 1,0 is the line perpendicular to which the axial lines are drawn                 
]
[   
]
[   /Function load setupFunEval % may need to setup function dictionary by calling setupFunEval
]
[   
]
[   % this is now specific to axial shadings. Compute the maximum bounds to fill
]
[   clippath {pathbbox}stopped {0 0 0 0}if newpath  % x0 y0 x1 y1
]
[   /ymax xs
]
[   /xmax xs
]
[   /ymin xs
]
[   /xmin xs
]
[   currentdict/Extend known
]
[   {
]
[       /Extend load 0 get
]
[       {   
]
[           0/Function load FunEval sc  % evaluate the function to get a color and set it
]
[           xmin ymin xmin abs ymax ymin sub rectfill
]
[       }if
]
[   }if
]
[   % paint the rects. The sampling frequency is that of our table
]
[   /Nsteps/Function load/Size get 0 get 1 sub store
]
[   /dx 1 Nsteps div store
]
[   gsave
]
[       /di ymax ymin sub store
]
[       /Function load
]
[       % loop Nsteps + 1 times, incrementing the index by 1 each time
]
[       0 1 Nsteps
]
[       {
]
[           1 index FunEval sc
]
[           0 ymin dx di rectfill
]
[           dx 0 translate
]
[       }for
]
[       pop % pop our function
]
[   grestore    % origin is back to start point
]
[   currentdict/Extend known
]
[   {
]
[       /Extend load 1 get
]
[       {   
]
[           Nsteps/Function load FunEval sc % last element
]
[           1 ymin xmax 1 sub abs ymax ymin sub rectfill
]
[       }if
]
[   }if
]
[}bd
]
[
]
[/shp   % this paints our shape for shading type 3
]
[{  % x1 r1 x0 r0 -
]
[   4 copy
]
[
]
[   % fill interior arc
]
[   dup 0 gt{
]
[       0 exch a1 a0 arc
]
[   }{
]
[       pop 0 moveto
]
[   }ifelse
]
[
]
[   dup 0 gt{
]
[       0 exch a0 a1 arcn
]
[   }{
]
[       pop 0 lineto
]
[   }ifelse
]
[   
]
[   fill
]
[
]
[   % fill exterior arc
]
[   dup 0 gt{
]
[       0 exch a0 a1 arc
]
[   }{
]
[       pop 0 moveto
]
[   }ifelse
]
[
]
[   dup 0 gt{
]
[       0 exch a1 a0 arcn
]
[   }{
]
[       pop 0 lineto
]
[   }ifelse
]
[   
]
[   fill
]
[}bd
]
[
]
[/calcmaxs
]
[{  % calculate maximum distance vector from origin to corner points
]
[   % of bbox
]
[   xmin dup mul ymin dup mul add sqrt      % (xmin2 + ymin2)
]
[   xmax dup mul ymin dup mul add sqrt      % (xmax2 + ymin2)
]
[   xmin dup mul ymax dup mul add sqrt      % (xmin2 + ymax2)
]
[   xmax dup mul ymax dup mul add sqrt      % (xmax2 + ymax2)
]
[   max max max                             % maximum value
]
[}bd
]
[
]
[/sh3
]
[{  % emulation of shading type 3. Assumes shading dictionary is top dictionary on the dict stack
]
[   /Coords load aload pop  % x0 y0 r1 x1 y1 r2
]
[   5 index 5 index translate   % origin is now at first circle origin
]
[   3 -1 roll 6 -1 roll sub     % y0 r1 y1 r2 dx
]
[   3 -1 roll 5 -1 roll sub     % r1 r2 dx dy
]
[   2 copy dup mul exch dup mul add sqrt
]
[   /dx xs                      % r1 r2 dx dy
]
[   2 copy 0 ne exch 0 ne or
]
[   {
]
[       % r1 r2 dx dy
]
[       exch atan rotate    % we are now rotated so dy is zero and positive values of dx move us as expected
]
[   }{
]
[       pop pop
]
[   }ifelse
]
[   % r1 r2     
]
[   /r2 xs
]
[   /r1 xs
]
[   /Function load 
]
[   dup/Size get 0 get 1 sub    % this is the size of our table minus 1
]
[   /Nsteps xs      % at some point we should optimize this better so NSteps is based on needed steps for the device
]
[   setupFunEval        % may need to setup function dictionary by calling setupFunEval
]
[   % determine the case:
]
[   % case 0: circle1 inside circle2
]
[   % case 1: circle 2 inside circle 1
]
[   % case 2: r1 = r2 
]
[   % case 3: r1 != r2
]
[   dx r2 add r1 lt{
]
[       % circle 2 inside of circle 1
]
[       0 
]
[   }{
]
[       dx r1 add r2 le
]
[       { % circle 1 inside of circle 2
]
[           1
]
[       }{ % circles don't contain each other
]
[           r1 r2 eq
]
[           {   % equal
]
[               2
]
[           }{ % r1 != r2
]
[               3
]
[           }ifelse     
]
[       }ifelse
]
[   }ifelse
]
[   /sh3tp xs       % sh3tp has the number of our different cases
]
[   clippath {pathbbox}stopped {0 0 0 0}if 
]
[   newpath     % x0 y0 x1 y1
]
[   /ymax xs
]
[   /xmax xs
]
[   /ymin xs
]
[   /xmin xs
]
[
]
[   % Arc angle atan( sqrt((dx*dx + dy*dy) - dr*dr), dr)
]
[   dx dup mul r2 r1 sub dup mul sub dup 0 gt
]
[   {
]
[       sqrt r2 r1 sub atan
]
[       /a0 exch 180 exch sub store 
]
[       /a1 a0 neg store 
]
[   }{
]
[       pop
]
[       /a0 0 store
]
[       /a1 360 store       
]
[   }ifelse     
]
[
]
[   currentdict/Extend known
]
[   {
]
[       /Extend load 0 get r1 0 gt and  % no need to extend if the radius of the first end is 0
]
[       {   
]
[           0/Function load FunEval sc  % evaluate the function to get a color and set it
]
[           % case 0: circle1 inside circle2
]
[           % case 1: circle 2 inside circle 1
]
[           % case 2: circles don't contain each other and r1 == r2
]
[           % case 3: circles don't contain each other and r1 != r2
]
[           { 
]
[               {   % case 0
]
[                   dx 0 r1 360 0 arcn
]
[                   xmin ymin moveto
]
[                   xmax ymin lineto
]
[                   xmax ymax lineto
]
[                   xmin ymax lineto
]
[                   xmin ymin lineto
]
[                   eofill      % for the bigger radius we fill everything except our circle
]
[               }
]
[               {   % case 1
]
[                   r1 0 gt{0 0 r1 0 360 arc fill}if
]
[               }
]
[               {   % case 2
]
[                   % r1 == r2, extend 0
]
[                   % r3 = r, x3 = -(abs(minx) + r), x1 = 0
]
[               
]
[                   % x(i+1) r(i+1) x(i) r(i) shp
]
[                   0 r1 xmin abs r1 add neg r1 shp
]
[               }
]
[               {   % case 3
]
[                   % no containment, r1 != r2
]
[               
]
[                   r2 r1 gt{   % the endpoint we are drawing is that with a circle of zero radius
]
[                       % x(i+1) r(i+1) x(i) r(i) shp
]
[                       0 r1
]
[                       r1 neg r2 r1 sub div dx mul % this is point of beginning circle
]
[                       0   % point of ending circle
]
[                       shp % takes x(i+1) r(i+1) x(i) r(i)
]
[                   }{  % the first circle is the bigger of the two
]
[                       % we find a circle on our line which is outside the bbox in the
]
[                       % negative direction
]
[                       % x(i+1) r(i+1) x(i) r(i) shp
]
[                       0 r1 calcmaxs   % 0 r1 maxs
]
[                       dup
]
[                       % calculating xs: (-(maxs+r2)*x2)/(x2-(r1-r2))
]
[                       r2 add dx mul dx r1 r2 sub sub div
]
[                       neg             % maxs xs'
]
[                       exch 1 index    % xs' maxs xs'
]
[                       abs exch sub
]
[                       shp
]
[                   }ifelse
]
[               } 
]
[           }sh3tp get exec % execute the extend at beginning proc for our shading type
]
[       }if
]
[   }if
]
[
]
[   % now do the shading
]
[   /d0 0 store
]
[   /r0 r1 store
]
[   /di dx Nsteps div store
]
[   /ri r2 r1 sub Nsteps div store 
]
[   /Function load 
]
[   0 1 Nsteps
]
[   {   % function t(i)
]
[       1 index FunEval sc
]
[       d0 di add r0 ri add d0 r0 shp
]
[       {
]
[       % fill interior arc
]
[       d0 0 r0 a1 a0 arc
]
[       d0 di add 0 r0 ri add a0 a1 arcn
]
[       fill
]
[       
]
[       % fill exterior arc
]
[       d0 0 r0 a0 a1 arc
]
[       d0 di add 0 r0 ri add a1 a0 arcn
]
[       fill
]
[       }pop
]
[       
]
[       % advance to next
]
[       /d0 d0 di add store
]
[       /r0 r0 ri add store
]
[   }for
]
[   pop % pop our function dict
]
[
]
[   % handle Extend
]
[   currentdict/Extend known
]
[   {
]
[       /Extend load 1 get r2 0 gt and  % no need to extend if the radius of the last end is 0
]
[       {   
]
[           Nsteps/Function load FunEval sc % last element
]
[           % case 0: circle1 inside circle2
]
[           % case 1: circle 2 inside circle 1
]
[           % case 2: circles don't contain each other and r1 == r2
]
[           % case 3: circles don't contain each other and r1 != r2
]
[           { 
]
[               {
]
[                   dx 0 r2 0 360 arc fill
]
[               } 
]
[               {
]
[                   dx 0 r2 360 0 arcn
]
[                   xmin ymin moveto
]
[                   xmax ymin lineto
]
[                   xmax ymax lineto
]
[                   xmin ymax lineto
]
[                   xmin ymin lineto
]
[                   eofill      % for the bigger radius we fill everything except our circle
]
[               } 
]
[               {   % r1 == r2, extend 1
]
[                   % r3 = r, x3 = (abs(xmax) + r), x1 = dx
]
[                   % x(i+1) r(i+1) x(i) r(i) shp
]
[                   xmax abs r1 add r1 dx r1 shp
]
[               }   
]
[               {   % no containment, r1 != r2
]
[           
]
[                   r2 r1 gt{
]
[                       % we find a circle on our line which is outside the bbox in the
]
[                       % positive direction
]
[                       % x(i+1) r(i+1) x(i) r(i) shp
]
[                       calcmaxs dup    % maxs maxs
]
[                       % calculating xs: ((maxs+r1)*x2)/(x2-(r2-r1))
]
[                       r1 add dx mul dx r2 r1 sub sub div  % maxs xs
]
[                       exch 1 index    % xs maxs xs
]
[                       exch sub
]
[                       dx r2
]
[                       shp
]
[                   }{  % the endpoint we are drawing is that with a circle of zero radius
]
[                       % x(i+1) r(i+1) x(i) r(i) shp
]
[                       r1 neg r2 r1 sub div dx mul % this is point of ending circle
]
[                       0       % radius of ending circle
]
[                       dx      % point of starting circle
]
[                       r2      % radius of starting circle
]
[                       shp
]
[                   }ifelse
]
[               }
]
[           }           
]
[           sh3tp get exec  % execute the extend at end proc for our shading type
]
[       }if
]
[   }if
]
[}bd
]
[/sh        % emulation of shfill operator for type 2 and type 3 shadings based on type 0 functions
]
[{  % shadingDict --
]
[   begin
]
[       /ShadingType load dup dup 2 eq exch 3 eq or
]
[       {   % shadingtype
]
[           gsave
]
[               newpath
]
[               /ColorSpace load scs
]
[               currentdict/BBox known
]
[               {
]
[                   /BBox load aload pop    % llx lly urx ury
]
[                   2 index sub             % llx lly urx ury-lly
]
[                   3 index                 % llx lly urx ury-lly llx
]
[                   3 -1 roll exch sub 
]
[                   exch rectclip
]
[               }if
]
[               2 eq
]
[               {sh2}{sh3}ifelse
]
[           grestore
]
[       }{
]
[           % shadingtype
]
[           pop 
]
[           (DEBUG: shading type unimplemented\n)print flush
]
[       }ifelse
]
[   end
]
[}bd
]
[
]
[% end of language level 2 ONLY code
]
[
]
[{restore}if not dup{save exch}if
]
[% languagelevel3 ONLY code goes here
]
[   L3?{    % we do these loads conditionally or else they will fail on a level 2 printer
]
[       /sh/shfill ld
]
[       /csq/clipsave ld
]
[       /csQ/cliprestore ld
]
[   }if
]
[{restore}if
]
[
]
[%currentdict dup maxlength exch length sub (number of extra slots in md = )print == flush  % *** how many entries are free
]
[end
]
[setpacking
]
[% count 0 ne { pstack(***extras on stack during prolog execution***\n)print flush}if   % *** BARK if anything is left on stack
]
[%%EndFile
]
[%%EndProlog
]
[%%BeginSetup
]
[% Disable CTRL-D as an end-of-file marker...
]
[userdict dup(\004)cvn{}put (\004\004)cvn{}put
]
[[{
]
[%%BeginFeature: *APOptionalDuplexer True
]
[%%EndFeature
]
[} stopped cleartomark
]
[[{
]
[%%BeginFeature: *Duplex None
]
[1 dict dup /Duplex false put setpagedevice
]
[%%EndFeature
]
[} stopped cleartomark
]
[[{
]
[%%BeginFeature: *PageSize Letter
]
[2 dict dup /PageSize [612 792] put dup /ImagingBBox null put setpagedevice
]
[%%EndFeature
]
[} stopped cleartomark
]
[% x y w h ESPrc - Clip to a rectangle.
]
[userdict/ESPrc/rectclip where{pop/rectclip load}
]
[{{newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
]
[neg 0 rlineto closepath clip newpath}bind}ifelse put
]
[% x y w h ESPrf - Fill a rectangle.
]
[userdict/ESPrf/rectfill where{pop/rectfill load}
]
[{{gsave newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
]
[neg 0 rlineto closepath fill grestore}bind}ifelse put
]
[% x y w h ESPrs - Stroke a rectangle.
]
[userdict/ESPrs/rectstroke where{pop/rectstroke load}
]
[{{gsave newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
]
[neg 0 rlineto closepath stroke grestore}bind}ifelse put
]
[userdict/ESPwl{}bind put
]
[%%EndSetup
]
[%%Page: 1 1
]
[%%PageBoundingBox: 0 0 612 792
]
[%%BeginPageSetup
]
[%%EndPageSetup
]
[cg_md begin
]
[bp
]
[sdmtx
]
[%RBIBeginFontSubset: EXAWVY+.SFNS-Regular_opsz13E65F_GRAD1900000_YAXS1900000_wght2B
]
[%!FontType1-1.0: EXAWVY+.SFNS-Regular_opsz13E65F_GRAD1900000_YAXS1900000_wght2B 1.0000.1.0000
]
[14 dict begin
]
[/FontName /EXAWVY+.SFNS-Regular_opsz13E65F_GRAD1900000_YAXS1900000_wght2B def
]
[/PaintType 0 def
]
[/Encoding 256 array 0 1 255 {1 index exch/.notdef put} for
]
[dup 33 /T put
]
[dup 34 /e put
]
[dup 35 /s put
]
[dup 36 /t put
]
[dup 37 /space put
]
[dup 38 /D put
]
[dup 39 /o put
]
[dup 40 /c put
]
[readonly def
]
[42/FontType resourcestatus{pop pop false}{true}ifelse
]
[%APLsfntBegin
]
[{currentfile 0(%APLsfntEnd\n)/SubFileDecode filter flushfile}if
]
[/FontType 42 def
]
[/FontMatrix matrix def
]
[/FontBBox[2048 -853 1 index div -612 2 index div 2555 3 index div 2200 5 -1 roll div]cvx def
]
[/sfnts [<
]
[74727565000900000000000063767420000000000000009C000000046670676D00000000000000A000000004676C796600000000000000A4000004EA686561640000000000000590000000366868656100000000000005C800000024686D747800000000000005EC000000246C6F63610000000000000610000000146D61787000000000000006240000002070726570000000000000064400000004000000000000000000060064FE12079C079E00030007000B000F001300170000410101010101010101010101010101010101010101010101006407380000F8C8000007380000F8C8000007380000F8C8000007380000F8C8000007380000F8C8000007380000F8C8FE12000000CE000000F1000000CF000000F1000000CF000000F1000000CE000000F2000000CE000000F1000000CE0000000200AF0000058C05A3000A001500004101010000000100000001010100000001000000010100AF0000023800D8012E009F00000000FF60FED2FF29FEF600DA008300BB006300000000FF9FFF46FF7AFF2605A3FA5D0000000000AB014700E900E3013E00A70000FF0700000000FF93FF2FFF6AFF66FF2BFF92000000000001005C000004EC05A3000700004101010101010101033B000001B10000FB70000001B10000000004AA000000F90000FF070000FB560001005CFFE804620465001F000041000000010000000100000001000000010100000100000001000000010000010462FFF4FF86FF2DFF6EFF54FF0FFF8200000000007E00F100AC009000D3007C000CFEF0FFEFFF90FFA6FFB2FF92FFC7000000000039006D004F005D006F000F02CD007B00B8006500000000FF79FF01FF4AFF49FEFEFF7800000000006400B400790000FFAEFFA9000000000050009A006F006E0097004F00000000FF9FFFB10002005CFFE804730465000800230000410000000101000000010000010000000101010100000001000000010000000100000001026F00440065003A0003FE2A0005003F00680130FFE9FF8CFFAAFFB4FF90FFC2FFFE000002F500000000FF85FF19FF5DFF5CFF13FF7F00000000007F00EF00A8008700D300890015038C0000FFC4FF93FFB40000004B006D003DFDABFFC8FFC3000000000042007B0054000F0000005700AE00F9008500000000FF73FEFCFF4DFF4EFF01FF78000000000052009600670002005CFFE8049A0465000F001F00004100000001000000010000000100000001000000010000000100000001000000027B00AA00F3008200000000FF7CFF0DFF58FF58FF0DFF7C00000000008200F400A9FFB2FF93FFC700000000003A006D004D004D006D003A00000000FFC6FF94FFE80000008A010100B400B30101008A00000000FF75FEFFFF4EFF4DFEFEFF7600E700000051009A006D006C0099005200000000FFAE
]
[
FF67FF94FF93FF66FFAF0001005EFFE8042B0465002D00004100000101000001000000010000000101000000010000000100000101000001000000010000010100000100000000790000009E00A000C80049004200000000FFD0FFAAFFC7FFC6FFAAFFCAFFF5FEE4000A007800D30092009100DA007B00000000FF6AFF60FF31FFB4FFB700000000002F0052003400510062000B010DFFF4FF12FF2DFF77FF31FF8D030CFF81FF66FFDCFFD3FFF0FFCBFFD5FFDCFFC8FFE100000000001D003600260000FF98FF6DFFB300000000005A00A3006C007B008F0023002D00110037002A00240037001E00000000FFC1FFC90000009C00A900000000FFAAFF6400010039FFFC02ED055400190000410101010101000001000000010100000001000001010101010100E50000FF54000000AC0000000000AE00C8001C0036002E00120000FFF2FFE7FFE4FFEDFFB6FFBB0000000000E50000FF1B00000554FEEF0000FF230000FDC3FF60FF730000000000030006000400D7FFFFFFFDFFFF000000000047004A01FA000000DD00000111000000010000000100005F0E02F45F0F3CF50003080000000000D97A92B300000000D97B9E62FCABFD9C09FB08980000000300020000000000000001000007BCFE5000000A5DFCABFCAB09FB000100000000000000000000000000000009080000640210000005FB00AF0548005C04B3005C04CF005C04F5005C0488005E034D0039000000480048008700A200F9015B01B3022D0275000100000009008E00070066000500010000000000000000000000000004000300000000
]
[00>] def
]
[/CharStrings 9 dict dup begin
]
[/.notdef 0 def
]
[/space 1 def
]
[/D 2 def
]
[/T 3 def
]
[/c 4 def
]
[/e 5 def
]
[/o 6 def
]
[/s 7 def
]
[/t 8 def
]
[ end readonly def
]
[currentdict dup/FontName get exch definefont pop end
]
[%APLsfntEnd
]
[42/FontType resourcestatus{pop pop true}{false}ifelse
]
[{currentfile 0(%APLT1End\n)/SubFileDecode filter flushfile}if
]
[/FontType 1 def
]
[/FontMatrix [ 0.00048828125 0 0 0.00048828125 0 0 ] readonly def
]
[/FontBBox {-853 -612 2555 2200} readonly def
]
[/UniqueID 4393972 def
]
[currentdict end
]
[currentfile eexec
]
[54544758EC884CF30C3CD503CEDBFF3839C47C3C3333173232E3FDBFF439491DB843E1924E63AA7726BBB0485AB56D93D8C0906F647A47162891E73FFC2A9873C4B1EAC5EEBDFFC4D06084FBD84139DF4583C6E259D10699944D1068C9C45667DCCCFB9B7EA01B606435EDCBD273ABAC093D14085CCBAC149BD7382E842CFE0D7FE4FD2EF589A2471F6074A80A8B675C2F7A50D63AC1EF90D787BADD11633CB01CF6EE3B37AAF9078A69AC4740E9B6525D78BBD839551A1CB80DB8682FA5E87591BBD6EE8B946063A2A58D9CA3685AB305495DC5FB5747EB8A9A059C4976C0FE4EEAB1D56FF47F1E9664ED9F4A7DAB763AF92B2F6CF2FA7DEC24710E0B9096E30F772BA7FEA9BDBE496C42ED2CEB58F54E80BDF57CE7B4DB6CCFE7182F43BF93CCA0767AF95D62C5D2C3DC6AE1E6D139F51A2C63432117F1714C5566572EE9967A715420ABDCD1D7BD74F8450B89965FCC81C6ACA565C5F3CCF91D430D1F953E4F1A645300A98DD8C47CD64555F08F422340A85404EAE0D3229C4F9336B9470CACBD6BBF3395104750A915CC6EAAC197668267B8C62D2764C8CD69FD937CA3C924D997A0EDE7964BEB9EA2F92EF70C5E5DA0AA55675454E59AEC12A68086DDD95476477C46AE143377694529C58844212FC811560E27EEE2CF00BCB28A34314447AEE989C9D5F058EB91AA64CFFCFD907A0DD23543824F70EFBD78008B6EE8CF9ABBA04C4AAD6320B5B5A0EC590A93CCE8B6003161E91D037DD43F79630FD8DA247C2A27152B3DC5A446661DC7E7EBE4B61851430B8DC83D5B1F268B2168844BE083BE7D8262651D8B9ECB95AC56B220D334645B507095CAC7203618C90D868725485C2149959A43B3BC72DD9C69A6E03B7EFB5DB1AA63152B841C84E58FE917E555EFBB1C3345E8337CC23EC47C9274DC19406631C146C59C175860CA320D03AC8DA24C6E2FDB8C76CDA769C3D0FEA6513906CEDC63BD2ACF7E27478025BFB93B106215A296C12B541C9461636911BFA6847B455A70B79CC3AA810D39976059538463BA8BED5D33278FE37FC0013E2FFB203B306D520677ED62B6B66AB2F5E328B825E6F606549CA01C41B50F24CA2F1DE0A1A1DA83A54243EB7AE96EBD5CAA4ED078FF07C312849E848286AAAF1D61215E128F3FE43092E4D5B7B77560CD0E93F249DD6DC5A9EF75CEB2A89A6907C4D49AD4FB920B18318DEF391766A9B196542FE92DA0D4431F17CF2DE9390B44D755012EAB20883AE53901DEAC565BEAC0E00B5058C916E2E746B959E2618F457D62BD9D0C61309587667994910EC23C0B0DCD30C6D732EA66035B1AAA5B2AD083D52FED0C55EDF5A93884AF441EFB6055EA414843D78D4A665BE96389DD667178BFB3A40555C0EFB71485D15134535229443C4A149DDC19E405231B4D54B7C7CA593CDC99B95BAC820FCCB05EA2194906
]
[
C450907F3928610902E3FD9BDAA2A70111388E000C3DB08F71B43B1FC409FD0A4EC587AF77736759AA3843D32993D3A1E43E8B21E9FF4B427D13B8F8B660551D74B465A7F7633DB36FA51113C3782A0DA58BA3AF80E11F54B19F89F55318628FA8CCD5281D5856D9A0DE9A0DC5B16716E5453E3CAE8FC3369244AB44D3647B9AF3F153946DE8A6F95968470B89F5915FFA4973E5351741944CFE51573A0AF860738866CC3423DFE00B59D35EA494376E7AC32CDAB6D0DB20EC30EF1AD7A651A3693B667C70C7BC521047FCACCB25E59C183F3BBD347B40F7CC87E1A3CE86F61556071418E09AE7FD58643867AF6E46805BC0BBC136C104D637231A0D04583724E68360D5259050246831E0EFC7FAF9A7525EDA594EE5F57FF85E14292313459EBDCAD35E2A3A0D81DFCA953890FB5EF9062C36C3E71B546BB1185190112BE5BF9EA9F068E76D681E22146AF47B029321A23F2A2233FC5F415B8A1AFCE2624E1D5114AD1CF9C7EFA799AE33FE7646857229F7A6F5516CD405EACC09CDA970D239CACAC8E6C3AE7D4588E3A004B6A2A155F5E2E27133F157C16F580E259F6C70167126F8BDDA4B2E8A89DFAA8EAA44FC13652C81B20379F08D46B9567502B34DC869EF0D16F7A2308CD9B5EA6A62DB1A1C537797BB01D4B1316F4AE2ADDCE021CF561D250F871C57EC65665462BE38E95C7A028EE41D0E6257E44F01BD0BBAEA72F663C628C3367C75CB68639EDEF7E4E85FC8956259CF9A5A7C5AEE6588BDFF88AF69C570B4F693D78CCDB3210FCDCE192FA653696014E6D679BCB4E728F19DA3BDEAA42E05648940055E9A8A58549E0C95F1A278945BCF9E204843D77C60818375A733B0512B5D7CDEBC12B0A56694C8FB8FF7290B7433037D2B7F53A0FC4DC803F66E32124BE03DFA64816AA4E98C000124CE3E9419837E608C4573F02F24276890F22A7AD979944E83BDF5378352A95A4382B42EB394E9373F47B40ECA4B69F20184D3ED8004681968A4E2F6B21402FD04BF79CDCF28B20909F381A0F0E3ED3EED031B1F8D90C9F30AE8F47CFFCD1A3FA60AD3A10287F036F582C4C4F042D0B5FCE60C97FD22D5FF74234326B029896F3002C3CE998F5123CF7B001BF76DC0F72CE2CBCB7AAB39CAB47F370857EDE5A6D1C610DD06D4A86CD49566D5012AEB53208205AFB057EC936191D4C1B435265814DB05DF5536B5265A5AA14D99D7DD5BD2B466D7A8F5BD173566F9489A68BDA09135923EC1450F23E334137EE29F824B8019629C2B177F428F05BBBE691718219421194DABBE3ED8B690B7F0A76FA9699439783E632DE266F2882E8C92688499AFAC3988A1396BDF89
]
[
0000000000000000000000000000000000000000000000000000000000000000
]
[0000000000000000000000000000000000000000000000000000000000000000
]
[0000000000000000000000000000000000000000000000000000000000000000
]
[0000000000000000000000000000000000000000000000000000000000000000
]
[0000000000000000000000000000000000000000000000000000000000000000
]
[0000000000000000000000000000000000000000000000000000000000000000
]
[0000000000000000000000000000000000000000000000000000000000000000
]
[0000000000000000000000000000000000000000000000000000000000000000
]
[cleartomark end
]
[%APLT1End
]
[%RBIEndFontSubset
]
[/EXAWVY+.SFNS-Regular_opsz13E65F_GRAD1900000_YAXS1900000_wght2B cguidfix
]
[/F1.1/EXAWVY+.SFNS-Regular_opsz13E65F_GRAD1900000_YAXS1900000_wght2B renmfont
]
[[ /CIEBasedABC 4 dict dup begin 
]
[/WhitePoint [ 0.9505 1.0000 1.0891 ] def 
]
[/DecodeABC [ 
]
[{ 1.0 0.0 3 -1 roll 1 index 1 index le { exch pop} { pop } ifelse 
]
[ 1 index 1 index ge { exch pop } { pop } ifelse < 
]
[0000000000000000000000000000000000000000000000000000000000000000
]
[0000000000000000000000000000000000000001010101010101010101010101
]
[0101010101010101010101010101010101010101010101020202020202020202
]
[0202020202020202020202020202020202030303030303030303030303030303
]
[0303030303030304040404040404040404040404040404040404050505050505
]
[0505050505050505050506060606060606060606060606060607070707070707
]
[0707070707070708080808080808080808080808090909090909090909090909
]
[0a0a0a0a0a0a0a0a0a0a0a0b0b0b0b0b0b0b0b0b0b0b0c0c0c0c0c0c0c0c0c0c
]
[0d0d0d0d0d0d0d0d0d0d0e0e0e0e0e0e0e0e0e0f0f0f0f0f0f0f0f0f10101010
]
[1010101010111111111111111112121212121212121313131313131313141414
]
[1414141414151515151515151616161616161616171717171717171818181818
]
[18181919191919191a1a1a1a1a1a1a1b1b1b1b1b1b1c1c1c1c1c1c1c1d1d1d1d
]
[1d1d1e1e1e1e1e1e1f1f1f1f1f1f202020202020212121212121222222222223
]
[2323232323242424242425252525252526262626262727272727282828282829
]
[292929292a2a2a2a2a2b2b2b2b2b2c2c2c2c2c2d2d2d2d2d2e2e2e2e2e2f2f2f
]
[2f2f303030303131313131323232323333333333343434343535353535363636
]
[36373737373838383839393939393a3a3a3a3b3b3b3b3c3c3c3c3d3d3d3d3e3e
]
[3e3e3f3f3f3f4040404041414141424242424343434444444445454545464646
]
[4647474748484848494949494a4a4a4b4b4b4b4c4c4c4d4d4d4d4e4e4e4f4f4f
]
[4f50505051515151525252535353535454545555555656565657575758585859
]
[59595a5a5a5a5b5b5b5c5c5c5d5d5d5e5e5e5f5f5f6060606061616162626263
]
[63636464646565656666666767676868686969696a6a6a6b6b6b6c6c6d6d6d6e
]
[6e6e6f6f6f707070717171727273737374747475757576767677777878787979
]
[797a7a7b7b7b7c7c7c7d7d7e7e7e7f7f7f808081818182828283838484848585
]
[86868687878888888989898a8a8b8b8b8c8c8d8d8d8e8e8f8f90909091919292
]
[9293939494949595969697979798989999999a9a9b9b9c9c9c9d9d9e9e9f9f9f
]
[a0a0a1a1a2a2a3a3a3a4a4a5a5a6a6a6a7a7a8a8a9a9aaaaabababacacadadae
]
[aeafafb0b0b0b1b1b2b2b3b3b4b4b5b5b6b6b6b7b7b8b8b9b9bababbbbbcbcbd
]
[bdbebebebfbfc0c0c1c1c2c2c3c3c4c4c5c5c6c6c7c7c8c8c9c9cacacbcbcccc
]
[cdcdcececfcfd0d0d1d1d2d2d3d3d4d4d5d5d6d6d7d7d8d8d9d9dadadbdcdcdd
]
[dddededfdfe0e0e1e1e2e2e3e3e4e4e5e6e6e7e7e8e8e9e9eaeaebebecededee
]
[eeefeff0f0f1f1f2f3f3f4f4f5f5f6f6f7f8f8f9f9fafafbfcfcfdfdfefeffff
]
[>  dup length 1 sub 3 -1 roll mul dup dup floor cvi exch ceiling 
]
[ cvi 3 index exch get 4 -1 roll 3 -1 roll get
]
[ dup 3 1 roll sub 3 -1 roll dup floor cvi sub mul add 255 div } bind 
]
[
]
[{ 1.0 0.0 3 -1 roll 1 index 1 index le { exch pop} { pop } ifelse 
]
[ 1 index 1 index ge { exch pop } { pop } ifelse < 
]
[0000000000000000000000000000000000000000000000000000000000000000
]
[0000000000000000000000000000000000000001010101010101010101010101
]
[0101010101010101010101010101010101010101010101020202020202020202
]
[0202020202020202020202020202020202030303030303030303030303030303
]
[0303030303030304040404040404040404040404040404040404050505050505
]
[0505050505050505050506060606060606060606060606060607070707070707
]
[0707070707070708080808080808080808080808090909090909090909090909
]
[0a0a0a0a0a0a0a0a0a0a0a0b0b0b0b0b0b0b0b0b0b0b0c0c0c0c0c0c0c0c0c0c
]
[0d0d0d0d0d0d0d0d0d0d0e0e0e0e0e0e0e0e0e0f0f0f0f0f0f0f0f0f10101010
]
[1010101010111111111111111112121212121212121313131313131313141414
]
[1414141414151515151515151616161616161616171717171717171818181818
]
[18181919191919191a1a1a1a1a1a1a1b1b1b1b1b1b1c1c1c1c1c1c1c1d1d1d1d
]
[1d1d1e1e1e1e1e1e1f1f1f1f1f1f202020202020212121212121222222222223
]
[2323232323242424242425252525252526262626262727272727282828282829
]
[292929292a2a2a2a2a2b2b2b2b2b2c2c2c2c2c2d2d2d2d2d2e2e2e2e2e2f2f2f
]
[2f2f303030303131313131323232323333333333343434343535353535363636
]
[36373737373838383839393939393a3a3a3a3b3b3b3b3c3c3c3c3d3d3d3d3e3e
]
[3e3e3f3f3f3f4040404041414141424242424343434444444445454545464646
]
[4647474748484848494949494a4a4a4b4b4b4b4c4c4c4d4d4d4d4e4e4e4f4f4f
]
[4f50505051515151525252535353535454545555555656565657575758585859
]
[59595a5a5a5a5b5b5b5c5c5c5d5d5d5e5e5e5f5f5f6060606061616162626263
]
[63636464646565656666666767676868686969696a6a6a6b6b6b6c6c6d6d6d6e
]
[6e6e6f6f6f707070717171727273737374747475757576767677777878787979
]
[797a7a7b7b7b7c7c7c7d7d7e7e7e7f7f7f808081818182828283838484848585
]
[86868687878888888989898a8a8b8b8b8c8c8d8d8d8e8e8f8f90909091919292
]
[9293939494949595969697979798989999999a9a9b9b9c9c9c9d9d9e9e9f9f9f
]
[a0a0a1a1a2a2a3a3a3a4a4a5a5a6a6a6a7a7a8a8a9a9aaaaabababacacadadae
]
[aeafafb0b0b0b1b1b2b2b3b3b4b4b5b5b6b6b6b7b7b8b8b9b9bababbbbbcbcbd
]
[bdbebebebfbfc0c0c1c1c2c2c3c3c4c4c5c5c6c6c7c7c8c8c9c9cacacbcbcccc
]
[cdcdcececfcfd0d0d1d1d2d2d3d3d4d4d5d5d6d6d7d7d8d8d9d9dadadbdcdcdd
]
[dddededfdfe0e0e1e1e2e2e3e3e4e4e5e6e6e7e7e8e8e9e9eaeaebebecededee
]
[eeefeff0f0f1f1f2f3f3f4f4f5f5f6f6f7f8f8f9f9fafafbfcfcfdfdfefeffff
]
[>  dup length 1 sub 3 -1 roll mul dup dup floor cvi exch ceiling 
]
[ cvi 3 index exch get 4 -1 roll 3 -1 roll get
]
[ dup 3 1 roll sub 3 -1 roll dup floor cvi sub mul add 255 div } bind 
]
[
]
[{ 1.0 0.0 3 -1 roll 1 index 1 index le { exch pop} { pop } ifelse 
]
[ 1 index 1 index ge { exch pop } { pop } ifelse < 
]
[0000000000000000000000000000000000000000000000000000000000000000
]
[0000000000000000000000000000000000000001010101010101010101010101
]
[0101010101010101010101010101010101010101010101020202020202020202
]
[0202020202020202020202020202020202030303030303030303030303030303
]
[0303030303030304040404040404040404040404040404040404050505050505
]
[0505050505050505050506060606060606060606060606060607070707070707
]
[0707070707070708080808080808080808080808090909090909090909090909
]
[0a0a0a0a0a0a0a0a0a0a0a0b0b0b0b0b0b0b0b0b0b0b0c0c0c0c0c0c0c0c0c0c
]
[0d0d0d0d0d0d0d0d0d0d0e0e0e0e0e0e0e0e0e0f0f0f0f0f0f0f0f0f10101010
]
[1010101010111111111111111112121212121212121313131313131313141414
]
[1414141414151515151515151616161616161616171717171717171818181818
]
[18181919191919191a1a1a1a1a1a1a1b1b1b1b1b1b1c1c1c1c1c1c1c1d1d1d1d
]
[1d1d1e1e1e1e1e1e1f1f1f1f1f1f202020202020212121212121222222222223
]
[2323232323242424242425252525252526262626262727272727282828282829
]
[292929292a2a2a2a2a2b2b2b2b2b2c2c2c2c2c2d2d2d2d2d2e2e2e2e2e2f2f2f
]
[2f2f303030303131313131323232323333333333343434343535353535363636
]
[36373737373838383839393939393a3a3a3a3b3b3b3b3c3c3c3c3d3d3d3d3e3e
]
[3e3e3f3f3f3f4040404041414141424242424343434444444445454545464646
]
[4647474748484848494949494a4a4a4b4b4b4b4c4c4c4d4d4d4d4e4e4e4f4f4f
]
[4f50505051515151525252535353535454545555555656565657575758585859
]
[59595a5a5a5a5b5b5b5c5c5c5d5d5d5e5e5e5f5f5f6060606061616162626263
]
[63636464646565656666666767676868686969696a6a6a6b6b6b6c6c6d6d6d6e
]
[6e6e6f6f6f707070717171727273737374747475757576767677777878787979
]
[797a7a7b7b7b7c7c7c7d7d7e7e7e7f7f7f808081818182828283838484848585
]
[86868687878888888989898a8a8b8b8b8c8c8d8d8d8e8e8f8f90909091919292
]
[9293939494949595969697979798989999999a9a9b9b9c9c9c9d9d9e9e9f9f9f
]
[a0a0a1a1a2a2a3a3a3a4a4a5a5a6a6a6a7a7a8a8a9a9aaaaabababacacadadae
]
[aeafafb0b0b0b1b1b2b2b3b3b4b4b5b5b6b6b6b7b7b8b8b9b9bababbbbbcbcbd
]
[bdbebebebfbfc0c0c1c1c2c2c3c3c4c4c5c5c6c6c7c7c8c8c9c9cacacbcbcccc
]
[cdcdcececfcfd0d0d1d1d2d2d3d3d4d4d5d5d6d6d7d7d8d8d9d9dadadbdcdcdd
]
[dddededfdfe0e0e1e1e2e2e3e3e4e4e5e6e6e7e7e8e8e9e9eaeaebebecededee
]
[eeefeff0f0f1f1f2f3f3f4f4f5f5f6f6f7f8f8f9f9fafafbfcfcfdfdfefeffff
]
[>  dup length 1 sub 3 -1 roll mul dup dup floor cvi exch ceiling 
]
[ cvi 3 index exch get 4 -1 roll 3 -1 roll get
]
[ dup 3 1 roll sub 3 -1 roll dup floor cvi sub mul add 255 div } bind 
]
[] def 
]
[/MatrixABC [ 0.4124 0.2126 0.0193 0.3576 0.7151 0.1192 0.1805 0.0722 0.9508 ] def 
]
[/RangeLMN [ 0.0 0.9505 0.0 1.0000 0.0 1.0891 ] def 
]
[end ] /Cs1 exch/ColorSpace dr pop
]
[%%EndPageSetup
]
[/Cs1 SC
]
[1 1 1 sc
]
[q
]
[54 149.6732 504 588.32678 rc
]
[54 738 m
]
[558 738 l
]
[558 149.6732 l
]
[54 149.6732 l
]
[h
]
[f
]
[Q
]
[0.27058819 0.27058819 0.27058819 sc
]
[q
]
[55.96109 149.6732 500.07779 556.9494 rc
]
[0.98054469 0 0 -0.98054469 54 738 cm
]
[/F1.1[ 17 0 0 -17 0 0]sf
]
[23 48 m
]
[(!"#$%&'\()[ 9.254800 9.832800 9.203800 6.619800 4.001800 12.314800 10.138800 0.000000 ] xS
]
[ep
]
[end
]
[%%Trailer
]
[%%Pages: 1
]
[%%BoundingBox: 0 0 612 792
]
[%%EOF
]
[]
Invalid PDF
Evidlo commented 4 years ago

It seems like Postscript is being sent instead of a PDF. The first line should be something like %!PDF-1.5, not %!PS-Adobe-3.0.

Does make install_config work on OSX?

Can you try printing from different programs? Then we can determine if this is something that should be fixed with the printer config.

Or maybe you could fiddle around in the printer settings and see if there is an option like "Generic PDF" for the printer driver.

Gozala commented 4 years ago

It seems like Postscript is being sent instead of a PDF. The first line should be something like %!PDF-1.5, not %!PS-Adobe-3.0.

Does make install_config work on OSX?

It seems that specified model is deprecated on mac

lpadmin: Printer drivers are deprecated and will stop working in a future version of CUPS.
lpadmin: Unable to copy PPD file.

Can you try printing from different programs? Then we can determine if this is something that should be fixed with the printer config.

Or maybe you could fiddle around in the printer settings and see if there is an option like "Generic PDF" for the printer driver.

I tried bunch of things, but there is no PDF printer and it appears Apple moved away for this :(.

I'll try to look if there's a way to installed removed drivers onto the system.

Gozala commented 4 years ago

I found this project https://github.com/ofosos/scratch/tree/master/remarkable-cups that defines driver/filter to present remarkable as PDF device.

I have compiled it to ppd file via:

ppdc remarkable.drv

And then used remarkable.ppd as "Other" driver when setting up printer.

With this setup now I see following output on remarkable when printing

Listening on 0.0.0.0:9100
Saving PDF to /home/root/.local/share/remarkable/xochitl/3f0cd9f6-a49c-4674-8590-aa6e4a042194.pdf
[%PDF-1.3
]
[PDF begin]
Saving metadata to /home/root/.local/share/remarkable/xochitl/3f0cd9f6-a49c-4674-8590-aa6e4a042194.metadata

And things seem to work now

Evidlo commented 4 years ago

Instead of going through the GUI, can you add the printer using the ppd you generated with this command?

sudo lpadmin -p reMarkable -E -o printer-error-policy=abort-job -v socket://10.11.99.1:9100 -P remarkable.ppd

I'd like to make the 1 step installer work on OSX too.

Gozala commented 4 years ago

Yep, that works. I do however get deprecation warning:

lpadmin: Printer drivers are deprecated and will stop working in a future version of CUPS.

In my experience 10.11.99.1 only works when remarkable is connected via USB. On wifi it usually has a different IP, so I'm not sure if 1 step installer would work. I use remarkable.local that I've manually set in /etc/hosts.

Evidlo commented 4 years ago

OK, I added a simple .ppd that should work on OSX and updated the makefile as well.