public void OpenWithConstraints(ref ps.ApplicationClass app, ref ps.Document doc, FileInfo file, double width, double height) { // Set EPS openning options // Open with Width constraint ps.EPSOpenOptionsClass EpsOpenOptsWidth = new ps.EPSOpenOptionsClass(); EpsOpenOptsWidth.AntiAlias = _antiAlias; EpsOpenOptsWidth.ConstrainProportions = _constrainProportions; EpsOpenOptsWidth.Mode = _mode; EpsOpenOptsWidth.Resolution = _resolution; EpsOpenOptsWidth.Width = PsTools.GetPixelUnit(width, _resolution); // Open with Height constraint ps.EPSOpenOptionsClass EpsOpenOptsHeight = new ps.EPSOpenOptionsClass(); EpsOpenOptsHeight.AntiAlias = _antiAlias; EpsOpenOptsHeight.ConstrainProportions = _constrainProportions; EpsOpenOptsHeight.Mode = _mode; EpsOpenOptsHeight.Resolution = _resolution; EpsOpenOptsHeight.Height = PsTools.GetPixelUnit(height, _resolution); doc = app.Open(file.FullName, EpsOpenOptsWidth); if (doc.Height > height) { Close(ref doc); doc = app.Open(file.FullName, EpsOpenOptsHeight); } }
public void OpenWithConstraints(ref ps.ApplicationClass app, ref ps.Document doc, FileInfo file, double width, double height) { //Width Constraint ps.PDFOpenOptionsClass PdfOpenOptsWidth = new ps.PDFOpenOptionsClass(); PdfOpenOptsWidth.AntiAlias = _antiAlias; PdfOpenOptsWidth.BitsPerChannel = _bitsPerChannel; PdfOpenOptsWidth.ConstrainProportions = _constrainProportions; PdfOpenOptsWidth.SuppressWarnings = _suppressWarnings; PdfOpenOptsWidth.CropPage = _cropPage; PdfOpenOptsWidth.Mode = _mode; PdfOpenOptsWidth.Page = _page; PdfOpenOptsWidth.UsePageNumber = _usePageNumber; PdfOpenOptsWidth.Resolution = _resolution; PdfOpenOptsWidth.Width = PsTools.GetPixelUnit(width, _resolution); //Height Constraint ps.PDFOpenOptionsClass PdfOpenOptsHeight = new ps.PDFOpenOptionsClass(); PdfOpenOptsHeight.AntiAlias = _antiAlias; PdfOpenOptsHeight.BitsPerChannel = _bitsPerChannel; PdfOpenOptsHeight.ConstrainProportions = _constrainProportions; PdfOpenOptsHeight.SuppressWarnings = _suppressWarnings; PdfOpenOptsHeight.CropPage = _cropPage; PdfOpenOptsHeight.Mode = _mode; PdfOpenOptsWidth.UsePageNumber = _usePageNumber; PdfOpenOptsHeight.Page = _page; PdfOpenOptsHeight.Resolution = _resolution; PdfOpenOptsHeight.Height = PsTools.GetPixelUnit(height, _resolution); //Open the file doc = app.Open(file.FullName, PdfOpenOptsWidth); if (doc.Height > height) { Close(ref doc); //Open the file doc = app.Open(file.FullName, PdfOpenOptsHeight); } }
public void OpenWithConstraints(ref ps.ApplicationClass app, ref ps.Document doc, FileInfo file, double width, double height) { //Open any bitmap image doc = app.Open(file.FullName); ResizeImageWithConstraints(ref doc, width, height); }