Skip to main content
10 events
when toggle format what by license comment
Apr 13, 2017 at 12:54 history edited CommunityBot
replaced http://salesforce.stackexchange.com/ with https://salesforce.stackexchange.com/
Feb 26, 2014 at 18:32 comment added Anand Your understanding that Blob.toPDF() makes PDF from a string is correct. The VF page I created makes the PDF from the string that is stored in a field. So I used the toPDF(). I will use the debug log from anonymous apex to see if I can provide any info on this.
Feb 19, 2014 at 0:29 history edited Daniel Ballinger CC BY-SA 3.0
added 485 characters in body
Feb 18, 2014 at 20:06 comment added Daniel Ballinger I'm not sure that Blob.toPDF() is applicable here. My understanding is it makes a PDF from a string, not from a Visualforce page. Can you link to a debug log from anonymous apex that is calling getContentAsPDF on the VF page, it might provide some clues.
Feb 18, 2014 at 7:27 comment added Anand I have changed my code to sanitize the HTML content and perform Blob.toPDF() which is working currently. But still the getContent() or getContentAsPDF() is not working. Also, the debug logs do not contain information regarding why SF is redirecting.
Feb 17, 2014 at 20:49 comment added Daniel Ballinger If VisualForcePDFPage works fine when using a browser but redirects when using PageReference.getContentAsPDF() I'd suggest capturing the debug logs. Hopefully they will indicate why Salesforce is redirecting the request.
Feb 17, 2014 at 12:36 comment added Anand I have a WebService called IntegrationService through which I generated the WSDL to use in the C# project. The WebService has a getOpportunity() method which returns the opportunity and that works successfully. There is a saveEmail() method that takes the email content and converts it to a PDF through the VisualForce page and adds that as an attachment to the Opportunity. The VF page is returning a redirect to the login inside the WebService. Otherwise the WebService call works fine.
Feb 17, 2014 at 8:48 comment added Daniel Ballinger Are you able to provide an example HTTP request that the C# code is sending? I can only go off my experience with why Salesforce would redirect you to the login page.
Feb 17, 2014 at 7:50 comment added Anand 1. As mentioned in the question, I am correctly authentication my request to Salesforce from the C# ASP.NET app. Inside the Webservice, I am rendering the content through the VF page as a PDF. That is not rendering correctly. getContentAsPDF() returns blank and Blob.toPDF() throws an exception due to HTML content probably not containing some valid chars.
Feb 17, 2014 at 0:47 history answered Daniel Ballinger CC BY-SA 3.0