• Joep Mutsaerts
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi All,

I have a problem in converting the body of pdf file to a string. 

I tried something like this
Say for example the pdf file is stored in static resource :

My code looks like:
blob b = [select body from staticResource where name = 'testDoc'].body;
string s = b.tostring(); // here i am getting an error like "blob is not a valid UTF-8" 

I found what is the casue but I am not able to overcome that.
The issue is that the body of pdf will have some special character like " ê , ç , ã ".

So that it is showing such error I think. Can anyone help me out !!

Thanks in advance.
  • February 01, 2015
  • Like
  • 0