Page size doesn't set for some page sizes in Word document

This is my code for setting page size

if (!string.IsNullOrEmpty(manifest.Input.PageSetup.Size))
{
string pageSize = manifest.Input.PageSetup.Size.ToUpper();
switch (pageSize)
{
case “STATEMENT”:
ps.PaperSize = Aspose.Words.PaperSize.Statement;
break;
case “A3”:
ps.PaperSize = Aspose.Words.PaperSize.A3;
break;
case “A4”:
ps.PaperSize = Aspose.Words.PaperSize.A4;
break;
case “A5”:
ps.PaperSize = Aspose.Words.PaperSize.A5; ;
break;
case “B4”:
ps.PaperSize = Aspose.Words.PaperSize.B4;
break;
case “B5”:
ps.PaperSize = Aspose.Words.PaperSize.B5;
break;
case “LETTER”:
ps.PaperSize = Aspose.Words.PaperSize.Letter;
break;
case “LEGAL”:
ps.PaperSize = Aspose.Words.PaperSize.Legal;
break;
case “TABLOID”:
ps.PaperSize = Aspose.Words.PaperSize.Tabloid;
break;
case “EXECUTIVE”:
ps.PaperSize = Aspose.Words.PaperSize.Executive;
break;
default:
ps.PaperSize = Aspose.Words.PaperSize.A4;
break;
}
}

But in this document conversion setting page size B4 and B5 doesn’t work all others are ok.

@Duminda

Please confirm you are using Aspose.Words on-premise API or cloud API and also share some more details (screenshot) of the error.