Question

I'm using PDFLib engine to generate the pdf files. I have used template feature of it and my code is as follow:

/* 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);

But it gives me an error like:

Function must not be called in object scope.

I'm not sure where I have done the mistake.

Thanks.

Was it helpful?

Solution

You have not placed the end_template_ext function. Make you code that looks something like:

/* 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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top