Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Nov 07, 2018 3:40 pm

Hello Dears

I have a PDF file with an unique big image in first page and I'm trying separate the page in 2 page exactaly in the middle.
In the final, I would like 2 files each one with half image from original file...

SPIRE PDF offer a way to do it?

Regards

Eduardo

mattosed
 
Posts: 1
Joined: Wed Aug 24, 2016 12:45 am

Thu Nov 08, 2018 2:34 am

Dear Eduardo,

Thanks for your inquiry.
Sorry that Spire.PDF doesn't support the function.
If there is any other question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Jan 11, 2019 7:33 am

Dear Eduardo,

Glad to inform you there is a workaround to achieve your target. You need to download the latest Spire.PDF Pack(Hot Fix) Version:5.1.4.
Our website link: https://www.e-iceblue.com/Download/down ... t-now.html
NuGet link: https://www.nuget.org/packages/Spire.PDF/5.1.4
Sample code for your kind reference:
Code: Select all
            PdfDocument pdf = new PdfDocument();
            pdf.LoadFromFile(@"F:\ImageInCenter.pdf");
            PdfPageBase page = pdf.Pages[0];

            PdfDocument newPdf = new PdfDocument();
            newPdf.PageSettings.Margins.All = 0;
            newPdf.PageSettings.Width = page.Size.Width/2;
            newPdf.PageSettings.Height = page.Size.Height;
            PdfPageBase newPage = newPdf.Pages.Add();

            PdfTextLayout format = new PdfTextLayout();
            format.Break = PdfLayoutBreakType.FitPage;
            format.Layout = PdfLayoutType.Paginate;

            page.CreateTemplate().Draw(newPage, new PointF(0, 0), format);

            MemoryStream stream = new MemoryStream();
            newPdf.SaveToStream(stream);

            PdfDocument SplitPdf = new PdfDocument(stream);
            //Split one PDF document to multiple files
            String pattern = "SplitDocument-{0}.pdf";

            SplitPdf.Split(pattern);
            String lastPageFileName
                = String.Format(pattern, SplitPdf.Pages.Count - 1);

            newPdf.Close();


Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Jan 18, 2019 6:28 am

Hi,

Greetings from E-iceblue.
Did you use the hotfix and the code?
Has your issue been resolved?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF