DynaPDF Manual - Page 415

Previous Page 414   Index   Next Page 416

Function Reference
Page 415 of 777
/*
Because we use top down coordinates in this example we must transform
the returned y-coordinate to top down coordinates. To achieve this we
must subtract the value from the page height.
The coordinate origin of the text in top down coordinates is normally
the upper left corner. So, we must also subtract the font size because
the provided y-coordinate lies on the text’s baseline.
*/
pdfWriteFTextEx(PDF, 50, 50.0, 200.0, -1.0, taLeft, "Some text that "
"ends on an unknown position...");
pdfSetFillColor(PDF, PDF_RED);
pdfWriteText(PDF,
pdfGetLastTextPosX(PDF),
pdfGetPageHeight(PDF)-pdfGetLastTextPosY(PDF)-fontSize,
"We are behind the last text line");
pdfEndPage(PDF);
Example 2 (Rotated text):
pdfSetPageCoords(PDF, pcTopDown);
pdfAppend(PDF);
pdfSetFont(PDF, "Times", fsItalic, 20.0, true, cp1252);
/*
The coordinate origin that is passed to RotateCoords() is measured in
top down coordinates in this example. However, after the function was
called bottom-up coordinates are active. Because the calculated end
point is measured in bottom-up coordinates too we can directly use the
coordinates to place some text behind the previous string. This works
of course only if the rotated coordinate system is still active.
*/
pdfSaveGraphicState(PDF);
pdfRotateCoords(PDF, 30.0, 150.0, 350.0);
// Note that buttom-up coordinates are now active
pdfWriteFTextEx(PDF, 50, 50.0, 200.0, -1.0, taLeft, "Some rotated text "
"that ends on an unknown position...");
pdfSetFillColor(PDF, PDF_RED);
pdfWriteText(PDF,
pdfGetLastTextPosX(PDF),
pdfGetLastTextPosY(PDF),
"We are behind the last text line");
pdfRestoreGraphicState(PDF);
pdfEndPage(PDF);
 

Previous topic: GetJPEGQuality, GetLanguage, GetLastTextPosX, GetLastTextPosY

Next topic: GetLaunchAction