You need to sign in to do that
Don't have an account?
Corrupt PDF when generating from Apex code, does work when doing via Button
Dear developers,
I have this wierd error I can't get a solution to.
I have a button on a custom object, which calls a "static webservice" function, which in its turn generates a pdf out of a visualforce page and attaches it to the custom object.
The custom object in its turn is basically a step in a big sales cycle, and gets generated whenever a lead is converted, when I try to automatically add the PDF whenever the custom object is created, I get a corrupt File, which can't be opened.
When I make a different function, in apex, which does the same functionality (attaching a pdf to the custom object), not making it a webservice, I have the same problem. (In both cases my pdf is only 22bytes large), when making the function @future the pdf is about the correct size (1,8kb) but is the file is still corrupt.
Any thoughts?
Thanks in advance & Kindest Regards
You're probably getting some sort of 404 or 500 error. Try renaming the PDF to a .HTML file, and opening it in your web browser. You will probably get a clue as to what went wrong.