Provide toDataUrl method for previews