none
How to merge two A4 xps pages to one A4 page? RRS feed

  • Question

  • i've two A4 xps files, but they're in 1/3A4 format,i want to merge the two A4 xps file into one A4 xps file,how can i do?

    could anyone help me

    Wednesday, June 13, 2018 1:47 AM

All replies

  • Hi leebeing,

    Thank you for posting here.

    For your question, what is the type of your project? How do you want to merge the pages? Using C#? If yes, please provide details about this.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 14, 2018 2:55 AM
    Moderator
  • thank you ,i use C#

    i've two xps files: 11.xps and 22.xps ,i want to translate the content in 22.xps with

                    TranslateTransform tt = new TranslateTransform();
                    tt.X = 10;
                    tt.Y = 300;
                    fixedPage.RenderTransform = tt;


    ,then merge 11.xps and 22.xps to aa.xps,but i donot know how to merge two single page xps files to one page xps file,

    my code  is as follow,it only moves the content in 22.xps, but i donot know how to merge two single page xps  to one single page xps ,could you help me?

    FixedDocumentSequence docSeq;
                {
                    string fileName = @"d:\22.xps";
                    XpsDocument xpsDocument = new XpsDocument(fileName, FileAccess.ReadWrite);
                    docSeq = xpsDocument.GetFixedDocumentSequence();
                    FixedDocument fixedDocument = docSeq.References[0].GetDocument(false);
    
                    PageContent pageContent = fixedDocument.Pages[0];
                    FixedPage fixedPage = pageContent.GetPageRoot(false);
                    Canvas containCanvas = new Canvas();
                    containCanvas.Width = fixedPage.Width;
                    containCanvas.Height = fixedPage.Height/2;
                    containCanvas.Background = Brushes.Red;
                    fixedPage.Children.Add(containCanvas);
                    ScaleTransform st = new ScaleTransform();
                    st.ScaleX = 0.9;
                    st.ScaleY = 0.9;
    
                    TranslateTransform tt = new TranslateTransform();
                    tt.X = 10;
                    tt.Y = 300;
                    fixedPage.RenderTransform = tt;
                    fixedPage.LayoutTransform = st;
                    //fixedPage.UpdateLayout();
                }
                string desFile = @"d:\aa.xps";
    
                if (File.Exists(desFile))
                {
                    File.Delete(desFile);
                }
                {
                    XpsDocument xpsDocument = new XpsDocument(desFile, System.IO.FileAccess.ReadWrite);
                    XpsDocumentWriter xpsDocumentWriter = XpsDocument.CreateXpsDocumentWriter(xpsDocument);
                    xpsDocumentWriter.Write(docSeq);
                    xpsDocument.Close();
                }



    • Edited by leebeing Thursday, June 14, 2018 9:43 AM
    Thursday, June 14, 2018 9:39 AM