DynaPDF Manual - Page 467

Previous Page 466   Index   Next Page 468

Function Reference
Page 467 of 860
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);
Example 3 (WriteAngleText()):
pdfSetPageCoords(PDF, pcTopDown);
double fontSize = 20.0;
pdfAppend(PDF);
pdfSetFont(PDF, "Times", fsItalic, 20.0, true, cp1252);
/*
WriteAngleText() calculates the absolute end point measured in bottom-
up coordinates. Note that the font origin is taken into account. As
long as no further coordinate transformations are applied the
coordinates are directly usable with exception that we must transform
the y-coordinate to top down coordinates in this example.
*/
pdfWriteAngleText(PDF, "Some text...,", 10.0, 150.0, 150.0, 0.0, 0.0);
pdfSetFillColor(PDF, PDF_RED);
// The font size must be subtracted from the y-coordinate coordinate because we are working with top
// down coordinates here.
pdfWriteText(PDF,
pdfGetLastTextPosX(PDF),
pdfGetPageHeight(PDF) - pdfGetLastTextPosY(PDF) - fontSize,
"We are behind the last text line");
pdfEndPage(PDF);
GetLastTextPosXAbs, GetLastTextPosYAbs
Syntax:
Syntax:
double pdfGetLastTextPosXAbs,
double pdfGetLastTextPosYAbs(
const PPDF* IPDF) // Instance pointer
These functions return the absolute end position of the last drawn text after applying coordinate
transformations, if any. The relative end point before applying coordinate transformations is
returned by GetLastTextPosX() / GetLastTextPosY().
 

Previous topic: GetLastTextPosX, GetLastTextPosY

Next topic: GetLaunchAction