{"id":4032,"date":"2024-02-11T20:43:55","date_gmt":"2024-02-11T12:43:55","guid":{"rendered":"http:\/\/www.ponybai.com\/?p=4032"},"modified":"2023-12-05T15:56:05","modified_gmt":"2023-12-05T07:56:05","slug":"%e5%91%88%e7%8e%b0-pdf-%e6%a0%bc%e5%bc%8f%e7%9a%84-visualforce-%e9%a1%b5%e9%9d%a2-%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"http:\/\/www.ponybai.com\/?p=4032","title":{"rendered":"\u5448\u73b0 PDF \u683c\u5f0f\u7684 Visualforce \u9875\u9762 \u6587\u4ef6"},"content":{"rendered":"\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528 PDF \u751f\u6210 Visualforce \u9875\u9762\u7684\u53ef\u4e0b\u8f7d\u3001\u53ef\u6253\u5370\u7684 PDF \u6587\u4ef6 \u6e32\u67d3\u670d\u52a1\u3002\u901a\u8fc7\u66f4\u6539\u6807\u7b7e\u5c06\u9875\u9762\u8f6c\u6362\u4e3a PDF\u3002<\/p>\n\n\n\n<p><samp>&lt;apex:page&gt;<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:page renderAs=\"pdf\"&gt;<\/code><\/pre>\n\n\n\n<p>\u5448\u73b0\u7684 Visualforce \u9875\u9762 PDF\u6587\u4ef6\u8981\u4e48\u663e\u793a\u5728\u6d4f\u89c8\u5668\u4e2d\uff0c\u8981\u4e48\u88ab\u4e0b\u8f7d\uff0c\u8fd9\u53d6\u51b3\u4e8e \u6d4f\u89c8\u5668\u7684\u8bbe\u7f6e\u3002\u5177\u4f53\u884c\u4e3a\u53d6\u51b3\u4e8e\u6d4f\u89c8\u5668\u3001\u7248\u672c\u3001 \u548c\u7528\u6237\u8bbe\u7f6e\uff0c\u5e76\u4e14\u4e0d\u53d7 Visualforce \u7684\u63a7\u5236\u3002\u4ee5\u4e0b\u9875\u9762\u5305\u542b\u4e00\u4e9b\u5e10\u6237\u8be6\u7ec6\u4fe1\u606f\uff0c\u5e76\u4ee5 PDF \u683c\u5f0f\u5448\u73b0 \u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:page standardController=\"Account\" renderAs=\"pdf\"&gt;\n\n&lt;apex:stylesheet value=\"{!URLFOR($Resource.Styles,'pdf.css')}\"\/&gt;\n\n&lt;h1&gt;Welcome to Universal Samples!&lt;\/h1&gt;\n\n&lt;p&gt;Thank you, &lt;b&gt;&lt;apex:outputText value=\" {!Account.Name}\"\/&gt;&lt;\/b&gt;, for \n   becoming a new account with Universal Samples.&lt;\/p&gt;\n\n&lt;p&gt;Your account details are:&lt;\/p&gt;\n\n&lt;table&gt;\n&lt;tr&gt;&lt;th&gt;Account Name&lt;\/th&gt;\n    &lt;td&gt;&lt;apex:outputText value=\"{!Account.Name}\"\/&gt;&lt;\/td&gt;\n    &lt;\/tr&gt;\n&lt;tr&gt;&lt;th&gt;Account Rep&lt;\/th&gt;\n    &lt;td&gt;&lt;apex:outputText value=\"{!Account.Owner.Name}\"\/&gt;&lt;\/td&gt;\n    &lt;\/tr&gt;\n&lt;tr&gt;&lt;th&gt;Customer Since&lt;\/th&gt;\n    &lt;td&gt;&lt;apex:outputText value=\"{0,date,long}\"&gt;\n        &lt;apex:param value=\"{!Account.CreatedDate}\"\/&gt;\n        &lt;\/apex:outputText&gt;&lt;\/td&gt;\n    &lt;\/tr&gt;\n&lt;\/table&gt;\n    \n&lt;\/apex:page&gt;<\/code><\/pre>\n\n\n\n<p>Visualforce \u9875\u9762 \u5448\u73b0\u4e3a PDF \u6587\u4ef6<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u5c06 Visualforce \u9875\u9762\u6e32\u67d3\u4e3a PDF \u683c\u5f0f \u9876\u70b9<\/h1>\n\n\n\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528 Apex \u4e2d\u7684\u65b9\u6cd5\u5c06 Visualforce \u9875\u9762\u5448\u73b0\u4e3a PDF \u6570\u636e\u3002\u7136\u540e\u4f7f\u7528 Apex \u4ee3\u7801\u5c06\u8be5 PDF \u6570\u636e\u8f6c\u6362\u4e3a\u7535\u5b50\u90ae\u4ef6\u9644\u4ef6\u3001\u6587\u6863\u3001 \u558b\u558b\u4e0d\u4f11\u7684\u5e16\u5b50\uff0c\u7b49\u7b49\u3002<\/p>\n\n\n\n<p><samp>PageReference.getContentAsPDF()<\/samp>\u4e0b\u9762\u7684\u793a\u4f8b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4e09\u5143\u7d20\u7a97\u4f53\uff0c\u7528\u4e8e\u9009\u62e9\u5e10\u6237\u548c\u62a5\u8868 \u683c\u5f0f\uff0c\u7136\u540e\u5c06\u751f\u6210\u7684\u62a5\u544a\u53d1\u9001\u5230\u6307\u5b9a\u7684\u7535\u5b50\u90ae\u4ef6 \u5730\u5740\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:page title=\"Account Summary\" tabStyle=\"Account\"\n    controller=\"PdfEmailerController\"&gt;\n\n    &lt;apex:pageMessages \/&gt;\n\n    &lt;apex:form &gt;\n        &lt;apex:pageBlock title=\"Account Summary\"&gt;\n    \n        &lt;p&gt;Select a recently modified account to summarize.&lt;\/p&gt;\n        &lt;p\/&gt;\n        \n        &lt;apex:pageBlockSection title=\"Report Format\"&gt;\n        \n            &lt;!-- Select account menu --&gt;\n            &lt;apex:pageBlockSectionItem&gt;\n                &lt;apex:outputLabel for=\"selectedAccount\" value=\"Account\"\/&gt; \n                &lt;apex:selectList id=\"selectedAccount\" value=\"{! selectedAccount }\" \n                                 size=\"1\"&gt;\n                    &lt;apex:selectOption \/&gt; &lt;!-- blank by default --&gt;\n                    &lt;apex:selectOptions value=\"{! recentAccounts }\" \/&gt;\n                &lt;\/apex:selectList&gt;\n            &lt;\/apex:pageBlockSectionItem&gt;\n\n            &lt;!-- Select report format menu --&gt;\n            &lt;apex:pageBlockSectionItem &gt;\n                &lt;apex:outputLabel for=\"selectedReport\" value=\"Summary Format\"\/&gt; \n                &lt;apex:selectList id=\"selectedReport\" value=\"{! selectedReport }\" \n                                 size=\"1\"&gt;\n                    &lt;apex:selectOptions value=\"{! reportFormats }\" \/&gt;\n                &lt;\/apex:selectList&gt;\n            &lt;\/apex:pageBlockSectionItem&gt;\n\n            &lt;!-- Email recipient input field --&gt;\n            &lt;apex:pageBlockSectionItem &gt;\n                &lt;apex:outputLabel for=\"recipientEmail\" value=\"Send To\"\/&gt; \n                &lt;apex:inputText value=\"{! recipientEmail }\" size=\"40\"\/&gt;\n            &lt;\/apex:pageBlockSectionItem&gt;\n\n        &lt;\/apex:pageBlockSection&gt;\n            \n        &lt;apex:pageBlockButtons location=\"bottom\"&gt;\n            &lt;apex:commandButton action=\"{! sendReport }\" value=\"Send Account Summary\" \/&gt;\n        &lt;\/apex:pageBlockButtons&gt;\n    \n    &lt;\/apex:pageBlock&gt;\n    &lt;\/apex:form&gt;\n\n&lt;\/apex:page&gt;<\/code><\/pre>\n\n\n\n<p>\u6b64\u9875\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u7528\u6237\u754c\u9762\u3002\u5f53\u60a8\u4ece Apex \u751f\u6210 PDF \u6587\u4ef6\u65f6\uff0c\u6240\u6709 \u8be5\u64cd\u4f5c\u4f4d\u4e8e Apex \u4ee3\u7801\u4e2d\u3002\u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u8be5\u4ee3\u7801\u4f4d\u4e8e\u6307\u5b9a\u4e3a\u9875\u9762\u7684 \u63a7\u5236\u5668\u3002<\/p>\n\n\n\n<p><samp>PdfEmailerController<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public with sharing class PdfEmailerController {\n    \n    \/\/ Form fields\n    public Id selectedAccount    { get; set; }  \/\/ Account selected on Visualforce page\n    public String selectedReport { get; set; }  \/\/ Report selected\n    public String recipientEmail { get; set; }  \/\/ Send to this email\n    \n    \/\/ Action method for the &#91;Send Account Summary] button\n    public PageReference sendReport() {\n\n        \/\/ NOTE: Abbreviated error checking to keep the code sample short\n        \/\/       You, of course, would never do this little error checking\n        if(String.isBlank(this.selectedAccount) || String.isBlank(this.recipientEmail)) {\n            ApexPages.addMessage(new \n                ApexPages.Message(ApexPages.Severity.ERROR, \n               'Errors on the form. Please correct and resubmit.'));\n            return null; \/\/ early out\n        }\n        \n        \/\/ Get account name for email message strings\n        Account account = &#91;SELECT Name \n                           FROM Account \n                           WHERE Id = :this.selectedAccount \n                           LIMIT 1];\n        if(null == account) {\n            \/\/ Got a bogus ID from the form submission\n            ApexPages.addMessage(new \n                ApexPages.Message(ApexPages.Severity.ERROR, \n               'Invalid account. Please correct and resubmit.'));\n            return null; \/\/ early out\n        }\n        \n        \/\/ Create email\n        Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();\n        message.setToAddresses(new String&#91;]{ this.recipientEmail });\n        message.setSubject('Account summary for ' + account.Name);\n        message.setHtmlBody('Here\\'s a summary for the ' + account.Name + ' account.');\n        \n        \/\/ Create PDF\n        PageReference reportPage = \n            (PageReference)this.reportPagesIndex.get(this.selectedReport);\n        reportPage.getParameters().put('id', this.selectedAccount);\n        Blob reportPdf;\n        try {\n            reportPdf = reportPage.getContentAsPDF();\n        }\n        catch (Exception e) {\n            reportPdf = Blob.valueOf(e.getMessage());\n        }\n        \n        \/\/ Attach PDF to email and send\n        Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();\n        attachment.setContentType('application\/pdf');\n        attachment.setFileName('AccountSummary-' + account.Name + '.pdf');\n        attachment.setInline(false);\n        attachment.setBody(reportPdf);\n        message.setFileAttachments(new Messaging.EmailFileAttachment&#91;]{ attachment });\n        Messaging.sendEmail(new Messaging.SingleEmailMessage&#91;]{ message });\n        \n        ApexPages.addMessage(new \n            ApexPages.Message(ApexPages.Severity.INFO,\n           'Email sent with PDF attachment to ' + this.recipientEmail));\n\n        return null; \/\/ Stay on same page, even on success\n    }\n    \n    \n    \/***** Form Helpers *****\/\n    \n    \/\/ Ten recently-touched accounts, for the Account selection menu\n    public List&lt;SelectOption&gt; recentAccounts {\n        get {\n            if(null == recentAccounts){\n                recentAccounts = new List&lt;SelectOption&gt;();\n                for(Account acct : &#91;SELECT Id,Name,LastModifiedDate \n                                    FROM Account \n                                    ORDER BY LastModifiedDate DESC \n                                    LIMIT 10]) {\n                    recentAccounts.add(new SelectOption(acct.Id, acct.Name));\n                }\n            }\n            return recentAccounts;\n        }\n        set;\n    }\n    \n    \/\/ List of available reports, for the Summary Format selection menu\n    public List&lt;SelectOption&gt; reportFormats {\n        get {\n            if(null == reportFormats) {\n                reportFormats = new List&lt;SelectOption&gt;();\n                for(Map &lt;String,Object&gt; report : reports) {\n                    reportFormats.add(new SelectOption(\n                        (String)report.get('name'), (String)report.get('label')));\n                }\n            }\n            return reportFormats;\n        }\n        set;\n    }\n\n    \n    \/***** Private Helpers *****\/\n    \n    \/\/ List of report templates to make available\n    \/\/ These are just Visualforce pages you might print to PDF\n    private Map&lt;String,PageReference&gt; reportPagesIndex;\n    private List&lt;Map&lt;String,Object&gt;&gt; reports {\n        get {\n            if(null == reports) {\n                reports = new List&lt;Map&lt;String,Object&gt;&gt;();\n                \/\/ Add one report to the list of reports\n                Map&lt;String,Object&gt; simpleReport = new Map&lt;String,Object&gt;();\n                simpleReport.put('name',  'simple');\n                simpleReport.put('label', 'Simple');\n                simpleReport.put('page',   Page.ReportAccountSimple);\n                reports.add(simpleReport);\n                \n                \/\/ Add your own, more complete list of PDF templates here\n\n                \/\/ Index the page names for the reports\n                this.reportPagesIndex = new Map&lt;String,PageReference&gt;();\n                for(Map&lt;String,Object&gt; report : reports) {\n                    this.reportPagesIndex.put(\n                        (String)report.get('name'), (PageReference)report.get('page'));\n                }\n            }\n            return reports;\n        }\n        set;\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e2a Apex \u63a7\u5236\u5668\u5728\u6982\u5ff5\u4e0a\u53ef\u4ee5\u5206\u4e3a\u56db\u4e2a\u90e8\u5206\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5f00\u5934\u7684\u4e09\u4e2a\u516c\u5171\u5c5e\u6027\u6355\u83b7 \u8868\u5355\u4e0a\u7684\u4e09\u4e2a\u8f93\u5165\u5143\u7d20\u3002<\/li>\n\n\n\n<li>\u64cd\u4f5c\u65b9\u6cd5\u89e6\u53d1 \u5355\u51fb\u201c\u53d1\u9001\u5e10\u6237\u6458\u8981\u201d\u6309\u94ae\u65f6\u3002<samp>sendReport()<\/samp><\/li>\n\n\n\n<li>\u4e24\u4e2a\u516c\u5171\u5e2e\u52a9\u7a0b\u5e8f\u5c5e\u6027\u63d0\u4f9b\u8981\u5728\u4e24\u4e2a\u9009\u62e9\u5217\u8868\u4e2d\u4f7f\u7528\u7684\u503c input \u5143\u7d20\u3002<\/li>\n\n\n\n<li>\u672b\u5c3e\u7684\u79c1\u4eba\u5e2e\u52a9\u7a0b\u5e8f\u5c01\u88c5\u4e86\u53ef\u80fd\u7684 PDF \u62a5\u544a\u5217\u8868 \u683c\u5f0f\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u521b\u5efa Visualforce \u9875\u9762\u6765\u6dfb\u52a0\u81ea\u5df1\u7684\u62a5\u544a\uff0c\u7136\u540e \u5728\u672c\u8282\u4e2d\u4e3a\u5176\u6dfb\u52a0\u4e00\u4e2a\u6761\u76ee\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u5f53 action \u65b9\u6cd5\u89e6\u53d1\u65f6\uff0c \u4ee3\u7801\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\u3002<\/p>\n\n\n\n<p><samp>sendReport()<\/samp><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b83\u6267\u884c\u57fa\u672c\u7684\u9519\u8bef\u68c0\u67e5\uff0c\u4ee5\u786e\u4fdd\u8868\u5355\u5b57\u6bb5\u5177\u6709 \u6709\u7528\u7684\u503c\u3002\u6ce8\u610f\u5bf9\u4e8e\u5fc5\u987b \u5728\u4e0e\u771f\u4eba\u63a5\u89e6\u540e\u5e78\u5b58\u4e0b\u6765\u3002\u5728\u751f\u4ea7\u4ee3\u7801\u4e2d\u6267\u884c\u66f4\u591a \u5b8c\u6210\u8868\u5355\u9a8c\u8bc1\u3002<\/li>\n\n\n\n<li>\u63a5\u4e0b\u6765\uff0c\u5b83\u4f7f\u7528\u6240\u9009\u5e10\u6237\u7684\u503c\u6765\u67e5\u627e\u8be5\u5e10\u6237\u7684\u540d\u79f0 \u5e10\u6237\u3002\u5e10\u6237\u540d\u79f0\u7528\u4e8e\u6dfb\u52a0\u5230\u7535\u5b50\u90ae\u4ef6\u7684\u6587\u672c\u4e2d\u3002 \u6b64\u67e5\u627e\u4e5f\u662f\u8fdb\u4e00\u6b65\u9a8c\u8bc1\u8868\u5355\u503c\u5e76\u786e\u4fdd \u9009\u62e9\u4e86\u771f\u5b9e\u8d26\u6237\u3002<\/li>\n\n\n\n<li>\u5b83\u4f7f\u7528\u8be5\u7c7b\u6765\u7ec4\u5408\u7535\u5b50\u90ae\u4ef6\uff0c\u5e76\u8bbe\u7f6e\u201c\u6536\u4ef6\u4eba\u201d\u3001\u201c\u4e3b\u9898\u201d\u548c\u201c\u6b63\u6587\u201d\u7535\u5b50\u90ae\u4ef6 \u6d88\u606f\u503c\u3002<samp>Messaging.SingleEmailMessage<\/samp><\/li>\n\n\n\n<li>\u8be5\u4ee3\u7801\u4e3a \u9009\u62e9\u62a5\u8868\u683c\u5f0f\uff0c\u7136\u540e\u5728\u5176\u4e0a\u8bbe\u7f6e\u9875\u9762\u8bf7\u6c42\u53c2\u6570\u3002\u8fd9 \u53c2\u6570\u540d\u4e3a\u201cid\u201d\uff0c\u5176\u503c\u8bbe\u7f6e\u4e3a\u6240\u9009\u5e10\u6237\u7684 ID\u3002\u8fd9\u4ee3\u8868\u4e86\u4e00\u4e2a\u7279\u5b9a\u7684 \u8bf7\u6c42\u5728\u6307\u5b9a\u5e10\u6237\u7684\u4e0a\u4e0b\u6587\u4e2d\u8bbf\u95ee\u6b64\u9875\u9762\u3002\u8c03\u7528\u65f6\uff0c \u5f15\u7528 Visualforce \u9875\u9762\u6709\u6743\u8bbf\u95ee\u6307\u5b9a\u7684\u5e10\u6237\uff0c\u5e76\u4e14\u9875\u9762\u5c06\u4f7f\u7528\u8be5\u5e10\u6237\u5448\u73b0 \u5e10\u6237\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<samp>PageReference<\/samp><samp>PageReference<\/samp><samp>getContentAsPdf()<\/samp><\/li>\n\n\n\n<li>\u6700\u540e\uff0c\u5c06 PDF \u6570\u636e\u6dfb\u52a0\u5230\u9644\u4ef6\u4e2d\uff0c\u5e76\u5c06\u9644\u4ef6\u6dfb\u52a0\u5230 \u4e4b\u524d\u521b\u5efa\u7684\u7535\u5b50\u90ae\u4ef6\u3002\u7136\u540e\u53d1\u9001\u6d88\u606f\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u4f7f\u7528 \u65f6\uff0c \u65b9\u6cd5\u8c03\u7528\u7684\u8fd4\u56de\u7c7b\u578b\u4e3a \uff0c\u5176\u4e2d \u4ee3\u8868\u201c\u4e8c\u8fdb\u5236\u5927\u5bf9\u8c61\u201d\u3002\u5728 Apex \u4e2d\uff0c\u6570\u636e\u7c7b\u578b\u8868\u793a\u975e\u7c7b\u578b\u5316\u4e8c\u8fdb\u5236\u6570\u636e\u3002\u53ea\u6709\u5f53\u53d8\u91cf\u88ab\u6dfb\u52a0\u5230\u5185\u5bb9\u7c7b\u578b\u4e3a \u201capplication\/pdf\u201d\uff0c\u8868\u793a\u4e8c\u8fdb\u5236\u6570\u636e\u6210\u4e3a PDF \u6587\u4ef6\u3002<samp>PageReference.getContentAsPdf()<\/samp><samp>Blob<\/samp><samp>Blob<\/samp><samp>reportPdf<\/samp><samp>Messaging.EmailFileAttachment<\/samp><\/p>\n\n\n\n<p>\u6b64\u5916\uff0c\u5bf9 \u7684\u8c03\u7528\u662f \u5305\u88f9\u5728\u5757\u4e2d\u3002\u5982\u679c\u8c03\u7528\u5931\u8d25\uff0c \u5c06\u5e0c\u671b\u7684 PDF \u6570\u636e\u66ff\u6362\u4e3a\u5f02\u5e38\u6d88\u606f\u7684\u7248\u672c \u53d1\u77ed\u4fe1\u3002<samp>getContentAsPdf()<\/samp><samp>try\/catch<\/samp><samp>catch<\/samp><samp>Blob<\/samp><\/p>\n\n\n\n<p>\u5c06 Visualforce \u9875\u9762\u5448\u73b0\u4e3a PDF \u6570\u636e\u5728\u8bed\u4e49\u4e0a\u88ab\u89c6\u4e3a\u5bf9\u5404\u79cd\u5916\u90e8\u670d\u52a1\u7684\u6807\u6ce8 \u539f\u56e0\u3002\u539f\u56e0\u4e4b\u4e00\u662f\u6e32\u67d3\u670d\u52a1\u53ef\u80fd\u4ee5\u4e0e \u5916\u90e8\u670d\u52a1\u53ef\u80fd\u4f1a\u5931\u8d25\u3002\u4f8b\u5982\uff0c\u8be5\u9875\u9762\u5f15\u7528\u4e86\u4ee5\u4e0b\u5916\u90e8\u8d44\u6e90\uff1a \u4e0d\u53ef\u7528\u3002\u53e6\u4e00\u4e2a\u4f8b\u5b50\u662f\uff0c\u5f53\u9875\u9762\u5305\u542b\u592a\u591a\u6570\u636e\u65f6\uff0c\u901a\u5e38\u5728 \u56fe\u50cf\u7684\u5f62\u5f0f &#8211; \u6216\u6e32\u67d3\u65f6\u95f4\u8d85\u8fc7\u9650\u5236\u3002\u56e0\u6b64\uff0c\u5728\u5c06 Visualforce \u9875\u9762\u6e32\u67d3\u4e3a PDF \u6570\u636e\u65f6\uff0c\u8bf7\u59cb\u7ec8\u5c06\u6e32\u67d3\u8c03\u7528\u5305\u88c5\u5728\u4e00\u4e2a\u5757\u4e2d \u9876\u70b9\u3002<samp>getContentAsPdf()<\/samp><samp>try\/catch<\/samp>\u4e3a\u4e86\u5b8c\u6574\u8d77\u89c1\uff0c\u4e0b\u9762\u662f\u62a5\u544a\u6a21\u677f\u9875\u9762\uff0c\u8be5\u9875\u9762\u7531 \u9876\u70b9 \u6cd5\u5178\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:page showHeader=\"false\" standardStylesheets=\"false\"\n    standardController=\"Account\"&gt;\n    \n    &lt;!-- \n    This page must be called with an Account ID in the request, e.g.:\n    https:&#47;&#47;&lt;salesforceInstance&gt;\/apex\/ReportAccountSimple?id=001D000000JRBet\n    --&gt;\n\n    &lt;h1&gt;Account Summary for {! Account.Name }&lt;\/h1&gt;\n    \n    &lt;table&gt;\n        &lt;tr&gt;&lt;th&gt;Phone&lt;\/th&gt;  &lt;td&gt;&lt;apex:outputText value=\"{! Account.Phone }\"\/&gt;&lt;\/td&gt;&lt;\/tr&gt;\n        &lt;tr&gt;&lt;th&gt;Fax&lt;\/th&gt;    &lt;td&gt;&lt;apex:outputText value=\"{! Account.Fax }\"\/&gt;&lt;\/td&gt;&lt;\/tr&gt;\n        &lt;tr&gt;&lt;th&gt;Website&lt;\/th&gt;&lt;td&gt;&lt;apex:outputText value=\"{! Account.Website }\"\/&gt;&lt;\/td&gt;&lt;\/tr&gt;\n    &lt;\/table&gt;\n\n    &lt;p&gt;&lt;apex:outputText value=\"{! Account.Description }\"\/&gt;&lt;\/p&gt;\n        \n&lt;\/apex:page&gt;<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">\u4f7f\u7528 Visualforce PDF \u6e32\u67d3\u65f6\u53ef\u7528\u7684\u5b57\u4f53<\/h1>\n\n\n\n<p>Visualforce PDF \u6e32\u67d3 \u652f\u6301\u4e00\u7ec4\u6709\u9650\u7684\u5b57\u4f53\u3002\u8981\u786e\u4fdd PDF \u8f93\u51fa\u6309\u9884\u671f\u5448\u73b0\uff0c\u8bf7\u4f7f\u7528 \u652f\u6301\u7684\u5b57\u4f53\u540d\u79f0\u3002\u5bf9\u4e8e\u6bcf\u79cd\u5b57\u4f53\uff0c\u5217\u51fa\u7684\u7b2c\u4e00\u4e2a\u540d\u79f0\u662f \u63a8\u8350\u3002<\/p>\n\n\n\n<p><samp>font-family<\/samp><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u5b57\u4f53<\/th><th><samp>font-family<\/samp>\u503c<\/th><\/tr><\/thead><tbody><tr><td>Arial Unicode MS<\/td><td>Arial Unicode MS<\/td><\/tr><tr><td>\u9ed1\u4f53<\/td><td>\u65e0\u886c\u7ebf\u65e0\u886c\u7ebf\u5bf9\u8bdd<\/td><\/tr><tr><td>\u6b21<\/td><td>\u886c\u7ebf\u6b21<\/td><\/tr><tr><td>\u90ae\u5dee<\/td><td>\u7b49\u5bbd\u90ae\u5dee\u7b49\u5bbdDialogInput\uff08\u5bf9\u8bdd\u8f93\u5165\uff09<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u6ce8\u610f<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8fd9\u4e9b\u89c4\u5219\u9002\u7528\u4e8e\u670d\u52a1\u5668\u7aef PDF \u5448\u73b0\u3002\u5728 Web \u6d4f\u89c8\u5668\u4e2d\u67e5\u770b\u9875\u9762 \u53ef\u4ee5\u6709\u4e0d\u540c\u7684\u7ed3\u679c\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528\u6b64\u5904\u672a\u5217\u51fa\u7684\u503c\u8bbe\u7f6e\u6837\u5f0f\u7684\u6587\u672c\u4f7f\u7528\u201c\u65f6\u95f4\u201d\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u4f7f\u7528 \u5355\u8bcd\u201cHelvetica\u201d\uff0c\u5b83\u5448\u73b0\u4e3a Times\uff0c\u56e0\u4e3a\u8fd9\u4e0d\u662f Helvetica \u5b57\u4f53\u3002\u6211\u4eec\u5efa\u8bae\u4f7f\u7528\u201csans-serif\u201d\u3002<\/li>\n\n\n\n<li>Arial Unicode MS \u662f\u552f\u4e00\u53ef\u7528\u7684\u591a\u5b57\u8282\u5b57\u4f53\u3002\u8fd9\u662f\u552f\u4e00\u4e00\u79cd \u4e3a\u4e0d\u4f7f\u7528 \u62c9\u4e01\u5b57\u7b26\u96c6\u3002<\/li>\n\n\n\n<li>Arial Unicode MS \u4e0d\u652f\u6301\u7c97\u4f53\u6216\u659c\u4f53\u3002<samp>font-weight<\/samp><\/li>\n\n\n\n<li>\u5f53\u9875\u9762\u5448\u73b0\u4e3a PDF \u6587\u4ef6\u65f6\uff0c\u4e0d\u652f\u6301 Web \u5b57\u4f53\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528 Visualforce \u9875\u9762\u4e2d\u7684 Web \u5b57\u4f53\uff08\u5f53\u5b83\u4eec\u6b63\u5e38\u5448\u73b0\u65f6\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u6d4b\u8bd5\u5b57\u4f53\u5448\u73b0<\/h2>\n\n\n\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u9875\u9762\u4f7f\u7528 Visualforce PDF \u6e32\u67d3\u6d4b\u8bd5\u5b57\u4f53\u6e32\u67d3 \u53d1\u52a8\u673a\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:page showHeader=\"false\" standardStylesheets=\"false\" \n    controller=\"SaveToPDF\" renderAs=\"{! renderAs }\"&gt;\n\n&lt;apex:form rendered=\"{! renderAs != 'PDF' }\" style=\"text-align: right; margin: 10px;\"&gt;\n    &lt;div&gt;&lt;apex:commandLink action=\"{! print }\" value=\"Save to PDF\"\/&gt;&lt;\/div&gt;\n    &lt;hr\/&gt;\n&lt;\/apex:form&gt;\n\n&lt;h1&gt;PDF Fonts Test Page&lt;\/h1&gt;\n\n&lt;p&gt;This text, which has no styles applied, is styled in the default font for the \n   Visualforce PDF rendering engine.&lt;\/p&gt;\n\n&lt;p&gt;The fonts available when rendering a page as a PDF are as follows. The first \nlisted &lt;code&gt;font-family&lt;\/code&gt; value for each typeface is the recommended choice.&lt;\/p&gt;\n\n&lt;table border=\"1\" cellpadding=\"6\"&gt;\n&lt;tr&gt;&lt;th&gt;Font Name&lt;\/th&gt;&lt;th&gt;Style &lt;code&gt;font-family&lt;\/code&gt; Value to Use (Synonyms)&lt;\/th&gt;&lt;\/tr&gt;\n&lt;tr&gt;&lt;td&gt;&lt;span style=\"font-family: Arial Unicode MS; font-size: 14pt; \"&gt;Arial \n    Unicode MS&lt;\/span&gt;&lt;\/td&gt;&lt;td&gt;&lt;ul&gt;\n   &lt;li&gt;&lt;span style=\"font-family: Arial Unicode MS; font-size: 14pt;\"&gt;Arial Unicode MS&lt;\/span&gt;&lt;\/li&gt;\n    &lt;\/ul&gt;&lt;\/td&gt;&lt;\/tr&gt;\n&lt;tr&gt;&lt;td&gt;&lt;span style=\"font-family: Helvetica; font-size: 14pt;\"&gt;Helvetica&lt;\/span&gt;&lt;\/td&gt;\n    &lt;td&gt;&lt;ul&gt;\n   &lt;li&gt;&lt;span style=\"font-family: sans-serif; font-size: 14pt;\"&gt;sans-serif&lt;\/span&gt;&lt;\/li&gt;\n   &lt;li&gt;&lt;span style=\"font-family: SansSerif; font-size: 14pt;\"&gt;SansSerif&lt;\/span&gt;&lt;\/li&gt;\n   &lt;li&gt;&lt;span style=\"font-family: Dialog; font-size: 14pt;\"&gt;Dialog&lt;\/span&gt;&lt;\/li&gt;\n    &lt;\/ul&gt;&lt;\/td&gt;&lt;\/tr&gt;\n&lt;tr&gt;&lt;td&gt;&lt;span style=\"font-family: Times; font-size: 14pt;\"&gt;Times&lt;\/span&gt;&lt;\/td&gt;&lt;td&gt;&lt;ul&gt;\n   &lt;li&gt;&lt;span style=\"font-family: serif; font-size: 14pt;\"&gt;serif&lt;\/span&gt;&lt;\/li&gt;\n   &lt;li&gt;&lt;span style=\"font-family: Times; font-size: 14pt;\"&gt;Times&lt;\/span&gt;&lt;\/li&gt;\n&lt;\/ul&gt;&lt;\/td&gt;&lt;\/tr&gt;\n&lt;tr&gt;&lt;td&gt;&lt;span style=\"font-family: Courier; font-size: 14pt;\"&gt;Courier&lt;\/span&gt;&lt;\/td&gt;\n    &lt;td&gt;&lt;ul&gt;\n    &lt;li&gt;&lt;span style=\"font-family: monospace; font-size: 14pt;\"&gt;monospace&lt;\/span&gt;&lt;\/li&gt;\n    &lt;li&gt;&lt;span style=\"font-family: Courier; font-size: 14pt;\"&gt;Courier&lt;\/span&gt;&lt;\/li&gt;\n    &lt;li&gt;&lt;span style=\"font-family: Monospaced; font-size: 14pt;\"&gt;Monospaced&lt;\/span&gt;&lt;\/li&gt;\n    &lt;li&gt;&lt;span style=\"font-family: DialogInput; font-size: 14pt;\"&gt;DialogInput&lt;\/span&gt;&lt;\/li&gt;\n&lt;\/ul&gt;&lt;\/td&gt;&lt;\/tr&gt;\n&lt;\/table&gt;\n\n&lt;p&gt;&lt;strong&gt;Notes:&lt;\/strong&gt;\n&lt;ul&gt;\n&lt;li&gt;These rules apply to server-side PDF rendering. You might see different results \n    when viewing this page in a web browser.&lt;\/li&gt;\n&lt;li&gt;Text styled with any value besides those listed above receives the default font \n    style, Times. This means that, ironically, while Helvetica's synonyms render as \n    Helvetica, using \"Helvetica\" for the font-family style renders as Times. \n    We recommend using \"sans-serif\".&lt;\/li&gt;\n&lt;li&gt;Arial Unicode MS is the only multibyte font available, providing support for the \n    extended character sets of languages that don't use the Latin character set.&lt;\/li&gt;\n&lt;\/ul&gt;\n&lt;\/p&gt;\n \n&lt;\/apex:page&gt;<\/code><\/pre>\n\n\n\n<p>\u4e0a\u4e00\u9875\u4f7f\u7528\u4ee5\u4e0b\u63a7\u5236\u5668\uff0c\u8be5\u63a7\u5236\u5668\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7b80\u5355\u7684\u201c\u4fdd\u5b58\u5230 PDF\u201d \u529f\u80fd\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public with sharing class SaveToPDF {\n\n    \/\/ Determines whether page is rendered as a PDF or just displayed as HTML\n    public String renderAs { get; set; }\n\n\n    \/\/ Action method to \"print\" to PDF\n    public PageReference print() {\n        renderAs = 'PDF';\n        return null;\n    }\n\n}<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">\u5448\u73b0\u4e3a PDF \u65f6\u7684\u7ec4\u4ef6\u884c\u4e3a<\/h1>\n\n\n\n<p>\u4e86\u89e3 Visualforce \u5982\u4f55 \u7ec4\u4ef6\u5728\u8f6c\u6362\u4e3a PDF \u65f6\u7684\u884c\u4e3a\u5bf9\u4e8e\u521b\u5efa\u5448\u73b0\u7684\u9875\u9762\u81f3\u5173\u91cd\u8981 \u4e95\u3002Visualforce PDF \u6e32\u67d3\u670d\u52a1 \u5448\u73b0\u9875\u9762\u663e\u5f0f\u63d0\u4f9b\u7684\u9759\u6001 HTML \u548c\u57fa\u672c CSS\u3002\u901a\u5e38\uff0c\u4e0d\u8981\u4f7f\u7528 \u5177\u6709\u4ee5\u4e0b\u7279\u70b9\u7684\u7ec4\u4ef6\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f9d\u9760 JavaScript \u6267\u884c\u64cd\u4f5c<\/li>\n\n\n\n<li>\u4f9d\u8d56 Salesforce \u98ce\u683c \u5e8a\u5355<\/li>\n\n\n\n<li>\u4f7f\u7528\u6837\u5f0f\u8868\u6216\u56fe\u5f62\u7b49\u5728\u9875\u9762\u672c\u8eab\u6216 \u9759\u6001\u8d44\u6e90<\/li>\n<\/ul>\n\n\n\n<p>\u68c0\u67e5\u60a8\u7684 Visualforce \u9875\u9762 \u5c5e\u4e8e\u8fd9\u4e9b\u7c7b\u522b\u4e4b\u4e00\uff0c\u53f3\u952e\u5355\u51fb\u9875\u9762\u4e0a\u7684\u4efb\u610f\u4f4d\u7f6e\u5e76\u67e5\u770b HTML \u6e90\u4ee3\u7801\u3002\u5982\u679c \u60a8\u4f1a\u770b\u5230\u4e00\u4e2a\u5f15\u7528 JavaScript \u7684\u6807\u8bb0 \uff08.js\uff09 \u6216\u5f15\u7528 \u6837\u5f0f\u8868 \uff08.css\uff09\uff0c\u9a8c\u8bc1\u751f\u6210\u7684 PDF \u6587\u4ef6\u662f\u5426\u663e\u793a\u4e3a \u9884\u671f\u3002<\/p>\n\n\n\n<p><samp>&lt;script&gt;<\/samp><samp>&lt;link&gt;<\/samp><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee5 PDF \u683c\u5f0f\u5448\u73b0\u65f6\u5b89\u5168\u7684\u7ec4\u4ef6<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><samp>&lt;apex:composition&gt;<\/samp>\uff08\u53ea\u8981\u9875\u9762\u5305\u542b PDF \u5b89\u5168\u7ec4\u4ef6\uff09<\/li>\n\n\n\n<li><samp>&lt;apex:dataList&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:define&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:facet&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:include&gt;<\/samp>\uff08\u53ea\u8981\u9875\u9762\u5305\u542b PDF \u5b89\u5168\u7ec4\u4ef6\uff09<\/li>\n\n\n\n<li><samp>&lt;apex:insert&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:image&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:outputLabel&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:outputLink&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:outputPanel&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:outputText&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:page&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:panelGrid&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:panelGroup&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:param&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:repeat&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:stylesheet&gt;<\/samp>\uff08\u53ea\u8981 URL \u4e0d\u662f \u76f4\u63a5\u5f15\u7528 Salesforce \u98ce\u683c \u5e8a\u5355\uff09<\/li>\n\n\n\n<li><samp>&lt;apex:variable&gt;<\/samp><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee5 PDF \u683c\u5f0f\u5448\u73b0\u65f6\u8981\u8c28\u614e\u4f7f\u7528\u7684\u7ec4\u4ef6<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><samp>&lt;apex:attribute&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:column&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:component&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:componentBody&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:dataTable&gt;<\/samp><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee5 PDF \u683c\u5f0f\u5448\u73b0\u65f6\u4f7f\u7528\u4e0d\u5b89\u5168\u7684\u7ec4\u4ef6<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><samp>&lt;apex:actionFunction&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:actionPoller&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:actionRegion&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:actionStatus&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:actionSupport&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:commandButton&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:commandLink&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:detail&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:enhancedList&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:flash&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:form&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:iframe&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:includeScript&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:inputCheckbox&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:inputField&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:inputFile&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:inputHidden&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:inputSecret&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:inputText&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:inputTextarea&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:listViews&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:message&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:messages&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:outputField&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:pageBlock&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:pageBlockButtons&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:pageBlockSection&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:pageBlockSectionItem&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:pageBlockTable&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:pageMessage&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:pageMessages&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:panelBar&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:panelBarItem&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:relatedList&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:scontrol&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:sectionHeader&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:selectCheckboxes&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:selectList&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:selectOption&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:selectOptions&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:selectRadio&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:tab&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:tabPanel&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:toolbar&gt;<\/samp><\/li>\n\n\n\n<li><samp>&lt;apex:toolbarGroup&gt;<\/samp><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u60a8\u53ef\u4ee5\u4f7f\u7528 PDF \u751f\u6210 Visualforce \u9875\u9762\u7684\u53ef\u4e0b\u8f7d\u3001\u53ef\u6253\u5370\u7684 PDF \u6587\u4ef6 \u6e32\u67d3\u670d\u52a1\u3002\u901a\u8fc7\u66f4\u6539\u6807\u7b7e\u5c06\u9875\u9762\u8f6c\u6362\u4e3a PDF\u3002<\/p>\n<p><apex:page><\/p>\n<p><apex:page renderAs=\"pdf\"><\/p>\n<p>\u5448\u73b0\u7684 Visualforce \u9875\u9762 PDF\u6587\u4ef6\u8981\u4e48\u663e\u793a\u5728\u6d4f\u89c8\u5668\u4e2d\uff0c\u8981\u4e48\u88ab\u4e0b\u8f7d\uff0c\u8fd9\u53d6\u51b3\u4e8e \u6d4f\u89c8\u5668\u7684\u8bbe\u7f6e\u3002\u5177\u4f53\u884c\u4e3a\u53d6\u51b3\u4e8e\u6d4f\u89c8\u5668\u3001\u7248\u672c\u3001 \u548c\u7528\u6237\u8bbe\u7f6e\uff0c\u5e76\u4e14\u4e0d\u53d7 Visualforce \u7684\u63a7\u5236\u3002\u4ee5\u4e0b\u9875\u9762\u5305\u542b\u4e00\u4e9b\u5e10\u6237\u8be6\u7ec6\u4fe1\u606f\uff0c\u5e76\u4ee5 PDF \u683c\u5f0f\u5448\u73b0 \u6587\u4ef6\u3002<\/p>\n","protected":false},"author":1,"featured_media":4048,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[271],"tags":[277],"class_list":["post-4032","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visualforce-","tag--pdf--visualforce--"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5448\u73b0 PDF \u683c\u5f0f\u7684 Visualforce \u9875\u9762 \u6587\u4ef6 - \u767d\u767d\u968f\u7b14<\/title>\n<meta name=\"description\" content=\"\u60a8\u53ef\u4ee5\u4f7f\u7528 PDF \u751f\u6210 Visualforce \u9875\u9762\u7684\u53ef\u4e0b\u8f7d\u3001\u53ef\u6253\u5370\u7684 PDF \u6587\u4ef6 \u6e32\u67d3\u670d\u52a1\u3002\u901a\u8fc7\u66f4\u6539\u6807\u7b7e\u5c06\u9875\u9762\u8f6c\u6362\u4e3a PDF\u3002\u5448\u73b0\u7684 Visualforce \u9875\u9762 PDF\u6587\u4ef6\u8981\u4e48\u663e\u793a\u5728\u6d4f\u89c8\u5668\u4e2d\uff0c\u8981\u4e48\u88ab\u4e0b\u8f7d\uff0c\u8fd9\u53d6\u51b3\u4e8e \u6d4f\u89c8\u5668\u7684\u8bbe\u7f6e\u3002\u5177\u4f53\u884c\u4e3a\u53d6\u51b3\u4e8e\u6d4f\u89c8\u5668\u3001\u7248\u672c\u3001 \u548c\u7528\u6237\u8bbe\u7f6e\uff0c\u5e76\u4e14\u4e0d\u53d7 Visualforce \u7684\u63a7\u5236\u3002\u4ee5\u4e0b\u9875\u9762\u5305\u542b\u4e00\u4e9b\u5e10\u6237\u8be6\u7ec6\u4fe1\u606f\uff0c\u5e76\u4ee5 PDF \u683c\u5f0f\u5448\u73b0 \u6587\u4ef6\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.ponybai.com\/?p=4032\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5448\u73b0 PDF \u683c\u5f0f\u7684 Visualforce \u9875\u9762 \u6587\u4ef6 - \u767d\u767d\u968f\u7b14\" \/>\n<meta property=\"og:description\" content=\"\u60a8\u53ef\u4ee5\u4f7f\u7528 PDF \u751f\u6210 Visualforce \u9875\u9762\u7684\u53ef\u4e0b\u8f7d\u3001\u53ef\u6253\u5370\u7684 PDF \u6587\u4ef6 \u6e32\u67d3\u670d\u52a1\u3002\u901a\u8fc7\u66f4\u6539\u6807\u7b7e\u5c06\u9875\u9762\u8f6c\u6362\u4e3a PDF\u3002\u5448\u73b0\u7684 Visualforce \u9875\u9762 PDF\u6587\u4ef6\u8981\u4e48\u663e\u793a\u5728\u6d4f\u89c8\u5668\u4e2d\uff0c\u8981\u4e48\u88ab\u4e0b\u8f7d\uff0c\u8fd9\u53d6\u51b3\u4e8e \u6d4f\u89c8\u5668\u7684\u8bbe\u7f6e\u3002\u5177\u4f53\u884c\u4e3a\u53d6\u51b3\u4e8e\u6d4f\u89c8\u5668\u3001\u7248\u672c\u3001 \u548c\u7528\u6237\u8bbe\u7f6e\uff0c\u5e76\u4e14\u4e0d\u53d7 Visualforce \u7684\u63a7\u5236\u3002\u4ee5\u4e0b\u9875\u9762\u5305\u542b\u4e00\u4e9b\u5e10\u6237\u8be6\u7ec6\u4fe1\u606f\uff0c\u5e76\u4ee5 PDF \u683c\u5f0f\u5448\u73b0 \u6587\u4ef6\u3002\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.ponybai.com\/?p=4032\" \/>\n<meta property=\"og:site_name\" content=\"\u767d\u767d\u968f\u7b14\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-11T12:43:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-05T07:56:05+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2023\/12\/pdf.png\" \/>\n\t<meta property=\"og:image:width\" content=\"816\" \/>\n\t<meta property=\"og:image:height\" content=\"307\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"ponybai\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"ponybai\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/www.ponybai.com\/?p=4032#article\",\"isPartOf\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=4032\"},\"author\":{\"name\":\"ponybai\",\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"headline\":\"\u5448\u73b0 PDF \u683c\u5f0f\u7684 Visualforce \u9875\u9762 \u6587\u4ef6\",\"datePublished\":\"2024-02-11T12:43:55+00:00\",\"dateModified\":\"2023-12-05T07:56:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=4032\"},\"wordCount\":404,\"publisher\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"keywords\":[\"\u5448\u73b0 PDF \u683c\u5f0f\u7684 Visualforce \u9875\u9762 \u6587\u4ef6\"],\"articleSection\":[\"Visualforce \u5f00\u53d1\u4eba\u5458\u6307\u5357\"],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.ponybai.com\/?p=4032\",\"url\":\"http:\/\/www.ponybai.com\/?p=4032\",\"name\":\"\u5448\u73b0 PDF \u683c\u5f0f\u7684 Visualforce \u9875\u9762 \u6587\u4ef6 - \u767d\u767d\u968f\u7b14\",\"isPartOf\":{\"@id\":\"http:\/\/www.ponybai.com\/#website\"},\"datePublished\":\"2024-02-11T12:43:55+00:00\",\"dateModified\":\"2023-12-05T07:56:05+00:00\",\"description\":\"\u60a8\u53ef\u4ee5\u4f7f\u7528 PDF \u751f\u6210 Visualforce \u9875\u9762\u7684\u53ef\u4e0b\u8f7d\u3001\u53ef\u6253\u5370\u7684 PDF \u6587\u4ef6 \u6e32\u67d3\u670d\u52a1\u3002\u901a\u8fc7\u66f4\u6539\u6807\u7b7e\u5c06\u9875\u9762\u8f6c\u6362\u4e3a PDF\u3002\u5448\u73b0\u7684 Visualforce \u9875\u9762 PDF\u6587\u4ef6\u8981\u4e48\u663e\u793a\u5728\u6d4f\u89c8\u5668\u4e2d\uff0c\u8981\u4e48\u88ab\u4e0b\u8f7d\uff0c\u8fd9\u53d6\u51b3\u4e8e \u6d4f\u89c8\u5668\u7684\u8bbe\u7f6e\u3002\u5177\u4f53\u884c\u4e3a\u53d6\u51b3\u4e8e\u6d4f\u89c8\u5668\u3001\u7248\u672c\u3001 \u548c\u7528\u6237\u8bbe\u7f6e\uff0c\u5e76\u4e14\u4e0d\u53d7 Visualforce \u7684\u63a7\u5236\u3002\u4ee5\u4e0b\u9875\u9762\u5305\u542b\u4e00\u4e9b\u5e10\u6237\u8be6\u7ec6\u4fe1\u606f\uff0c\u5e76\u4ee5 PDF \u683c\u5f0f\u5448\u73b0 \u6587\u4ef6\u3002\",\"breadcrumb\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=4032#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.ponybai.com\/?p=4032\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.ponybai.com\/?p=4032#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/www.ponybai.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5448\u73b0 PDF \u683c\u5f0f\u7684 Visualforce \u9875\u9762 \u6587\u4ef6\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.ponybai.com\/#website\",\"url\":\"http:\/\/www.ponybai.com\/\",\"name\":\"\u767d\u767d\u968f\u7b14\",\"description\":\"Salesforce\u5b98\u65b9\u8bb2\u5e08\",\"publisher\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.ponybai.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\",\"name\":\"ponybai\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg\",\"contentUrl\":\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg\",\"width\":248,\"height\":248,\"caption\":\"ponybai\"},\"logo\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/121.37.188.161\"],\"url\":\"http:\/\/www.ponybai.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5448\u73b0 PDF \u683c\u5f0f\u7684 Visualforce \u9875\u9762 \u6587\u4ef6 - \u767d\u767d\u968f\u7b14","description":"\u60a8\u53ef\u4ee5\u4f7f\u7528 PDF \u751f\u6210 Visualforce \u9875\u9762\u7684\u53ef\u4e0b\u8f7d\u3001\u53ef\u6253\u5370\u7684 PDF \u6587\u4ef6 \u6e32\u67d3\u670d\u52a1\u3002\u901a\u8fc7\u66f4\u6539\u6807\u7b7e\u5c06\u9875\u9762\u8f6c\u6362\u4e3a PDF\u3002\u5448\u73b0\u7684 Visualforce \u9875\u9762 PDF\u6587\u4ef6\u8981\u4e48\u663e\u793a\u5728\u6d4f\u89c8\u5668\u4e2d\uff0c\u8981\u4e48\u88ab\u4e0b\u8f7d\uff0c\u8fd9\u53d6\u51b3\u4e8e \u6d4f\u89c8\u5668\u7684\u8bbe\u7f6e\u3002\u5177\u4f53\u884c\u4e3a\u53d6\u51b3\u4e8e\u6d4f\u89c8\u5668\u3001\u7248\u672c\u3001 \u548c\u7528\u6237\u8bbe\u7f6e\uff0c\u5e76\u4e14\u4e0d\u53d7 Visualforce \u7684\u63a7\u5236\u3002\u4ee5\u4e0b\u9875\u9762\u5305\u542b\u4e00\u4e9b\u5e10\u6237\u8be6\u7ec6\u4fe1\u606f\uff0c\u5e76\u4ee5 PDF \u683c\u5f0f\u5448\u73b0 \u6587\u4ef6\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.ponybai.com\/?p=4032","og_locale":"zh_CN","og_type":"article","og_title":"\u5448\u73b0 PDF \u683c\u5f0f\u7684 Visualforce \u9875\u9762 \u6587\u4ef6 - \u767d\u767d\u968f\u7b14","og_description":"\u60a8\u53ef\u4ee5\u4f7f\u7528 PDF \u751f\u6210 Visualforce \u9875\u9762\u7684\u53ef\u4e0b\u8f7d\u3001\u53ef\u6253\u5370\u7684 PDF \u6587\u4ef6 \u6e32\u67d3\u670d\u52a1\u3002\u901a\u8fc7\u66f4\u6539\u6807\u7b7e\u5c06\u9875\u9762\u8f6c\u6362\u4e3a PDF\u3002\u5448\u73b0\u7684 Visualforce \u9875\u9762 PDF\u6587\u4ef6\u8981\u4e48\u663e\u793a\u5728\u6d4f\u89c8\u5668\u4e2d\uff0c\u8981\u4e48\u88ab\u4e0b\u8f7d\uff0c\u8fd9\u53d6\u51b3\u4e8e \u6d4f\u89c8\u5668\u7684\u8bbe\u7f6e\u3002\u5177\u4f53\u884c\u4e3a\u53d6\u51b3\u4e8e\u6d4f\u89c8\u5668\u3001\u7248\u672c\u3001 \u548c\u7528\u6237\u8bbe\u7f6e\uff0c\u5e76\u4e14\u4e0d\u53d7 Visualforce \u7684\u63a7\u5236\u3002\u4ee5\u4e0b\u9875\u9762\u5305\u542b\u4e00\u4e9b\u5e10\u6237\u8be6\u7ec6\u4fe1\u606f\uff0c\u5e76\u4ee5 PDF \u683c\u5f0f\u5448\u73b0 \u6587\u4ef6\u3002","og_url":"http:\/\/www.ponybai.com\/?p=4032","og_site_name":"\u767d\u767d\u968f\u7b14","article_published_time":"2024-02-11T12:43:55+00:00","article_modified_time":"2023-12-05T07:56:05+00:00","og_image":[{"width":816,"height":307,"url":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2023\/12\/pdf.png","type":"image\/png"}],"author":"ponybai","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"ponybai","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.ponybai.com\/?p=4032#article","isPartOf":{"@id":"http:\/\/www.ponybai.com\/?p=4032"},"author":{"name":"ponybai","@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"headline":"\u5448\u73b0 PDF \u683c\u5f0f\u7684 Visualforce \u9875\u9762 \u6587\u4ef6","datePublished":"2024-02-11T12:43:55+00:00","dateModified":"2023-12-05T07:56:05+00:00","mainEntityOfPage":{"@id":"http:\/\/www.ponybai.com\/?p=4032"},"wordCount":404,"publisher":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"keywords":["\u5448\u73b0 PDF \u683c\u5f0f\u7684 Visualforce \u9875\u9762 \u6587\u4ef6"],"articleSection":["Visualforce \u5f00\u53d1\u4eba\u5458\u6307\u5357"],"inLanguage":"zh-Hans"},{"@type":"WebPage","@id":"http:\/\/www.ponybai.com\/?p=4032","url":"http:\/\/www.ponybai.com\/?p=4032","name":"\u5448\u73b0 PDF \u683c\u5f0f\u7684 Visualforce \u9875\u9762 \u6587\u4ef6 - \u767d\u767d\u968f\u7b14","isPartOf":{"@id":"http:\/\/www.ponybai.com\/#website"},"datePublished":"2024-02-11T12:43:55+00:00","dateModified":"2023-12-05T07:56:05+00:00","description":"\u60a8\u53ef\u4ee5\u4f7f\u7528 PDF \u751f\u6210 Visualforce \u9875\u9762\u7684\u53ef\u4e0b\u8f7d\u3001\u53ef\u6253\u5370\u7684 PDF \u6587\u4ef6 \u6e32\u67d3\u670d\u52a1\u3002\u901a\u8fc7\u66f4\u6539\u6807\u7b7e\u5c06\u9875\u9762\u8f6c\u6362\u4e3a PDF\u3002\u5448\u73b0\u7684 Visualforce \u9875\u9762 PDF\u6587\u4ef6\u8981\u4e48\u663e\u793a\u5728\u6d4f\u89c8\u5668\u4e2d\uff0c\u8981\u4e48\u88ab\u4e0b\u8f7d\uff0c\u8fd9\u53d6\u51b3\u4e8e \u6d4f\u89c8\u5668\u7684\u8bbe\u7f6e\u3002\u5177\u4f53\u884c\u4e3a\u53d6\u51b3\u4e8e\u6d4f\u89c8\u5668\u3001\u7248\u672c\u3001 \u548c\u7528\u6237\u8bbe\u7f6e\uff0c\u5e76\u4e14\u4e0d\u53d7 Visualforce \u7684\u63a7\u5236\u3002\u4ee5\u4e0b\u9875\u9762\u5305\u542b\u4e00\u4e9b\u5e10\u6237\u8be6\u7ec6\u4fe1\u606f\uff0c\u5e76\u4ee5 PDF \u683c\u5f0f\u5448\u73b0 \u6587\u4ef6\u3002","breadcrumb":{"@id":"http:\/\/www.ponybai.com\/?p=4032#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.ponybai.com\/?p=4032"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.ponybai.com\/?p=4032#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/www.ponybai.com\/"},{"@type":"ListItem","position":2,"name":"\u5448\u73b0 PDF \u683c\u5f0f\u7684 Visualforce \u9875\u9762 \u6587\u4ef6"}]},{"@type":"WebSite","@id":"http:\/\/www.ponybai.com\/#website","url":"http:\/\/www.ponybai.com\/","name":"\u767d\u767d\u968f\u7b14","description":"Salesforce\u5b98\u65b9\u8bb2\u5e08","publisher":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.ponybai.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883","name":"ponybai","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/","url":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg","contentUrl":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg","width":248,"height":248,"caption":"ponybai"},"logo":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/121.37.188.161"],"url":"http:\/\/www.ponybai.com\/?author=1"}]}},"_links":{"self":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/4032","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4032"}],"version-history":[{"count":1,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/4032\/revisions"}],"predecessor-version":[{"id":4049,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/4032\/revisions\/4049"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/media\/4048"}],"wp:attachment":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4032"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}