DynaPDF Manual - Page 268

Previous Page 267   Index   Next Page 269

Function Reference
Page 268 of 777
At time of publication this function can be used on Windows only.
The rasterizer uses the error log of the PDF instance to output warnings and error messages but it
does never raise PDF exceptions. So, an error that occurs during rendering does not affect the PDF
file in memory.
Return values:
When the function succeeds the return value is the pointer of the rasterizer object. If the function fails
the return value is NULL.
SI32 pdfCreateRectilinearMeasure(
const PPDF* IPDF,
// Instance pointer
UI32 Viewport,
// Viewport handle (required)
double Scale,
// Scaling factor (required)
const char* UnitDescription,
// Unit description, e.g. "Inch to mm"
const char* LabelDistance,
// Label for the distance tool, e.g. "mm"
const char* LabelArea)
// Label for the area tool, e.g. "mm²"
The function creates a rectilinear measure dictionary. This kind of measure dictionary can be used to
convert PDF units to an arbitrary other unit like millimeters, meters, feets, and so on.
A measure dictionary is used by the measure tool of Adobe's Acrobat and by other PDF viewers
which contain a PDF compatible measure tool.
The parameter Viewport must be a viewport handle that was returned by CreateViewport(). Scale is
the required scaling factor to convert a PDF unit (1/72 inch) to the wished destination unit. The
parameters UnitDescription, LabelDistance, and LabelArea are all required and cannot be NULL.
UnitDescription is a description of the coordinate conversion, e.g. "Inch to mm".
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);
// 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;

Previous topic: CreateRasterizerEx (Rendering Engine)

Next topic: CreateResetAction