Language Bindings
Page 32 of 860
{
printf("%s\n", ErrMessage);
return 0; // Any other return value break processing
}
// Place a button on the form and double click on it. Add the
// following code to the function.
int main(int argc, char* argv[])
{
void* pdf = pdfNewPDF(); // Create a new PDF instance
if (!pdf) return 2; // Out of memory?
// Set the error callback first
pdfSetOnErrorProc(pdf, NULL, PDFError);
pdfCreateNewPDF(pdf, "c:/myfirst.pdf");
pdfSetPageCoords(pdf, pcTopDown); // We use top-down coordinates
pdfAppend(pdf);
pdfSetFont(pdf, "Arial", fsItalic, 40.0, true, cp1252);
pdfWriteFText(pdf, taCenter, "My first C++ output!");
pdfEndPage(pdf);
pdfCloseFile(pdf); // Close the file and free all used resources
pdfDeletePDF(pdf); // Do not forget to delete the PDF instance
}