Generic converter for document types