This project has moved. For the latest updates, please go here.

Writing Multiple Images to PDF

Mar 2, 2016 at 2:49 AM
Edited Mar 2, 2016 at 3:00 AM
Hello,
I am trying to add a couple images to a PDF file and position them by the Gravity setting however when I do so they always get positioned at x=0 and y=0. I guess I can use the actual XY coordinates to position them if I have but would rather use Gravity if I can. Is there a way to use Gravity? Below is a sampling of the code I am using.
 using (MagickImageCollection PDFdoc = new MagickImageCollection())
{
    
    MagickImage File1= new MagickImage(GlobalVar.DownloadPath + @"\Cover.tif");
        MagickImage FIle2 = new MagickImage(GlobalVar.DownloadPath + @"\Cover.tif");
        PDFdoc.Read(PDFPath);
        foreach (MagickImage PDFPage in PDFdoc)
          {
            PDFPage.Composite(FIle1, Gravity.West, CompositeOperator.Over);
                PDFPage.Composite(File2, Gravity.East, CompositeOperator.Over);
           }
    PDFdoc.Write(PDFPath);
} 
Mar 5, 2016 at 4:02 PM
I am wondering if perhaps on the latest build, Gravity is not functioning like it used to. When I try to position something like this it always gets placed at x=0,y=0 regardless of the gravity settings.
using (MagickImage TestPlacer1 = new MagickImage(new MagickColor(Color.Black), 200, 200))
  {
   CardPage.Composite(TestPlacer1, Gravity.Southeast, CompositeOperator.Over);
  }
using (MagickImage TestPlacer2 = new MagickImage(new MagickColor(Color.Red), 100, 100))
 {
   CardPage.Composite(TestPlacer2, Gravity.Southwest, CompositeOperator.Over);
  }
Coordinator
Mar 5, 2016 at 4:13 PM
Edited Mar 5, 2016 at 4:15 PM
This is indeed a bug that got introduced in the rewrite and I just pushed a patch to the GIT repository to fix this. The next release of Magick.NET will include a fix for this.