Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [blob]

The tag has no usage guidance, but it has a tag wiki.

1
vote
0answers
27 views

Display a PDF in Salesforce from Blob data

For our project, we need to get a PDF via API from an external private filestore, and display it within a Lightning Component. With the blob that is returned, if I set that to the src of an iFrame, it ...
0
votes
0answers
29 views

Apex Multipart HttpRequest - With JSON and BLOB

I am trying to consume a Google Drive API to create a file in an ApexController. I was successful in creating a file in the root folder without specifying a name using the code below http h = new ...
0
votes
1answer
178 views

How do I use Blob to create a PDF in my apex controller and use it in my Lightning Component without using VisualForce Pages?

This is the apex controller: public class pdfGenerate { public static final Integer limitRecords = 10; @AuraEnabled public static Blob generatePdf(){ List&...
4
votes
1answer
129 views

How to check Blob objects for equality?

Rather disappointingly for Blobs this assertion fails: System.assert(Blob.valueOf('abc') == Blob.valueOf('abc')); though the Apex Expression Operators documentation over ambitiously says that: ...
3
votes
2answers
673 views

Unsupported mime Type when creating Blob instance into lightning community

I am having problems when I try to use the lib jsPDF in order to generate dynamic PDF documents and download them from the browser. The problem is 'Unsupported mime type'. This is due to the function ...
3
votes
1answer
401 views

Returning a blob to a lightning component split error

I have a lightning component that queries for a Static Resource and returns the body. When the lightning component receives the blob data aura throws an error This page has an error. You might ...
1
vote
1answer
116 views

MD5 Blob Cannot Convert to String

I'm attempting to generate an MD5 hash in my Apex code and having issues converting the Blob object that Crypto.generateDigest() returns back into a string. The input Blob is a just-Blob.valueOf()-...
2
votes
1answer
163 views

What Field Type should be used to assign Blob primitive data type?

I need to assign Blob value to a field. I've already tried Text and URL field types but I've got next error Illegal assignment from Blob to String. Is it possible? What field type should I choose? ...
0
votes
0answers
118 views

Convert Attachment body Blob to String - receives error Blob is not a valid UTF-8 string [duplicate]

I am trying to fetch the body of attachment and trying to update it in the "Rich Text Area" field in contact. When trying to convert blob to string I am receiving the erro "Blob is not a valid UTF-8 ...
1
vote
2answers
458 views

EROR: BLOB is not a valid UTF-8 string

We have a custom REST api that throws an error when ever we have a diacritic character as part of the JSON request. For example if the character "é" is anywhere in the JSON it errors when we convert ...
0
votes
1answer
214 views

How to Upload ContentVersion into OneDrive using Apex?

I am unable to send a png file from Salesforce ContentVersion to Microsoft OneDrive. Below is my code: for (ContentVersion cv : ListFilesToBeUploaded) { Http http = new Http(); httpRequest ...
1
vote
1answer
37 views

Why does a variable of blob type, when printed gives out it's size?

String str = 'myString'; Blob b = Blob.valueOf(str); System.debug(b); System.debug(b.size()); System.debug(str); Here if I print str then the value of str(I believe it is usingvalueOf()method ...
2
votes
1answer
1k views

Multipart form data post file with multiple form parameters?

I am gone through this post and wanted to add one more form data parameter, but when I am sending a request that parameter it not getting posted into form data, please advise what I am missing. Here ...
0
votes
1answer
75 views

How to invoke Blob setter method?

I have a class with the following getter/setter: public Blob csvFileBody{get;set;} I have a test method from where I need to invoke the blob setter from the controller class. Please advise how to ...
1
vote
0answers
661 views

Deserialize a Blob longer than 6000000?

is there a way in Apex to store data in a Blob without using JSON, for example by casting? JSON has a limit when deserializing of 6MB, and our data is sometimes more than that. The problem is that ...
0
votes
1answer
33 views

How to attach a document to Contract that has fields auto populated and formatting saved

I am trying to automatically attach a document to the Contract Object when I create the object, but with fields auto populated (think DocuSign). I've tried a few things in Apex, but keep running into ...
3
votes
1answer
112 views

Body not a variable of ContentVersion?

I am drafting up a couple of unit tests for this code. Here is what the code looks like so far: public class ContentController { public ContentController() { file = new ContentVersion(...
0
votes
1answer
173 views

getting scientific notation when converting from string to blob to save to csv

I have a long string that I want to save to CSV. I use the following code to convert the string to blob and save as a file: Attachment newFile = new Attachment(); newFile.Name = getReportFileName(); ...
0
votes
1answer
319 views

Arithmetic expressions must use numeric arguments

The following class will get the content(a maximum of 10 MB) in encode format and I convert the content into decode format based on the my requirement into three parts. Now I want to add the all three ...
3
votes
1answer
798 views

How to generate a >5 MB blob for an Apex test class

I am writing a test class for a file uploader thingamajig I wrote. The class takes a blob representing the contents of the file. So far everything is going well and I've got 93% code coverage. ...
0
votes
1answer
42 views

HttpRequest Converting > to?

I am using code (see below) that I found for sending an AWS SES message with an HttpRequest to amazon. I am able to send MIME messages with PDF attachments and all has been great. Today, I tried ...
0
votes
1answer
770 views

How to write test class on Blob method

I have a PageReference method as given below I am trying to write a test class for this it shows error. Error Message: System.NullPointerException: Argument cannot be null. Stack Trace: ...
1
vote
4answers
3k views

Send Blob file via Apex Rest Callout

I'm trying to send a Blob Apex REST callout and it is keep failing. I tried all the examples in the web but didn't work. What is the standard and correct way to send Blob data via REST callouts? //...
0
votes
2answers
4k views

Save base64 data as Attachment

This has been bugging me for a while. I think I am missing something very obvious. So from a REST api I am getting a base64 data of a PDF. I am trying to save the PDF as Attachment under an object. I ...
1
vote
1answer
731 views

Trying to show the content field (blob) from contentNote in Visualforce

Trying to show the content field (blob) from contentNote in Visualforce. All that shows is "core.filemanager.ByteBlobValue@225c5e8c". I realize that I must somehow change the blob to text, but I ...
0
votes
2answers
41 views

How to view attachment content?

I would like to see the Attachment body in plain string, but cannot find out how. For ex: Attachment a = [SELECT Id, Name, Body, ContentType, ParentId FROM Attachment WHERE ParentId = '...
1
vote
1answer
35 views

Comparing Message Authentication Codes in Apex

I'm trying to incorporate message authentication into an application I'm working on. Ideally, I need to verify that the MAC generated by the requester matches the recomputed MAC on the server side. ...
0
votes
0answers
31 views

I am getting partial image

I rendered the blob image through VF page. But I am getting partial image as attached. <apex:page controller="BlobController"> <apex:image value="data:image;base64,{!Data}" /> ...
0
votes
0answers
384 views

Resource image in to Blob for attachment

I have a trigger method after update on Opportunity. I am trying to insert attachment after closing the opp. private void createOppAttachments(list<Opportunity> opps) { Set<Id> ...
2
votes
1answer
238 views

How do I convert a Blob into an alphanumeric string and back?

There's a Blob I generated by encrypting a certain string: Blob data = Blob.valueOf('my string'); Blob encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey, data); Is there a way to ...
0
votes
1answer
429 views

Continuation pattern and JavaScript Remoting - corrupted file in the response

My current solution is working with following logic: system is calling remote action from vf page in the method there is a HttpRequest, system is calling external system, is sending file which will ...
1
vote
2answers
338 views

Is Document Body Blob field value encoded in Base64 when extracted by Dataloader? Can this encoding be used for insert or update?

I want to use Salesforce DataLoader to extract and upload Documents. However, I don't understand in which format Blob Body values are stored, is it Base64 encoded? Looks like yes, but why it is not ...
1
vote
0answers
18 views

getContent Issue on Scheduled Apex [duplicate]

Recently, I've been developing a scheduled apex class to send a csv file to an email. I was using the getContent method from a report page to achieve this. I was doing fine when executing it in ...
0
votes
1answer
90 views

Making the content in response as attachment

In one of the apex call in bound call I am receiving an xml with content in string format as part of the response. Can I store the content in the reqas a txt/xml file in the attachment of a custom ...
0
votes
1answer
1k views

Merging pdf attachments

I am trying to merge pdf attachments and sending it as email. I am able to merge them but the last pdf always get overwrite all the others and send email as one. When I checked my email attachment ...
2
votes
0answers
363 views

Not Able to Authenticate To Azure Blob Storage

I am trying to get blob from Microsoft Azure Blob Storage. But like everytime I am receiving same error. System.HttpResponse[Status=Server failed to authenticate the request. Make sure the value of ...
1
vote
1answer
1k views

Getting the Error : Failed to load PDF Document on attachment preview

I have created a Visualforce page using Jquery , I am uploading PDF file . However, Onafter successful uploading it is given me Error --- Failed to load PDF Document The VF Page involved is : <...
7
votes
1answer
3k views

How to combine multiple Blob in apex to get single Blob value

Is there a way in Apex to combine multiple Blob values and get a single Blob value? Blob b1 = Blob.valueOf('s1'); Blob b2 = Blob.valueOf('s2'); Blob b3 = Blob.valueOf('s3'); Blob combined = b1 + b2 + ...
1
vote
1answer
3k views

visualforce to create a attachment for an object

I have an object - test_Object2__c for which i am creating a VF page. What I am trying to do is get an input from user for attachment and insert that attachment in notes and attachment related list of ...
0
votes
2answers
269 views

Trying to upload attachment blob to Egnyte REST API

I am having an issue specifically trying to upload an attachment blob to Egnyte using the REST API. Code is below. Any input is appreciated, I am guessing my POST is missing something but I can't see ...
0
votes
1answer
496 views

Passing a bigger file from VF to Apex Controller

I created a page that passes a file from the VF to the Controller. It's working fine, except when the file is bigger I hit the blob limit in the controller. What I do: On the front end I convert the ...
0
votes
1answer
117 views

List out of bound exception at List<Blob>

I have below piece of code where I get below error. Here b is the List of blobs. Error List index out of bounds: 3 Apex Code for(integer i = 0; i <counter; i++) { Messaging....
0
votes
1answer
76 views

Null Pointer exception to add blob to list of blob

I have below piece of code where I am getting a Null pointer exception adding blob to a list of blobs. Can someone let me know my mistake please? Apex code counter=1; form = integer.valueof(...
0
votes
1answer
75 views

Multiple blob creation for creating multiple PDFs

I have below piece of code to generate a PDF file. I have a requirement to create multiple blobs for multiple PDFs. I am trying to do so but not working as expected. Apex code PageReference pageRef =...
10
votes
1answer
5k views

Why is String.valueOf(Blob) different that Blob.toString()?

I am working on a REST Service that will desiralize the request body and interpret it. My understanding was that calling String.valueOf(objectInstance) would just call objectInstance.toString(). ...
1
vote
2answers
1k views

Alternative to renderas PDF for converting an HTML to PDF in apex

Is there any alternative or work around to HTML to PDF convert in apex? Please help and provide your suggestions.
0
votes
1answer
58 views

how to declare a Class for Attachment on a Case Object

How to Pass Blob file_body and file_Name public void uploadFile(Blob body, String name, String reqEndPoint){ String boundary = 'fddfed232323'; String header = '--'+boundary+'\r\...
2
votes
1answer
481 views

Fahrenheit symbol (°F) causing “BLOB is not a valid UTF-8 string” exception

The requirement I'm working on requires to read a CSV file with temperature measurements. But Fahrenheit or Celcius symbols are causing exceptions when converting csv blob file to string using ...
1
vote
1answer
374 views

How to retrieve BLOB content from a case

We use salesforce to create different cases and we can attach the docs to a case as well. Now, i have to retrieve the attached doc from a case using REST API. I have used below query "SELECT Body ...
1
vote
3answers
2k views

Select body Of attachments

In an apex funtion - getAttachments() - i'm requesting some attachments and their body: Set<Id> attIds = new Set<Id>{id1, id2}; List<Attachment> attLst = [Select Name, Body From ...