For more information on Blobs, see Primitive Data Types.
The following are methods for Blob.
public Integer size()
Type: Integer
String myString = 'StringToBlob'; Blob myBlob = Blob.valueof(myString); Integer size = myBlob.size();
public static Blob toPdf(String stringToConvert)
Type: Blob
String pdfContent = 'This is a test string'; Account a = new account(name = 'test'); insert a; Attachment attachmentPDF = new Attachment(); attachmentPdf.parentId = a.id; attachmentPdf.name = a.name + '.pdf'; attachmentPdf.body = blob.toPDF(pdfContent); insert attachmentPDF;
public String toString()
Type: String
String myString = 'StringToBlob'; Blob myBlob = Blob.valueof(myString); System.assertEquals('StringToBlob', myBlob.toString());