Post script printer

https://computer.howstuffworks.com/parallel-port1.htm

Default parallel port communication is One Way only so a computer can’t be used to emulate a printer.
So continue with an Arduino, which is already working on TTL level

I have used the following github, many thanks for sharing
https://github.com/boriz/CentronicsArduino
Below the adapted code.

at this point I receive the data in the serial monitor
Copy this tekst into a .ps file so you can read it with a postscript viewer.

bool init_complete = false;
bool print_in_progress = false;
bool data_ready = false;
byte data = 0;
byte buff[512];
int buff_index = 0;
long last_update;

int nStrobe = 2;
int Data0   = 3;
int Data1   = 4;
int Data2   = 5;
int Data3   = 6;
int Data4   = 7;
int Data5   = 8;
int Data6   = 9;
int Data7   = 10;
int nAck    = 11;
int Busy    = 12;
int led     = 13; // use as status led

void setup() {
  Serial.begin(9600); // open the serial port at 9600 bps:
  pinMode(Busy, OUTPUT);           // Busy - normally low
  digitalWrite(Busy, false);
  pinMode(nAck, OUTPUT);  // Ack - normally high
  digitalWrite(nAck, true);
  pinMode(nStrobe, INPUT_PULLUP); // Strobe - normally high
  attachInterrupt(digitalPinToInterrupt(nStrobe), StrobeFallingEdge, FALLING); // Attach to pin interrupt
  pinMode(Data0, INPUT_PULLUP);  // D0
  pinMode(Data1, INPUT_PULLUP);  // D1
  pinMode(Data2, INPUT_PULLUP);  // D2
  pinMode(Data3, INPUT_PULLUP);  // D3
  pinMode(Data4, INPUT_PULLUP);  // D4
  pinMode(Data5, INPUT_PULLUP);  // D5
  pinMode(Data6, INPUT_PULLUP);  // D6
  pinMode(Data7, INPUT_PULLUP);  // D7

  // Update timeout
  last_update = millis();
  Serial.println("Init Complete");
  init_complete = true;
}


void loop(){
if (data_ready){
    // Receive byte
    buff[buff_index] = data;
    buff_index++;

    // Reset data ready flag
    data_ready = false;
    
    // Ack byte, reset busy
    digitalWrite(nAck, false);  // ACK
    delayMicroseconds(7);
    digitalWrite(Busy, false);  // BUSY
    delayMicroseconds(5);
    digitalWrite(nAck, true);   // ACK

    // Reset timeout
    last_update = millis();

    // Actively printing?
    if (!print_in_progress)
    {
      // Just started printing. Create new file
//      CreateNewFile();
//      Serial.print("Receiving from printer.");
//      file_size = 0;

    }
}
}
// Strobe pin on falling edge interrupt
void StrobeFallingEdge(){
//  Serial.print("void strobe.");
  // Be sure that init sequence is completed
    if (!init_complete)
    {
      return;
    }
    
  // Set busy signal
  digitalWrite(Busy, true);
  
  // Read data from port
  data = (digitalRead(Data0) << 0) | 
         (digitalRead(Data1) << 1) | 
         (digitalRead(Data2) << 2) | 
         (digitalRead(Data3) << 3) |
         (digitalRead(Data4) << 4) |
         (digitalRead(Data5) << 5) |
         (digitalRead(Data6) << 6) |
         (digitalRead(Data7) << 7);
    Serial.print(char(data));
  // Set ready bit
  data_ready = true;    
  }