Print Page | Close Window

Set the current transformation matrix

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2798
Printed Date: 23 Dec 25 at 4:11PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Set the current transformation matrix
Posted By: tonyedgecombe
Subject: Set the current transformation matrix
Date Posted: 17 Dec 13 at 12:52PM
Is there a way to set the current transformation matrix so that all subsequent drawing operations are transformed.



Replies:
Posted By: AndrewC
Date Posted: 18 Dec 13 at 8:57AM
Basically the Draw functions add drawing commands to the end of the currently select contentstream.  You can use feature to create your own content stream, see the transformation matrix and start using it.

The quickest and easiest might be to use the following functions.

QP.NewContentStream

QP.SaveState    // saves the current drawing state including transformation matrix.

QP.SetContentStreamFromString(' 10 0 0 10 141.7323 572.5984 cm ');

.... do your drawing here.  Can use any QPL drawing function but it will be affected by the transformation matrix of cours.

QP.LoadState    // restores to original transformation matrix.


Andrew.


Posted By: tonyedgecombe
Date Posted: 19 Dec 13 at 1:14PM
Thanks for that.

I had to replace:
QP.SetContentStreamFromString(' 10 0 0 10 141.7323 572.5984 cm ');

with
QP.SetContentStreamFromString(' q 10 0 0 10 141.7323 572.5984 cm ');


The SaveState method wasn't inserting the q operator, I'm not sure if this is because I'm doing something wrong or if it's a bug.

Tony


Posted By: AndrewC
Date Posted: 19 Dec 13 at 1:42PM
Tony,

The SetContentStreamFromString will replace the entire content stream contents so yes the 'q' is needed and the call to SaveState should be removed.  The 'Q' is appended correctly with the QP.LoadState call and should be used to balance out the initial 'q' - savestate operator.

Andrew.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk