DynaPDF Manual - Page 176

Previous Page 175   Index   Next Page 177

Function Reference
Page 176 of 839
Example (C):
#include "dynapdf.h"
// First we declare our error callback function
SI32 PDF_CALL PDFError(const void* Data, SI32 ErrCode, const char*
ErrMessage, SI32 ErrType)
{
printf("%s\n", ErrMessage);
return 0;
}
int main(int argc, char* argv[])
{
SI32 tmpl;
void* pdf = pdfNewPDF();
pdfSetOnErrorProc(pdf, NULL, PDFError);
pdfCreateNewPDF(pdf, "c:/cppout.pdf");
pdfSetPageCoords(pdf, pcTopDown);
pdfAppend(pdf);
tmpl=pdfBeginTemplate(pdf,pdfGetPageWidth(pdf),pdfGetPageHeight(pdf));
pdfSetFont(pdf, "Arial", fsItalic, 40, true, cp1252);
pdfWriteFText(pdf, taCenter, "This is a template!");
pdfEndTemplate(pdf);
pdfPlaceTemplate(pdf, tmpl, 0, 0, 0, 0);
pdfPlaceTemplate(pdf, tmpl, 0, 50, 500, 0);
pdfPlaceTemplate(pdf, tmpl, 0, 100, 450, 0);
pdfEndPage(pdf);
pdfCloseFile(pdf);
pdfDeletePDF(pdf);
}
Output:
This is a template!
This is a template!
This is a template!
 

Previous topic: BeginTemplate

Next topic: BeginTransparencyGroup, The Group's Bounding Box