|
@@ -219,30 +219,12 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
writeableBitmap.WritePixels(new Int32Rect(0, 0, (int)pageRect.Width, (int)pageRect.Height), bmpData, writeableBitmap.BackBufferStride, 0);
|
|
|
writeableBitmap.Freeze();
|
|
|
Application.Current.Dispatcher.Invoke(new Action(() =>
|
|
|
- {
|
|
|
- SaveWriteableBitmapToPng(writeableBitmap, "Output.png");
|
|
|
+ {
|
|
|
ImageSource = writeableBitmap;
|
|
|
|
|
|
}));
|
|
|
}
|
|
|
|
|
|
- static void SaveWriteableBitmapToPng(WriteableBitmap writeableBitmap, string filePath)
|
|
|
- {
|
|
|
- // Create a PngBitmapEncoder
|
|
|
- PngBitmapEncoder encoder = new PngBitmapEncoder();
|
|
|
-
|
|
|
- // Create a memory stream to save the PNG image
|
|
|
- using (MemoryStream stream = new MemoryStream())
|
|
|
- {
|
|
|
- // Save the WriteableBitmap to the memory stream
|
|
|
- encoder.Frames.Add(BitmapFrame.Create(writeableBitmap));
|
|
|
- encoder.Save(stream);
|
|
|
-
|
|
|
- // Write the memory stream to a file
|
|
|
- File.WriteAllBytes(filePath, stream.ToArray());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private double CalculateThumbnailSize(Size size)
|
|
|
{
|
|
|
|