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

Notification

Icon
Error

Options
Go to last post Go to first unread
Paul Rayman  
#1 Posted : Tuesday, January 5, 2016 6:11:41 AM(UTC)
Paul Rayman

Rank: Administration

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

Thanks: 5 times
Was thanked: 121 time(s) in 118 post(s)
Question:
How to merge multiple pdf files through Pdfium.Net SDK then printing them.

Answer:
Merging documents is performed using the import pages operation

Code:

public void MergeDocument()
{
    //Initialize the SDK library
    //You have to call this function before you can call any PDF processing functions.
    PdfCommon.Initialize();

    //Open and load a PDF document in which will be merged other files
    using (var mainDoc = PdfDocument.Load(@"c:\test001.pdf"))
    {
        //Open one PDF document.
        using (var doc = PdfDocument.Load(@"c:\doc1.pdf"))
        {
            //Import all pages from document
            mainDoc.Pages.ImportPages(
                doc,
                string.Format("1-{0}", doc.Pages.Count),
                mainDoc.Pages.Count
                );
        }

        //Open another PDF document.
        using (var doc = PdfDocument.Load(@"c:\doc2.pdf"))
        {
            //Import all pages from document
            mainDoc.Pages.ImportPages(
                doc,
                string.Format("1-{0}", doc.Pages.Count),
                mainDoc.Pages.Count
                );
        }

        mainDoc.Save(@"c:\ResultDocument.pdf", SaveFlags.NoIncremental);


    }
    //Release all resources allocated by the SDK library
    PdfCommon.Release();
}


How to print document you can see here

Edited by user Tuesday, January 5, 2016 6:19:10 AM(UTC)  | Reason: Not specified

Ajj  
#2 Posted : Wednesday, November 23, 2016 2:14:55 AM(UTC)
Ajj

Rank: Newbie

Groups: Registered
Joined: 11/23/2016(UTC)
Posts: 2
India

Thanks: 1 times
I have questions regarding pdfium.net sdk

1)How to delete particular page from merged pdf??
2)How to move particular page up or down??
3) How to save newly merged pdf??
Paul Rayman  
#3 Posted : Wednesday, November 23, 2016 8:23:30 PM(UTC)
Paul Rayman

Rank: Administration

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

Thanks: 5 times
Was thanked: 121 time(s) in 118 post(s)
Originally Posted by: Ajj Go to Quoted Post

1)How to delete particular page from merged pdf??
2)How to move particular page up or down??
3) How to save newly merged pdf??


1. Pages.DeleteAt(...)
2. Insert into new position; Delete from old position.
3. doc.Save(..., SaveFlags.NoIncremental);

Edited by user Wednesday, November 23, 2016 8:24:36 PM(UTC)  | Reason: Not specified

thanks 1 user thanked Paul Rayman for this useful post.
Ajj on 11/24/2016(UTC)
Ajj  
#4 Posted : Thursday, November 24, 2016 1:54:58 AM(UTC)
Ajj

Rank: Newbie

Groups: Registered
Joined: 11/23/2016(UTC)
Posts: 2
India

Thanks: 1 times
Thank you so much. Deleting page and Saving merged document functionality working good.
But still getting problem with moving pdf page. i.e. selecting particular page and moving it other location in same pdf
Guest  
#5 Posted : Thursday, November 24, 2016 6:04:36 AM(UTC)
Guest

Rank: Guest

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

Was thanked: 4 time(s) in 4 post(s)
But still getting problem with moving pdf page i.e. selecting particular page and moving it other location in same pdf
How to do that? in code
Users browsing this topic
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.