def encodePolyData(polyData):

    if not hasattr(vtk, 'vtkCommunicator'):
        w = vtk.vtkPolyDataWriter()
        w.WriteToOutputStringOn()
        w.SetInput(polyData)
        w.Write()
        return np.frombuffer(w.GetOutputStdString(), dtype=np.int8)

    charArray = vtk.vtkCharArray()
    vtk.vtkCommunicator.MarshalDataObject(polyData, charArray)
    numpyArray = vnp.numpy_support.vtk_to_numpy(charArray)
    assert numpyArray.dtype == np.int8
    return numpyArray
tiff to pdf conversion, use tiff2pdf command (libtiff)
dataset/ETHPy150Open RobotLocomotion/director/src/python/director/geometryencoder.py/encodePolyData--crossover with--dataset/ETHPy150Open adlibre/Adlibre-DMS/adlibre_dms/libraries/adlibre/converter.py/FileConverter.tif_to_pdf