public WPFOpenDocument(string sourceFilename, int frameNumber) { this.sourceFilename = sourceFilename; this.frameNumber = frameNumber; if (this.frameNumber != 0) { throw new Exception("Unable to open page numbers other than 0 for this type of image file."); } D.Assert(this.frameNumber == 0); Stream streamSource = new FileStream(sourceFilename, FileMode.Open, FileAccess.Read, FileShare.Read); BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = streamSource; bitmapImage.CacheOption = BitmapCacheOption.None; bitmapImage.EndInit(); primarySource = new FormatConvertedBitmap(bitmapImage, PixelFormats.Pbgra32, null, 0.0); primarySource.Freeze(); actualBoundingBox = new RectangleF(0f, 0f, primarySource.PixelWidth, primarySource.PixelHeight); boundingBox = SourceMapRendererTools.ToSquare(actualBoundingBox); if (sourceFilename.EndsWith("emf") || sourceFilename.EndsWith("wmf")) { hackRectangleAdjust = 1; } }
public FoxitOpenDocument(string sourceFilename, int pageNumber) { this.sourceFilename = sourceFilename; this.pageNumber = pageNumber; this.foxitViewer = new RemoteFoxitStub(sourceFilename, pageNumber); this.actualBoundingBox = this.foxitViewer.GetPageSize(); this.boundingBox = SourceMapRendererTools.ToSquare(this.actualBoundingBox); }
public GDIOpenDocument(string sourceFilename) { this.sourceFilename = sourceFilename; loadedImage = GDIBigLockedImage.FromFile(sourceFilename); D.Sayf(0, "GDIOpenDocument Image.FromFile({0})", new object[] { sourceFilename }); actualBoundingBox = new RectangleF(default(PointF), loadedImage.Size); boundingBox = SourceMapRendererTools.ToSquare(actualBoundingBox); if (sourceFilename.EndsWith("emf") || sourceFilename.EndsWith("wmf")) { hackRectangleAdjust = 1; } }