wrong orientation

Hello,
I loaded a PDF file using the follow piece of code:

var byteArray = Convert.FromBase64String(documentBase64);
var loadedDocument = new PdfLoadedDocument(byteArray);
then I get the page dimensions using:

PageDetails = (loadedDocument.Pages.Cast<PdfPageBase>()
.Select((documentPage, i) => new PageDetails
{
Height = documentPage.Size.Height,
Width = documentPage.Size.Width,
PageNumber = i + 1
})).ToArray(),
TotalPages = loadedDocument.PageCount
But, I realized that for a landscape page, the height was greater than the width.
How this is possible?

3 Replies 1 reply marked as answer

SL Sowmiya Loganathan Syncfusion Team March 18, 2021 12:57 PM UTC

  

Hi MATHEUS,   

Thank you for contacting Syncfusion support.   

We have analyzed your query “For the particular PDF (landscape page), the height was greater than the width” and suspect that the document page may be rotated. Could you please provide us the input PDF document, it will be helpful for further analysis and provide the better solution on this.   

Regards,  
Sowmiya Loganathan  




MJ MATHEUS JOSE PENA REIS March 18, 2021 01:05 PM UTC

Hello, unfortunately my boss doesn't allow me to send the document, due to some sensitive information.
How can I know if the document is rotated or don't?


SL Sowmiya Loganathan Syncfusion Team March 19, 2021 12:23 PM UTC

Hi MATHEUS,   
  
We can able to find the rotation of the PDF page by using the below code snippet,   
  
//Load PDF document   
 PdfLoadedDocument loadedDocument = new PdfLoadedDocument(pdfStream);  
  
 //Get the page rotation   
 for(int i=0;i<loadedDocument.Pages.Count;i++)  
 {  
     //Get the page  
     PdfLoadedPage loadedPage = loadedDocument.Pages[i] as PdfLoadedPage;  
  
     //Get the rotation   
     PdfPageRotateAngle rotation = loadedPage.Rotation;  
 }  
  
However, can you please send the PDF document in mail to [email protected] since we have an NDA (Non-Disclosure Agreement) in place with our customers and we maintain the confidentiality of the information disclosed by our customers to us. Therefore, any documents shared with Syncfusion will only be used to replicate the issue and will not be shared with anyone else.   
  
Please let us know if you have any concerns on this.   
  
Regards,  
Sowmiya Loganathan  
 


Marked as answer
Loader.
Up arrow icon