I have a requirement where the pdf i have has the media box of a smaller size , I need to resize the media box of it but looks like the below code isn’t doing so.
string clientDataDir = @“C:\messed up media and rotation\Original files\J100 Small~5.pdf”;
string correctDataDir = @“C:\tmp\J100.pdf”;
Document correctDoc = new Document(correctDataDir);
Page correctPdfPage = correctDoc.Pages[1];
Document clientDoc = new Document(clientDataDir);
PageCollection clientPageCollection = clientDoc.Pages;
Page clientPdfPage = clientPageCollection[1];
clientPdfPage.SetPageSize(correctPdfPage.MediaBox.Width, correctPdfPage.MediaBox.Height);
Rectangle mediaBox = correctPdfPage.MediaBox;
clientPdfPage.MediaBox = mediaBox;
clientDoc.Save(@"C:\tmp\tmp.pdf");
Please provide the solution.