Xojo Conferences
MBSOct2019CologneDE

DynaPDF Manual - Page 726

Previous Page 725   Index   Next Page 727

Function Reference
Page 726 of 770
}
int main(int argc, char* argv[])
{
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");
pdfAppend(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
pdfSaveGraphicState(pdf);
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
pdfRestoreGraphicState(pdf);
EndPage(pdf);
pdfCloseFile(pdf);
pdfDeletePDF(pdf); // Do not forget to delete the PDF instance
return 0;
}
Output:
SetTextFieldValue
Sytnax:
SI32 pdfSetTextFieldValue(
const PPDF* IPDF,
// Instance pointer
UI32 Field,
// Text field handle
const char* Value,
// Field's value or NULL
 

Previous topic: How to use text as clipping path?

Next topic: SetTextFieldValueEx, SetTextRect