You need to sign in to do that
Don't have an account?
etess
No protocol error?
I have a VF Page that is displaying an inline frame of a PDF which I'd like to use as a "Preview PDF" page. I am trying to create a button that executes an APEX method to save the PDF as a QuoteDocument and redirect to Quote Detail page. However, I am getting the following error:
no protocol: Page.bidPDF?id=0Q0P00000008Pk5KAE&inline=1
I am stumped - any insights would be much appreciated
My VF page:
<apex:page standardController="Quote" title="PDF Preview" extensions="quoteExtension">
<apex:sectionHeader title="Quote (PDF Preview)" subtitle="{!quote.Name}"/>
<p><a href="../{!quote.id}"><font style="font-size: 11px">« Back to Quote</font></a></p>
<apex:pageBlock>
Below is a preview of your PDF. If your browser does not support PDF preview, it will ask you to download the PDF.
</apex:pageBlock>
<p>
<apex:form>
<apex:commandButton value="Save" action="{!quotePDFSave}"/>
</apex:form>
</p>
<apex:iframe src="apex/bidPDF?id={!quote.id}" width="80%"/>
</apex:page>
My APEX Class:
public class quoteExtension {
private final Quote qte;
public quoteExtension(ApexPages.StandardController stdController) {
this.qte = (Quote)stdController.getRecord();
}
public PageReference quotePDFSave(){
// Get PDF Template and Create Blob
PageReference QuotePDFPage = new PageReference('Page.bidPDF?id='+qte.Id);
Blob QuotePDFBlob = QuotePDFPage.getContentAsPDF();
//Attach
QuoteDocument qd = new QuoteDocument(quoteid = qte.id, discount = qte.Discount, grandtotal=qte.TotalCost__c, document=QuotePDFBlob);
insert qd;
//Redirect
PageReference detailPage = new PageReference('../'+ qte.id);
detailPage.setRedirect(true);
return detailPage;
}
}
Small typo with the VF page name. Try
All Answers
I'm guessing this is the culprit:
I'm not sure PageReference can deal with that type of relative URL. If not, it may be building an absolute URL explicitly based on what you're passing in the constructor, which doesn't have a protocol (http, http, ftp, etc.) and wouldn't work even if it did. Try getting rid of the parent directory notation.
Hm, that might be a different issue, but the error message seems to be referring to the following code & not that last redirect line:
Actually, I realize in error message, "KAE&inline=1" is getting appended from somewhere but should not be - i've highlighted the correct Quote ID in blue from when I test it
Error: no protocol: apex/bidPDF?id=0Q0P00000008Pk5KAE&inline=1
Try
Small typo with the VF page name. Try
Thanks! It was the difference between:
and