How To Transform Images Using PDF Mosaic Library

This sample shows how to use such methods as:

  • SkewTransform – Skews the x axis by an angle alpha and the y axis by an angle beta.
  • RotateTransform – Applies the specified rotation to the transformation matrix.
  • ScaleTransform – Applies the specified scaling operation to the transformation matrix.
  • TranslateTransform – Changes the origin of the coordinate system by prepending the specified translation to the transformation matrix.

Image manipulations

 

PDFDocument document = new PDFDocument();
document.Pages.Add(new PDFPage(PDFPaperFormat.A4));
PDFCanvas canvas = document.Pages[0].Canvas;
PDFImage image = new PDFImage("..\\..\\two_pilots.bmp");

canvas.SkewTransform(25, 25);
canvas.DrawImage(image, 10, 10, image.Width / 2, image.Height / 2);

canvas.SkewTransform(-35, -35);
canvas.DrawImage(image, image.Width * 2, image.Height, image.Width / 2, image.Height / 2);

canvas.SkewTransform(15, 15);
canvas.RotateTransform(45);
canvas.DrawImage(image, 750, -300, image.Width / 2, image.Height / 2);

document.Save("ImageManipulations.pdf", true);