function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
prudhviprudhvi 

Problem with pdf attachments?

Hi,

 

 I wrote one java service to  retrieve all the attachments for a given opportunity.

I am doing following steps to save the attachment  in my local folder

1. Constuct the query SOAP request to with attachement ID in IDList ,  name and body element in select list.

2. invoke the soap service and get the body element from the soap response(base64 string)

3. apply base64decode to decode the attachment body(base64 string) in to bytes array

4. save the attachement with the attachment name.

My service is working fine with MS WORd and EXCEL attachment. I can able to open these downloaded attachements successfully.

But for the PDF attachments my service is not working.

when I open the these downloaded PDF attachements , I am getting an error saying that There was an error opening  this document. File Does not begin with %PDF-.

I think  I am not properly decoding the  base64 string into binarydata or

the Salesforce.com soap server API is not properly encoding the PDF file into base64 when its converting the PDF file into base64 string

Can anyone has any idea on this.

 

 

Thanks,

Prudhvi.

DevAngelDevAngel

Hi prudhvi,

Man, you guys are really putting me through the wringer.  Anyway, what base64 library are you using?  I recommend using this one.  I had some problems with some of the ones that come packaged with other technologies.  This one seems to be pretty good.

 

prudhviprudhvi

I am using webMethods service to decode the base64 string.

 

Thanks,

Prudhvi