Free Support Forum - aspose.com

Pdf image segmentation

I have a page of 237.91 * 84.21 cm PDF file. I want to split it into four equal PDF files of the same size. Do you have an API interface that can be called here?

@wuyuanchen

Thank you for contacting support.

You may convert a particular page region to image and then convert those images to pages with below code snippet. Please feel free to contact us if you need any further assistance.

        System.Drawing.Image srcImage = System.Drawing.Image.FromFile(path);
        int h = srcImage.Height;
        int w = srcImage.Width;
        Document doc = new Document();
        Page page = doc.Pages.Add();
        Aspose.Pdf.Image image = new Aspose.Pdf.Image();
        image.File = (path);
        page.PageInfo.Height = (h);
        page.PageInfo.Width = (w);
        page.PageInfo.Margin.Bottom = (0);
        page.PageInfo.Margin.Top = (0);
        page.PageInfo.Margin.Right = (0);
        page.PageInfo.Margin.Left = (0);
        page.Paragraphs.Add(image);
        doc.Save(dataDir + "ImagetoPDF_19.11.pdf");