Found conflicts between different versions of "WindowsBase" that could not be resolved.

Syncfusion.PdfToImageConverter.Base.dll depends WindowsBase, Version=6.0.0.0


Warning MSB3277 Found conflicts between different versions of "WindowsBase" that could not be resolved.

There was a conflict between "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "WindowsBase, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".

    "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "WindowsBase, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.

  References which depend on "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\8.0.13\ref\net8.0\WindowsBase.dll].




4 Replies

YM Yathavakrishnan Mohan Syncfusion Team February 18, 2025 12:44 PM UTC

Based on the provided information, you are using Syncfusion.PdfToImageConverter.Base.dll for the EJ2 platform. However, Syncfusion.PdfToImageConverter.Base.dll is intended for desktop and MVC applications, such as WPF or WinForms. For EJ2 or Blazor platforms, we need to use the Syncfusion.PdfToImageConverter.Portabl.dll assembly, which is available in the Syncfusion.PdfToImageConverter.Net NuGet package.

Also, please refer the below UG documentation for using the PdfToImageConverter in the ASP.NET Core application,


If following our suggestions does not fix the problem, please provide the below mentioned details. This will help us to proceed further on this and provide you with a better solution.
  • How the PdfToImageConverter is referred? (dll or NuGet)
  • Platform details - Asp.NET, Blazor, or MVC.


HE heliang February 18, 2025 01:00 PM UTC

Syncfusion.PdfToImageConverter.Base.dll provide

Stream Convert(int pageIndex, float dpiX, float dpiY, bool keepTransparency, bool isSkipAnnotations)

but Syncfusion.PdfToImageConverter.Portabl.dll don't


How to convert pdf to image? 300 dpi is required


thanks



YM Yathavakrishnan Mohan Syncfusion Team February 19, 2025 12:15 PM UTC

When using PdfToImageConverter.Base, we can set the DPI values because PdfToImageConverter.Base internally utilizes the System.Drawing assembly for image creation. However, PdfToImageConverter.Portable uses SkiaSharp for image creation, and SkiaSharp does not support customizing the resolution of images based on DPI values. Therefore, it is not possible to use DPI values with PdfToImageConverter.Portable to create custom resolution images, making PdfToImageConverter.Base functions not recommended for the EJ2 platform. However, we will check the possibility of creating images with DPI values in PdfToImageConverter.Portable, and we will provide further details on February 21st, 2025.



YM Yathavakrishnan Mohan Syncfusion Team February 21, 2025 01:59 PM UTC

After further analysis, we have determined that SkiaSharp does not support customizing the resolution of images based on DPI values. Therefore, using DPI values to create images is not possible in PdfToImageConverter.Portable. In PdfToImageConverter.Portable, PDF pages can be converted to images with specific attributes, such as zoom factor, tile dimensions (x and y), and tile matrix coordinates (x and y), by passing the corresponding values as parameters to the Convert API. To enhance image quality, you can use the ScaleFactor property, which can be set to values between 0.5 and 2.  If we adjusting the ScaleFactor does not affect the DPI values of image but changes the image size accordingly. For more details, please refer to the code snippet and User Guide link below.

//Initialize PDF to Image converter.

float zoomFactor = 1;

int tileXCount = 1;

int tileYCount = 1;

int tileX = 0;

int tileY = 0;

 

//Initialize PDF to Image converter.

PdfToImageConverter imageConverter = new PdfToImageConverter();

 

 //ScaleFactor value is set to 2, while the default value is 1.5f.

imageConverter.ScaleFactor = 1.5f;

//Load the PDF document as a stream

FileStream inputStream = new FileStream("D:\\Input.pdf", FileMode.Open, FileAccess.ReadWrite);

imageConverter.Load(inputStream);

//Convert PDF to Image.

Stream outputStream = imageConverter.Convert(0, zoomFactor, tileXCount, tileYCount, tileX, tileY);

MemoryStream stream = outputStream as MemoryStream;

byte[] bytes = stream.ToArray();

using (FileStream output = new FileStream("D:\\outputTilecounts2.png", FileMode.OpenOrCreate, FileAccess.ReadWrite))

{

    output.Write(bytes, 0, bytes.Length);

}

Additionally We have created a sample for the same and attached below for your reference.

 

UG Link :

Converting PDF pages into images in ASP.NET Core| Syncfusion®


Attachment: NETCore_Sample_ddacedd.zip

Loader.
Up arrow icon