Questions tagged [blob]

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

Filter by
Sorted by
Tagged with
2 votes
0 answers
77 views

Convert base-64 string to Blob in your LWC

Requirement : I need to get Blob Data from my File (represented as ContentDocument) in my LWC. Currently I implemented it in next way : I have an Apex method which returns base-64 string for specific ...
2 votes
1 answer
59 views

LWC audio / blob component

I have a LWC component and Apex Method, my apex method return a blob element from API response(my API response is a MP3 audio), how can I use this blob element on JS to add in HTML audio element??
  • 23
0 votes
1 answer
52 views

Convert Int Array to Blob

I have an Integer array using it as a ByteArray (It is a publicKey) [-33,103,-48,-46,113 .......] How can I convert it to Blob using Apex?
0 votes
0 answers
215 views

Parse blob in apex

We have a @RestResource apex class using which we are receiving the JSON data from application which resides outside of salesforce through REST API. We parse this data to get the jobId from it and ...
0 votes
0 answers
87 views

Error on Inserting a ContentVersion with the REST API from Javascript: "Non-binary part must be JSON or XML"

I am trying to use the Salesforce REST API to insert an JPG as a ContentVersion in Salesforce. I'm using an Ionic Capacitor mobile app with the capacitor-community/http plugin. If I'm reading the ...
  • 617
1 vote
1 answer
422 views

String to Blob and Blob to String conversion during encryption/decryption

