2012-09-10 4 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); 
: 같이 보입니다 당신의 코드를 확인