DynaPDF Manual - Page 559

Previous Page 558   Index   Next Page 560

Function Reference
Page 559 of 821
LBOOL pdfMultiplyMatrix(
struct TCTM* M1,
// First transformation matrix
struct TCTM* M2,
// Second transformation matrix
struct TCTM* NewMatrix) // Resulting transformation matrix
The function multiplies two transformation matrices and stores the result in the parameter
NewMatrix. This function is required to calculate the resulting matrix in user coordinate space when
using the functions GetPageText() in combination with WriteTextMatrix().
The two matrices M1 and M2 are multiplied as follows:
NewMatrix->a = M2->a * M1->a + M2->b * M1->c;
NewMatrix->b = M2->a * M1->b + M2->b * M1->d;
NewMatrix->c = M2->c * M1->a + M2->d * M1->c;
NewMatrix->d = M2->c * M1->b + M2->d * M1->d;
NewMatrix->x = M2->x * M1->a + M2->y * M1->c + M1->x;
NewMatrix->y = M2->x * M1->b + M2->y * M1->d + M1->y;
Matrix multiplication is not commutative - the order in which matrices are multiplied is significant.
This function is implemented as native procedure in the interfaces for Visual Basic, Visual Basic .Net
and Delphi.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
void* pdfNewPDF(void)
The function creates a new PDF instance and returns the pointer of it. If there is no sufficient
memory to create the PDF instance the return value is NULL.
To improve processing speed one PDF instance should be used as long as possible. A PDF instance
holds a few important data structures such as the font cache and CMap cache. Rebuilding these
caches is an expensive operation and should be avoided if not necessary. Using the same PDF
instance to create as many PDF files as possible can significantly improve processing speed.
It is possible to use mutliple PDF instances at the same time. Each instance is fully isolated from
each other and thread-safe.
If multiple instances are used in different threads, make sure that code executed in callback
functions, e.g. in the error callback function, is thread safe too. If unsafe code must be executed,
acquire a mutex and lock the thread before calling non-thread safe code.

Previous topic: MovePage, MoveTo

Next topic: OpenImportBuffer, How to keep multiple memory based PDF files open?