Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Help with DrawImageMatrix
  FAQ FAQ  Forum Search   Register Register  Login Login

Help with DrawImageMatrix

 Post Reply Post Reply
Author
Message
kaiken1987 View Drop Down
Beginner
Beginner
Avatar

Joined: 27 Jan 12
Location: United States
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote kaiken1987 Quote  Post ReplyReply Direct Link To This Post Topic: Help with DrawImageMatrix
    Posted: 12 Apr 12 at 7:34PM
I'm trying to use DrawImageMatrix but I can't get the image to display.
I assume that the parameters work so that
x' = x*m11+y*m12+mdx
y' = x*m21+y*m22+mdy
so if run with DrawImageMatrix(1,0,0,1,0,0) is should draw at the origin at its original size and orientation however nothing shows up in the output pdf. If I do a normal DrawImage it displays fine and DrawImageMatrix returns no error.

example code
 
QP->NewDocument();
QP->SetPageDimensions(3900,2400);
QP->SelectPage(1);
QP->SetOrigin(1);
QP->AddImageFromFile(L"test.tif",0);
QP->DrawImageMatrix(1,0,0,1,0,0);
QP->SaveToFile(L"Test.pdf");
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 13 Apr 12 at 11:57AM

The last two parameters are x,y so experiment with those first...  The image will be scaled to 1pt x 1pt so increase the 1 values to width and height values.

  QP.DrawImageMatrix(100, 0, 0, 100, 300, 300);

Here is some code that generates an interesting pattern.  This code is not mine so I cannot tell you how the parameters were created.

            QP.CompressImages(1);
            int ImageID = QP.AddImageFromFile("aldi.bmp", 0);
            QP.SelectPage(1);
            QP.SelectImage(ImageID);

            QP.DrawImageMatrix(100, 0, 0, 100, 300, 300);


            QP.DrawImageMatrix(152.44,
                        60.9762,
                        -1.53974,
                        72.7334,
                        55.8672,
                        543);
            QP.DrawImageMatrix(151.872,
                        63.3877,
                        -124.567,
                        98.8179,
                        179.203,
                        443.602);
            QP.DrawImageMatrix(154.612,
                        63.9774,
                        -125.495,
                        75.8196,
                        179.204,
                        540.918);
            QP.DrawImageMatrix(153.172,
                        63.6644,
                        0,
                        98.6157,
                        178.163,
                        444.123);

            QP.SaveToFile("out.pdf");
            Process.Start(@"out.pdf");

Back to Top
fellafoo View Drop Down
Beginner
Beginner


Joined: 21 May 22
Location: Simsbury, CT
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote fellafoo Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 22 at 4:51PM
In the Adobe PDF Reference, search for Common Transformations.
It's in section 8.3.3 of the PDF 1.7 document:

For example:

SetMeasurementUnits(0);
Note: I've gotten unexpected results using millimeters or inches.

For Translation (Move X / Move Y from Origin (Left, Bottom))...
DrawImageMatrix(ImageWidth * 1, 0, 0, ImageHeight * 1, MoveX, MoveY)

For Scaling (Enlarge X / Enlarge Y)...
DrawImageMatrix(ImageWidth * Enlargement, 0, 0, ImageHeight * Enlargement, 0, 0)

For Rotations (Counter-clockwise Angle around origin)...
DrawImageMatrix(ImageWidth * Cos(Angle * Pi / 180), ImageWidth * Sin(Angle * Pi / 180), ImageHeight * - Sin(Angle * Pi / 180), ImageHeight * Cos(Angle * Pi / 180), 0, 0)

For Skew (ImageWidth * 1, Tan(AngleX * Pi / 180), Tan(AngleY * Pi / 180), ImageHeight * 1, 0, 0)

FWIW,

MFM
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3443
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 22 at 8:26PM
Hi :)


you should have a look at:

SetOrigin:
https://www.debenu.com/docs/pdf_library_reference/SetOrigin.php
SetGlobalOrigin:
https://www.debenu.com/docs/pdf_library_reference/SetGlobalOrigin.php
SetMeasurementUnits:
https://www.debenu.com/docs/pdf_library_reference/SetMeasurementUnits.php
SetGlobalMeasurementUnits:
https://www.debenu.com/docs/pdf_library_reference/SetGlobalMeasurementUnits.php
 
This are functions from the measurement and coordinate unit:
https://www.debenu.com/docs/pdf_library_reference/SetGlobalMeasurementUnits.php
Think there you'll find a solution for your issues...


Cheers,
Ingo

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store