Skip to main content

Questions tagged [blob]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
5k views

Convert an apex attachment into a blob?

I am attempting to convert an apex attachment into a blob. My visualforce code is <div class="mt-5 row"> <div class="d-flex justify-content-center col-lg-12"> <...
ccarlson's user avatar
0 votes
1 answer
799 views

Apex Error (Image to PDF conversion) : BLOB is not a valid UTF-8 string

So i have this task where i have to convert the image uploaded in Notes and Attachment object to PDF. For that i created a trigger(before insert) on Attachment object and used the below mentioned code,...
Muhammad Umer's user avatar
0 votes
2 answers
3k views

Combine two different PDFs in single Visualforce page?

I have used below visualforce code to display two pdf in a single page but in the result, I am getting two different PDFs with two sections with iframe. Is it possible to combine these two PDFs in ...
Nail David's user avatar
1 vote
1 answer
661 views

Can't Convert to String some special Chars

I have a file to insert Accounts ,but some fields like account name have values with special characters like 'ñ' ,and Im having this error "BLOB is not a valid UTF-8 string" when I execute this query: ...
Dead_end_Developer's user avatar
2 votes
0 answers
505 views

Sending 100KB attachment via HTTPRequest throws System.UnexpectedException

I'm trying to upload an attachment from SF to a third party server using REST API, First, my third party does not support base64 content-transfer so I cannot send from SF a base64 attachment. ...
beMe's user avatar
  • 21
3 votes
1 answer
39k views

How to display downloaded PDF blob in an iframe?

I am using a HttpRequest to GET a PDF: http://www.example.com/path/some.pdf I am using response.getBodyAsBlob() to store the data into a ContentVersion I can view the PDF if I open the ...
Robs's user avatar
  • 9,426
0 votes
1 answer
1k views

Formatting Excel Column from Apex

I'm sending an email through the batch class with CSV file as an attachment, but the data alignment is wrong after generating CSV, I want the same alignment for all the columns. Please check the ...
Atul Rakate's user avatar
3 votes
1 answer
2k views

Display PDF with Visualforce using Lightning Experience

Is this post still valid as a solution to download a pdf from third-party site, then displaying it in a Visualforce page? This is what I'm doing in my code: Visualforce page <apex:page ...
Tyler Zika's user avatar
  • 2,922
0 votes
1 answer
824 views

Display blob value in VF page and render as PDF

I am trying to display a PDF stored in static resource and passing the blob as a string to VF page and late rendering as PDF <apex:page controller="DataDisplayController" renderAs="pdf"> {!...
SFDC's user avatar
  • 471
2 votes
1 answer
3k views

Get visualforce page pdf blob in apex

I have a visualforce page that renders as a pdf. Is there any way in apex to get that page data as a blob? I've thought about doing an Http GET request, but I feel like there should be a more direct ...
Tyler Zika's user avatar
  • 2,922
1 vote
0 answers
813 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 ...
Luke's user avatar
  • 413
0 votes
0 answers
1k 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 ...
John's user avatar
  • 21
1 vote
1 answer
10k 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&...
vedant gupta's user avatar
5 votes
1 answer
2k 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: ...
Keith C's user avatar
  • 137k
7 votes
3 answers
7k 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 ...
Jorge ortega morata's user avatar
3 votes
1 answer
2k 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 ...
TemporaryFix's user avatar
  • 3,017
7 votes
2 answers
4k 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()-...
Matthew Poer's user avatar
3 votes
1 answer
3k 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? ...
Vladyslav Soloviov's user avatar
2 votes
2 answers
4k 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 ...
mvj's user avatar
  • 21
0 votes
1 answer
984 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 ...
Prateek Garg's user avatar
1 vote
1 answer
2k 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 ...
Krishnan Mishra's user avatar
3 votes
1 answer
7k 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 ...
SFIntegrator's user avatar
0 votes
1 answer
424 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 ...
devop7's user avatar
  • 3
1 vote
0 answers
3k 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 ...
hamayoun's user avatar
  • 2,789
0 votes
1 answer
440 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 ...
Evan's user avatar
  • 158
4 votes
1 answer
775 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(...
isakbob's user avatar
  • 181
0 votes
1 answer
2k 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(); ...
Jorjani's user avatar
  • 2,242
0 votes
1 answer
1k 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 ...
KS Kumaar's user avatar
  • 763
4 votes
1 answer
3k 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. ...
ag415's user avatar
  • 253
0 votes
1 answer
106 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 ...
Ben Kass's user avatar
0 votes
1 answer
3k 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: ...
Sfmcprgmr's user avatar
  • 439
4 votes
4 answers
23k 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? //...
MalindaL's user avatar
0 votes
2 answers
20k 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 ...
Santanu Halder's user avatar
2 votes
1 answer
3k 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 ...
Merry Stambaugh's user avatar
0 votes
2 answers
374 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 = '...
BoDiE2003's user avatar
  • 477
1 vote
1 answer
50 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. ...
Brohan's user avatar
  • 457
0 votes
0 answers
1k 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> ...
Ajay 's user avatar
  • 1,609
2 votes
1 answer
905 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 ...
Sergey's user avatar
  • 551
0 votes
2 answers
980 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 ...
dan's user avatar
  • 355
2 votes
2 answers
1k 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 ...
Patlatus's user avatar
  • 17.8k
1 vote
0 answers
41 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 ...
george's user avatar
  • 13
0 votes
1 answer
635 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 ...
SfdcBat's user avatar
  • 4,839
0 votes
1 answer
6k 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 ...
Anu's user avatar
  • 3,889
2 votes
0 answers
722 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 ...
Manish Chandra's user avatar
1 vote
1 answer
5k 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 : <...
cloudy-ritz's user avatar
  • 2,593
11 votes
2 answers
13k 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 + ...
Amit Jain's user avatar
  • 827
1 vote
1 answer
5k 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 ...
SfdcBat's user avatar
  • 4,839
0 votes
2 answers
524 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 ...
ben's user avatar
  • 1
0 votes
1 answer
1k 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 ...
Arthlete's user avatar
  • 5,039
0 votes
1 answer
199 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....
Testing_SFDC's user avatar
  • 2,968