Question:
I have an image which I want to create a PDF from but mirrored, so it is flipped across the Y axis.
Answer:
using (PDFDoc doc = new PDFDoc())
using (ElementBuilder bld = new ElementBuilder())
using (ElementWriter writer = new ElementWriter())
{
Image img = Image.Create(doc, pathToImage);
int imgW = img.GetImageWidth();
int imgH = img.GetImageHeight();
var mtx = new Matrix2D(imgW, 0, 0, imgH, 0, 0);
var mtxFlip = new Matrix2D(-1, 0, 0, 1, imgW, 0); // flip axis, and move image back to 1st quadrant (back into typical PDF page crop box area)
mtx = mtxFlip * mtx;
Element element = bld.CreateImage(img, mtx);
Page page = doc.PageCreate(new Rect(0,0,imgW,imgH));
writer.Begin(page, ElementWriter.WriteMode.e_overlay, false);
writer.WritePlacedElement(element);
writer.End();
doc.PagePushBack(page);
}