1

enter image description hereI have to add funcionality to my class where i can create PDF file on quote. I'm trying to use code like this :

public static void createPDF(String quote) {
    Quote_Setting__mdt quoteSetting = Quote_Setting__mdt.getInstance('Standard_Quote_Template');
    String QuoteID = quote;
    String templateID = quoteSetting.Standard_Quote_Template__c;
    String quoteUrl = '/quote/quoteTemplateDataViewer.apexp?id=';
    quoteUrl += QuoteID;
    quoteUrl += '&headerHeight=190&footerHeight=188&summlid=';
    quoteUrl += templateID ;
    quoteUrl += '#toolbar=1&navpanes=0&zoom=90';
    PageReference pg = new PageReference(quoteUrl);
    QuoteDocument quotedoc = new QuoteDocument();
    Blob b = pg.getContentAsPDF() ;
    quotedoc.Document = b;
    quotedoc.QuoteId = QuoteID ;
    System.debug(quotedoc + ' quote doc');
    insert quotedoc;
}

And PDF is creating, but page is blank. Should i add some other fields to this method?

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.