DynaPDF Manual - Page 284
Previous Page 283 Index Next Page 285

Function Reference
Page 284 of 821
LabelDistance is the label for the distance tool, e.g. "mm".
LabelArea is the label for the area tool, e.g. "mm²".
Example (C++):
PPDF* pdf = pdfNewPDF();
if (!pdf) return -1; // Out of memory?
pdfCreateNewPDF(pdf, "e:/cppout.pdf");
// We use top down coordinates in this example
pdfSetPageCoords(pdf, pcTopDown);
pdfAppend(pdf);
// Just a test object of a known size that can be measured...
pdfSetLineWidth(pdf, 0.5);
pdfRectangle(pdf, 50.0, 50.0, 144, 72.0, fmStroke);
TPDFRect bbox;
pdfGetBBox(pdf, pbMediaBox, bbox);
SI32 vp = pdfCreateViewport(
pdf,
// Instance pointer
NULL,
// Optional viewport name
bbox.Left,
// Lowever left corner
bbox.Bottom,
// Lowever left corner
bbox.Right,
// Upper right corner
bbox.Top);
// Upper right corner
pdfCreateRectilinearMeasure(
pdf,
// Instance pointer
vp,
// Viewport handle
25.4/72.0,
// Conversion factor from 1/72 inch to mm
"inch to mm",
// Description of the measure dictionary
"mm",
// Unit label for the distance tool
"mm²");
// Unit label for the area tool
pdfEndPage(pdf);
pdfCloseFile(pdf);
pdfDeletePDF(pdf);
Remarks:
This function is implemented in an Ansi and Unicode compatible variant.
Return values:
If the function succeds the return value is a measure handle, a value greater or equal zero. If the
function fails the return value is a negative error code.
Previous topic: CreateRectilinearMeasure
Next topic: CreateResetAction, CreateSeparationCS