2012-09-10 26 views
2

我正在使用PDFLib引擎来生成PDF文件。我已经使用模板功能的它,我的代码如下:PDFLib模板错误:函数不能在对象范围内调用

/* define the template */ 
template = p.begin_template_ext(width, height, ""); 

...template using text, vector, and image functions... 
p.begin_page(page_width, page_height); 

/* use the template */ 

p.fit_image(template, 0.0, 0.0, ""); 
...more page marking operations... 
p.end_page(); 
... 

p.close_image(template); 

但它给了我这样的错误:

Function must not be called in object scope.

我不知道,我已经做了错误。

谢谢。

回答

1

您还没有放置end_template_ext功能。让你看起来像这样的代码:

/* define the template */ 
template = p.begin_template_ext(template_width, template_height, ""); 
...place marks on the template using text, vector, and image functions... 
p.end_template_ext(0, 0); 
... 
p.begin_page(page_width, page_height); 
/* use the template */ 
p.fit_image(template, 0.0, 0.0, ""); 
...more page marking operations... 
p.end_page(); 
... 
p.close_image(template); 
相关问题