We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Resize to Letter creating Blank pages

Hi,


When i Tried to Resize theLegal size pdf to Letter size it is creating Blank Pages in the out put.
I am attaching both the pdf’s. I am using Apose 9.7.0.0 to do this.

But if I use 8.8.0.0 version which is previous version in our system its working.

Could you please help me out

Thanks,


Hi Pradeep,


Thanks
for using our API’s.<o:p></o:p>

I have tested the scenario using Aspose.Pdf for .NET 9.7.0 where I have used following code snippet and I am able to notice that page dimensions are incorrectly being set. For the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-37747. We will investigate this issue in details and will keep you updated on the status of a correction.


For your reference, I have also attached the resultant PDF generated over my end. However I have observed that the output which you have shared is different from my resultant document so it appears that you are using different code snippet. Can you please share the code snippet which you are using, so that we can again test the scenario. We apologize for your inconvenience.

Here is my code snippet:


public void ReSizePdfToLetterSize(string filePath, string outputFilePath)
{
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(filePath);
pdfDocument.Decrypt();
Aspose.Pdf.Facades.PdfPageEditor editor = new Aspose.Pdf.Facades.PdfPageEditor();
// bind source PDF file
editor.BindPdf(pdfDocument);
Aspose.Pdf.PageCollection pageCollection = pdfDocument.Pages;
editor.Zoom = 1f;
double height = 0;
double width = 0;
for (int i = 1; i <= pageCollection.Count; i++)
{
if (editor.GetPageSize(i).Height > height)
height = editor.GetPageSize(i).Height;
if (editor.GetPageSize(i).Width > width)
width = editor.GetPageSize(i).Width;
}

if (height > (double)E_LetterSize.Height)
{
editor.Zoom = (float)E_LetterSize.Height / (float)height;
}
else if (width > (double)E_LetterSize.Width)
{
editor.Zoom = (float)E_LetterSize.Width / (float)width;
}

editor.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center;
editor.VerticalAlignmentType = Aspose.Pdf.VerticalAlignment.Center;

editor.PageSize = new Aspose.Pdf.PageSize((float)E_LetterSize.Width, (float)E_LetterSize.Height);


editor.Save(outputFilePath);

}


Thanks,


Hi Pradeep,


Thanks for sharing the code snippet.

I have tested the scenario and I am able to
notice the same problem. For the sake of correction, I have logged this problem
as PDFNEWNET-37773 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.

Hi,


Did you find any solution.

Thanks,
Pradeep.
Hi Pradeep,

Thanks for your inquiry. I am afraid we have recently noticed the issues and these are pending for investigation due to the issues already under investigation.We will notify you as soon as we made some significant progress towards issues' resolution.

Thanks for your patience and cooperation.

Best Regards,