public void ResizeImageWithConstraints(ref ps.Document doc, double width, double height)
        {
            if (doc.Width/doc.Height<=width/height)
            {
                doc.ResizeImage(Height: height, ResampleMethod: ps.PsPDFResampleType.psPDFBicubic);

            }
            else
            {
                doc.ResizeImage(Width: width, ResampleMethod: ps.PsPDFResampleType.psPDFBicubic);
            }
        }