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,099

Thanks: 7 times
Was thanked: 128 time(s) in 125 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,099

Thanks: 7 times
Was thanked: 128 time(s) in 125 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: 163

Was thanked: 5 time(s) in 5 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
nghyemi  
#6 Posted : Tuesday, August 29, 2023 3:00:48 AM(UTC)
nghyemi

Rank: Newbie

Groups: Registered
Joined: 8/29/2023(UTC)
Posts: 1
Germany

I've extracted 2 pages of a 15 page document and merged it to a new document like described. The size of the document (2 pages) is larger than original document (15 pages). How is this possible? Is there a possibilty to reduce the size of PDF document?
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.