I'm getting the error when I'm trying to decrypt an encrypted value in line 7. Blob exampleIv = Blob.valueOf('Example of IV123'); Blob key = Crypto.generateAesKey(128); Blob data = Blob.valueOf(...
0 votes
0 answers
23 views

Integration batch job + Data Encryption : Need some suggestion

I have written a batch job to push Open Case record every one hr from Salesforce to External system using REST API. I need to Encrypte the data and push it to the external system. Below is the Class ...
  • 679
1 vote
0 answers
44 views

Unable to save video captured via webcam in Aura Component

I have an Aura component that captures video via webcam and displays it to the user while also giving them the option to save it. The "playback" feature works as expected using the following ...
1 vote
2 answers
813 views

How to get Binary Data to submit to REST API

I'm attempting to use curl and multipart message to attach files to a created record. I am successfully able to do so, however the file is corrupted when I view it. I think I may not be getting the ...
0 votes
1 answer
836 views

Open a blob file in a new tab of browser in Aura component

I was facing some problems finding a way to open a blob from an Aura (Lightning component) in a new tab of the browser, the window.close() function doesn't work because open with base URL of the ...
1 vote
0 answers
56 views

Popup warning that blob cannot be opened because of browser settings when generating data with Javascript

When generating a CSV file with Javascript, and trying to make the file available for download locally, using the snippet below: const blobToBase64 = (blob) => { const reader = new FileReader();...
0 votes
0 answers
316 views

How to convert blob to byte in Apex

There is a requirement that when I am trying to send images/pdfs files from salesforce to external system, the external system is expecting the content in bytes. I have working code of JAVA but not ...
  • 45
0 votes
1 answer
2k views

How to open a save as dialog from javascript?

I have a pdf file as a blob in javascript. I want to save the it on my local machine. I am creating an anchor tag, and simulating the click event to download the file. I want to open the "Save as&...
  • 1
0 votes
1 answer
40 views

How to remove all unicode characters from a blob?

I have a requirement to parse the contents of a csv blob which has unicode characters. When I am trying to parse it using Blob myBlob = EncodingUtil.base64Decode(response.getBody()) I am getting an ...
1 vote
1 answer
323 views

Use CSS in PDF with Apex

I'm trying to generate a PDF file using Apex only (without using VF). I'm having trouble using basic css properties like width and height, I tried to include them in the head, tried inline, but ...
  • 1,485
1 vote
1 answer
607 views

How we can read Content Version body and update in Long rich text area field of an object?

I have file attached (Word Document) to the custom object record . I want read the file and get the content between some text and store it in the Custom object record field apex: ContentVersion con =[...
0 votes
0 answers
490 views

Post File to SharePoint from APEX

I am using EinsteinVision_HttpBodyPart approach to create a file in Sharepoint from Salesforce. EinsteinVision_HttpBodyPart And consuming it in my below method, with this approach files are creating ...
0 votes
1 answer
1k views

ContentVersion to File Attachment in Email | APEX [closed]

I am trying to get the Blob Version Data from the ContentVersion in Apex class and send it in an Email using the Following Code: Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();...
1 vote
1 answer
463 views

How can I get content version data without making self callout?

I understand that there are several approaches to get content version data. The default and widely accepted approach is to make self-callout to REST API to get VersionData of VersionData field on ...
  • 13.9k
1 vote
1 answer
272 views

Make HttpRequest Callout to send binary data without corruption

I faced issues when tried to send binary data from Salesforce to external web services. To start with, I tried to send binary data from Salesforce to itself. I am trying to read binary data from valid ...
  • 13.9k
0 votes
1 answer
532 views

Merging Docx files into one - Apex

I have a requirement, which I should merge two or more word files (.docx) together into one file. because I can't do arithmetic operations on Blob - I converted it to hex, made the arithmetic, ...
  • 963
0 votes
1 answer
317 views

Sending PDF file from Salesforce to XERO, but it's not happening

I want to send PDF file which is generated by VF page from Salesforce to XERO. But I'm trying to send but it's not happening XERO syntax, it receives like below format POST /api.xro/2.0/Receipts/...
-3 votes
1 answer
486 views

How to format Excel Column in Apex? [closed]

I'm sending an email via scheduler class with an excel file as an attachment, but the data in the file does not appear to be in proper format. Please check the following image: The code I'm using to ...
0 votes
0 answers
45 views

UnitTest: Cannot take whole Blob value from return value for System.assertequals

I have a class that I want to do unit_test, which returns Blob value above 3000byte. Regarding this, I want to compare it with expected value, using toString method. However, I can't get the whole ...
  • 21
2 votes
1 answer
489 views

How to upload BLOB using the Quip API

Is it possible to upload an audio file using the Quip API? I see in the documentation the API supports the upload of blob objects. I can't seem to get this to work properly. I have tried uploading ...
0 votes
1 answer
147 views

ContentVersion apex decoding [closed]

we are saving a docx and pdf files in contentversion. But having issue in decoding it back. Blob.tostring doesnt work as the files encoding is not in the UTF-8 formatting. Can you please help me ...
2 votes
2 answers
404 views

BLOB is not a valid UTF-8 string for the Contentversion of einstein_platform.pem file

In Einstein Playground app developed by the Salesforce Lab, I have uploaded the einstein platform service private key file named einstein_platform.pem to complete my einstein platform service setup. ...
0 votes
2 answers
661 views

Encoding and Decoding BLOB due to error 'BLOB is not a valid UTF-8 string'

I try to encode and decode a BLOB in order to avoid the 'BLOB is not valid UTF-8 string' error, but when I encode the BLOB in UTF-8, decode it again and use the .toString-method, I stil get the error. ...
0 votes
1 answer
1k views

Reading data from csv file stored in salesforce files. Content size of 12mb

I have a requirement to upload the csv file of 12mb and read the content in it. Through Lightningfile upload component i am able to load the file in Salesofrce Files and here is the below link for ...
  • 103
2 votes
1 answer
920 views

How to read/parse an X9.37 file via Apex?

Background X9.37 is a standard format used in electronic check exchange (when a depository institution sends an image cash letter file as a deposit to the Federal Reserve Bank, or when the Federal ...
2 votes
3 answers
2k views

Is there any way to convert a PDF blob value to string in Apex / Javascript lightning controller

I am in need of a way to get a PDF to a readable string format so I can search for specific values in the PDF. But from what i've found so far Apex is unable to get the blob value converted into a ...
1 vote
0 answers
28 views

CSV attachment, replacing \n from cell values

I am trying to create a csv attachment through apex, I am getting the csv with the values. But some values for eg. 'Hi I am xyz.\n This is an example code.' are getting split to next cell because of ...
  • 413
1 vote
0 answers
145 views

Download Html + Blob image as text

On my VF page, I need to save to SF an html code with a signature represented as a blob (drawn with HTML5 Canvas) as a text file (preferably MS word). Right now, I'm not sure if this should be ...
  • 1,485
2 votes
1 answer
307 views

Why Blob equals doesn't work if one of the Blobs is retrieved from ContentDocument?

In brief, I can't test the value stored in a ContentDocument. Even if the value of the two Blobs is the exact same, equals would return false. Do someone know the reason? Here's a unit test to check ...
1 vote
1 answer
3k 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"> <...
0 votes
1 answer
372 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,...
0 votes
2 answers
2k 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 ...
1 vote
1 answer
132 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: ...
2 votes
0 answers
455 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. ...
  • 21
2 votes
1 answer
22k 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 ...
  • 8,520
0 votes
1 answer
662 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 ...
3 votes
1 answer
1k 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 ...
  • 2,738
0 votes
0 answers
573 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"> {!...
  • 551
2 votes
1 answer
1k 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 ...
  • 2,738
1 vote
0 answers
477 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 ...
  • 403
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 ...
  • 21
1 vote
1 answer
6k 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&...
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: ...
  • 131k
6 votes
3 answers
4k 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
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 ...
  • 2,667