Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Fri Feb 09, 2024 1:41 pm

We are trying to merge multiple PDFs into one but could not succeed. When analysed found that multiple orientation are there. One file has portrait and other has landscape. How to merge this kind of files?

It was showing object reference error and found the below error in stack trace

at Ἔ.ᜂ(ᝨ A_0)
at Ἔ.ᜀ(ᝨ A_0, Boolean A_1)
at Ἔ.ᜀ(ᝨ A_0)
at Ἔ.ᜂ(ᝨ A_0)
at Ἔ.ᜀ(ᝨ A_0, Boolean A_1)
at ៎.ᜀ(ᝨ A_0)
at ᩥ.ᜀ(ᰝ A_0, ᭐ A_1, ᶠ A_2)
at ᩥ.ᜀ(ᰝ A_0, ᶠ A_1)
at ᩥ.ᜄ(ᶠ A_0)
at ᩥ.ᜅ(ᶠ A_0)
at ᣿.ᜁ(ᶠ A_0)
at ᣿.ᜂ(Stream A_0)
at Spire.Pdf.PdfDocumentBase.Save(String filename)
at Spire.Pdf.PdfDocument.SaveToFile(String filename)

Any help on this would be greatly appreciated

syedmydeen
 
Posts: 32
Joined: Thu May 17, 2018 9:01 am

Mon Feb 12, 2024 3:48 am

Hi,

Thanks for your inquiry.
For most of Pdf file, if page rotation of pdf is 0 or 180, we can see the page orientation is portrait, and if page rotation of pdf is 90 or 270, the page orientation is landscape, so you can reset rotation of page before merging pdf to achieve the effect you want, I put the code snippet below for your reference. If the following code doesn’t help you, please offer your Pdf file for doing further investigation, you can attach it here or sent it via email([email protected]).
For the exception issue, do you use the latest version of Spire.Pdf for Net (V 10.2.2) to test your scenario? If don’t, please update to it and have a test, if the issue still exists, please offer the code that can reproduce your issue and your input Pdf files.

Code: Select all
  PdfDocument pdf = new PdfDocument();
            pdf.LoadFromFile(@"../../data/test.pdf");

            foreach (PdfPageBase page in pdf.Pages)
            {
                Console.WriteLine((int)page.Rotation);

                if (page.Rotation != 0)
                {
                    // Reset rotation
                    page.Rotation = 0;
                }
            }

           // Merge Pdf ..........


Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Fri Feb 16, 2024 2:48 pm

Thank you for your kind reply. I will check it in my end and will post response

syedmydeen
 
Posts: 32
Joined: Thu May 17, 2018 9:01 am

Sun Feb 18, 2024 1:39 am

Hi,

Okey, I am looking forwarding to receive your reply.

Sincerely
Abel
E-iceblue support team.
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.PDF