4

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 1

3

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.

1
  • Okay so salesforce doesnot contain PDF Parsing library.So a conclusion can be drawn that it is not possible to read through pdf.
    – user6886
    Commented Jul 10, 2015 at 9:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .