I am trying to read a pdf file that is stored in Static resources.The body of the pdf comes in a Blob format, but I am not able to get the blob back to the readable format.How do I accomplish it.
1 Answer
If you mean you want to look at the bytes that make up the file using Apex code you can't directly. You can turn it into a base64 string using EncodingUtil.base64Encode but as the string characters then don't align with the byte boundaries it is very hard work to do anything useful (and you are likely to run into CPU and heap governor limits).
So if you need to look inside the Blob, you are probably best to send it to a service that you write in another language that supports byte manipulation and where someone else has already written a PDF parsing library. From a quick Google (this isn't a recommendation) e.g. pdf2json.
-
Okay so salesforce doesnot contain PDF Parsing library.So a conclusion can be drawn that it is not possible to read through pdf.– user6886Commented Jul 10, 2015 at 9:31