Break EMF metafile into multiple pages

Hi,
I can currently scale an EMF to one page. Now I would like to break the EMF into multiple pages.
I am thinking of using the ImageData Crop properties (shape object) to show the part of the image that should be on a page and inserting a new shape for each page.
Is this a sensible approach or is there a simpler or more efficient way I’ve missed…
Thanks in advance…
Regards, Bruce

Hi Bruce,

Thanks for your request. I think, cropping is the simplest way to achieve this. Here is code example:

// Create an empty document and DocumentBuilder.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Image img = Image.FromFile(@"Common\large.jpg");
// Calculate size available on the page.
PageSetup ps = doc.FirstSection.PageSetup;
double pageWidth = ps.PageWidth - ps.LeftMargin - ps.RightMargin;
double pageHeight = ps.PageHeight - ps.TopMargin - ps.BottomMargin;
// Get size of the image in point units.
double imgWidth = ConvertUtil.PixelToPoint(img.Width, img.HorizontalResolution);
double imgHeight = ConvertUtil.PixelToPoint(img.Height, img.VerticalResolution);
// Split image into parts and insert into the document.
double currentHeight = 0;
while (currentHeight <imgHeight)
{
    // Calculate top and bottom crop.
    // The amount of cropping can range from -1.0 to 1.0.
    double cropTop = currentHeight / imgHeight;
    double cropBottom = (imgHeight - pageHeight - currentHeight) / imgHeight;
    cropBottom = cropBottom <0 ? 0 : cropBottom;
    double currentWidth = 0;
    while (currentWidth <imgWidth)
    {
        // Calculate left and right crop.
        double cropLeft = currentWidth / imgWidth;
        double cropRight = (imgWidth - pageWidth - currentWidth) / imgWidth;
        cropRight = cropRight <0 ? 0 : cropRight;
        // Insert image.
        Shape shape = builder.InsertImage(img);
        shape.ImageData.CropTop = cropTop;
        shape.ImageData.CropBottom = cropBottom;
        shape.ImageData.CropLeft = cropLeft;
        shape.ImageData.CropRight = cropRight;
        shape.Width = imgWidth * (1 - cropLeft - cropRight);
        shape.Height = imgHeight * (1 - cropTop - cropBottom);
        currentWidth = imgWidth * (1 - cropRight);
    }
    currentHeight = imgHeight * (1 - cropBottom);
}
// Save output docuemnt.
doc.Save(@"Test001\out.doc");

Hope this helps.
Best regards.

Hi,
Absolutely brilliant!!! The example works fine!!!
Many Thanks!!!
Regards, Bruce