logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Guest  
#1 Posted : Saturday, June 25, 2016 12:20:46 AM(UTC)
Guest

Rank: Guest

Groups: Guests
Joined: 1/5/2016(UTC)
Posts: 162

Was thanked: 5 time(s) in 5 post(s)
Hello,

i'm testing th SDK and use the following code to duplicate 2 pages in the same PDF (MainPDFDoc)
before the fist page (index 0)

MainPDFDoc.Pages.ImportPages(MainPDFDoc, "22,23", 0)

I see the memory consumption is rising very fast von 40 MBytes (after loading the 60 pages PDF) to 140 MBytes
when running this function several times. f.e in a loop.

By the way:

Is there a simple way of moving pages (f.e. move page 10 after page 2) in the same PDF.

Paul Rayman  
#2 Posted : Tuesday, June 28, 2016 5:47:48 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Hi,
I will transfer this issue to the developers.
Thank you.

And no. API does not have other ways for page moving.
Paul Rayman  
#3 Posted : Monday, March 26, 2018 7:09:06 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Hi all,

Currently I can suggest the following workaround.

Code:

static void SimpleImport()
{
    using (var dst = PdfDocument.Load(@"d:\0\1.pdf"))
    {
        var src = PdfDocument.Load(@"d:\0\100ThousandPages.pdf");
        int cnt = src.Pages.Count;
        for (int i = 0, j=0; i < cnt; i++, j++)
        {
            //Process sourcePage
            var scrPage = src.Pages[i].Handle;
            //Import page
            dst.Pages.ImportPages(src, (i+1).ToString(), dst.Pages.Count - 1);
            //DisposePage
            src.Pages[i].Dispose();

            if(j>20)
            {
                j = 0;
                src.Dispose();
                src = PdfDocument.Load(@"d:\0\100ThousandPages.pdf");
                Console.WriteLine(i);
            }
        }
        src.Dispose();
        dst.Save(@"d:\0\imported.pdf", Patagames.Pdf.Enums.SaveFlags.NoIncremental);
    }
}

Edited by user Monday, March 26, 2018 7:17:58 AM(UTC)  | Reason: Not specified

Users browsing this topic
Guest (3)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.