DynaPDF Manual - Page 793

Previous Page 792   Index   Next Page 794

Function Reference
Page 793 of 839
void* pdf = pdfNewPDF();
if (!pdf) return 2; // Out of memory?
pdfSetOnErrorProc(pdf, NULL, PDFError);
// The document info entries are changed by the function if set
pdfSetDocInfo(pdf, diSubject, "Text as clipping path");
pdfSetDocInfo(pdf, diCreator, "C++ example test project");
pdfSetDocInfo(pdf, diTitle, "Text as clipping path");
pdfSetPageCoords(pdf, pcTopDown);
pdfCreateNewPDF(pdf, "c:/cppout.pdf");
pdfSetFont(pdf, "Bookman Old Style", fsBold, 80, true, cp1252);
// We want to draw an axial shading into the clipping path
SI32 sh = pdfCreateAxialShading(pdf, 0, 50, 0, 130, 1, PDF_BLUE,
PDF_YELLOW, false, false);
// Do not forget to save the graphics state
pdfSetTextDrawMode(pdf, dmClipping); // Use the text as clipping path
pdfWriteText(pdf, 50, 50 - (80 - pdfGetCapHeight()), "Clipping");
pdfApplyShading(pdf, sh);
// Restore the graphics state now to disable the clipping path
pdfDeletePDF(pdf); // Do not forget to delete the PDF instance
return 0;

Previous topic: How to use text as clipping path?

Next topic: SetTextFieldValue, Field format