Questions tagged [blob]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
16 views

PDF Failed to Load Error while Combining Blob Data to merge Documents

I have a requirement to combine blob data to create a single PDF File, and store them in attachments. While doing so, I am not able to preview the document created, which indicate that there is ...
2
votes
0answers
61 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. ...
1
vote
1answer
81 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 ...
0
votes
1answer
16 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 ...
0
votes
0answers
39 views

Create downloadable link for HTTP Response Blob data

I am getting blob data from an external system using REST API. I want to create a downloadable link for that so that user clicks on that link and file can be downloaded without saving to Salesforce. ...
3
votes
1answer
57 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 ...
0
votes
0answers
69 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"> {!...
1
vote
1answer
102 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 ...
1
vote
0answers
106 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
225 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
795 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
287 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
1k 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
632 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 ...
5
votes
2answers
420 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
363 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? ...
1
vote
2answers
786 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
334 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
43 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
2k 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
111 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
1k 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
37 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
175 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
277 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
419 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
1k 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
44 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
1k 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
5k 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
6k 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
983 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
42 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
36 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
505 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
356 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
532 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
411 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
124 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
2k 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
438 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 : <...
8
votes
2answers
4k 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
304 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
603 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
135 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
81 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
80 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 =...