Embed page from one pdf to another page of different pdf

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
usmanakhtar
User
Posts: 18
Joined: Wed Feb 24, 2016 6:51 pm

Embed page from one pdf to another page of different pdf

Post by usmanakhtar »

Hi,

I am adding page from one pdf file to another page of another pdf file as in following code:

Code: Select all

private void AddImage()
        {
            try
            {

                PDFXEdit.IPXV_Document Doc1 = pdfEditor.Doc;
                if (Doc1 == null)
                    return;
                int nID = pdfEditor.Inst.Str2ID("op.document.addImage", false);
                PDFXEdit.IOperation pOp = pdfEditor.Inst.CreateOp(nID);
                PDFXEdit.ICabNode input = pOp.Params.Root["Input"];
                input.v = Doc1;
                PDFXEdit.ICabNode options = pOp.Params.Root["Options"];                
                options["Pos.top"].v = 200;
                options["Pos.left"].v = 0;
                options["Pos.right"].v = 200;
                options["Pos.bottom"].v = 0;
                options["AlignMode"].v = 1 | 4; //Horizontal and vertical center
                options["AsStamp"].v = false; //Inserting as a part of the content
                PDFXEdit.IAFS_Inst fsInst = (PDFXEdit.IAFS_Inst)pdfEditor.Inst.GetExtension("AFS");
                for (uint idx = 0; idx < Doc1.CoreDoc.Pages.Count; idx++)
                {
                    PDFXEdit.IPXC_Page curPage = Doc1.CoreDoc.Pages[idx];               
                                     
                   PDFXEdit.IAFS_Name destPath = fsInst.DefaultFileSys.StringToName("d:\\stamp.pdf")
                    options["Src"].v = destPath;
                    options["Page"].v = idx;
                    pOp.Do();
                }
                
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
In the above code I am passing path of the pdf file to add on line:

Code: Select all

PDFXEdit.IAFS_Name destPath = fsInst.DefaultFileSys.StringToName("d:\\stamp.pdf")
I want to replace path "d:\\stamp.pdf" with instance of PDFXEdit.IPXC_Page like:

Code: Select all

PDFXEdit.IPXC_Page NewPage = Doc2.CoreDoc.Pages[idx];   
PDFXEdit.IAFS_Name destPath = fsInst.DefaultFileSys.StringToName(NewPage )
Can I do this. If yes kindly provide me with some code sample in c#.

Regards,
Usman Akhtar
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: Embed page from one pdf to another page of different pdf

Post by John - Tracker Supp »

Respectfully usmanakhtar,

What you need to do is indeed possible - but requires a developer with more experience and a greater knowledge of the PDF format than you appear to have and whilst we always strive to help where possible - the level of support you appear to need is beyond what is justifiable and practical to deliver.

I must respectfully suggest you approach your superiors and tell them of your struggles and formulate a plan to either get more help or re-evaluate your intended ambitions as it is not going to be possible for us to provide you with the ongoing support you appear to need to achieve the tasks you are being set.

We cannot provide code samples every time you have a task to achieve effectively lead you to a specific conclusion - you are expected to have to some fundamental skills and knowledge of the PDF format and its construction and in some cases depending on the complexity of the task - these need to be quite considerable - whilst I sympathise that you are struggling with literally 1000's of developers using our toolkits - we cannot realistically hand hold every developer to a conclusion of their tasks throughout the application development every step of the way.

We are here to provide general help and advice to developers who have PDF and demonstrable in depth coding experience and I have to respectfully suggest you are appear to have been set a task that is too demanding for your current levels of experience and we will not be able to help to the extent you appear to need it on an ongoing basis.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
Post Reply