Made some attempt to write the filtered PDF part. Will finish tomorrow