PDF Mosaic: How to transform images using PDF Mosaic library


Home       Features       Download       Tutorial       Version History       License       PDF Mosaic Blog       Source Code

 

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.

Changing the origin of the coordinate system by prepending the specified translation to the transformation matrix in PDF Mosaic library
 

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);

 


Home       Features       Download       Tutorial       Version History       License       PDF Mosaic Blog       Source Code