Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 509

Previous Page 508   Index   Next Page 510

Function Reference
Page 509 of 750
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 like the font cache and CMap cache. Rebuilding these caches is
a relatively expensive operation and this should be avoided if not necessary. Using the same PDF
instance to create as many PDF files as possible can significantly improve processing speed.
Multiple instances can be used at the same time. However, DynaPDF supports callback functions for
many purposes such as the error handling, content parsing, or to increment a progress bar and so on.
Each PDF instance must use its own copy of a callback function because callback functions cannot be
shared among multiple instances. This is especially important when the application should be
If a PDF instance is no longer needed then it must be deleted with DeletePDF().

Previous topic: MoveTo

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