Playframework 如何在play framework中使用PDF模块中的选项

Playframework 如何在play framework中使用PDF模块中的选项,playframework,pdf-generation,Playframework,Pdf Generation,我想使用用户标题\模板选项。我已经给出了如下内容,但play抛出了一个未找到的错误模板 public class Design extends Controller { public static void renderPDFGen() { Options options = new Options(); options.HEADER_TEMPLATE = "/design/renderPDFHeader"; options.filename = "Invoice

我想使用用户标题\模板选项。我已经给出了如下内容,但play抛出了一个未找到的错误模板

public class Design extends Controller {
public static void renderPDFGen()
    {
    Options options = new Options();
    options.HEADER_TEMPLATE = "/design/renderPDFHeader";
    options.filename = "Invoice";
renderPdf(options);
    }

    public static void renderPDFHeader()
        {
            render();
        }
}

可能是什么错误

您的代码错误。做:

 public static void renderPDFHeader()
 {
    //calculate the contents for the pdf
    String var1, var2;

    //create Options helper
    PDF.Options options = new PDF.Options();
    options.filename="myfile.pdf";
    //etc...

    //render
    renderPdf(options, var1, var2); //note it's renderPDF, not render
 }

您很可能找不到模板,因为Play尝试查找“/views/design/renderPdfHeader.html”,但它不在那里

我得到了预期的文件名,但无法加载标题模板文件我将路径更改为options.HEADER\u Template=“/design/renderPdfHeader.html”;但未找到错误occurs@Arasu如果您正确设置了选项,并且模板存在,它应该可以工作。。。仔细检查路径我在我的播放应用程序内外都给出了绝对路径,但出现了错误