Questions tagged [blob]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
55 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 ...
0
votes
1answer
33 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
0answers
30 views

Files are getting corrupted when sent over http request [duplicate]

I am sending files to a third-party system through an HTTP Post request, whenever a new file is uploaded or attached under any of the Order records by writing a trigger for ContentDocumentLink Object. ...
0
votes
0answers
126 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
1answer
305 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();...
0
votes
1answer
134 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 ...
1
vote
1answer
51 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 ...
0
votes
0answers
148 views

Save the video to files

I'm making a component that allows me to make a video with the capture of the desktop camera. In javascript I have '' vidSave.src '' which is the url of the video that was recorded. When I try to ...
0
votes
1answer
262 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, ...
0
votes
1answer
56 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
1answer
181 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
0answers
36 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 ...
2
votes
1answer
249 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
1answer
43 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 ...
1
vote
2answers
185 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
2answers
290 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
1answer
624 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 ...
2
votes
1answer
446 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 ...
1
vote
3answers
1k 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
0answers
23 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 ...
1
vote
0answers
103 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 ...
2
votes
1answer
177 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
1answer
1k 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
1answer
248 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
2answers
1k 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
1answer
37 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
0answers
413 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
15k 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
417 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
1answer
701 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
365 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
753 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
347 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
804 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 ...
1
vote
1answer
4k 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
1answer
1k 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: ...
6
votes
3answers
3k 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
1k 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 ...
7
votes
2answers
2k 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()-...
3
votes
1answer
1k 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? ...
2
votes
2answers
2k 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
707 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
298 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 ...
3
votes
1answer
4k 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
236 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
2k 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
200 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
514 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
651 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
924 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 ...