C# PDF to TIFF Conversion fails because of high Memory Usage

@Manikandan.Murugan

We used 23.7 version of the API and the following code snippet to test the scenario in our environment. We could not notice the OOM Exception. Can you please make sure that you are using the latest version? Also, please let us know about your complete environment details i.e. OS Name and Version, Application Type, RAM Size, etc.

It is also possible that the exception is being thrown due to other Aspose API that is being used. Please try to create a separate console application and test at your end using only Aspose.PDF and let us know in case you find any issues.

Aspose.Pdf.Document _document = new Aspose.Pdf.Document(dataDir + "1.pdf");
TiffSettings options = new TiffSettings();
//options.Compression = CompressionType.CCITT4;
Resolution resolutionObj = new Resolution(200);
options.Shape = ShapeType.None;
options.CoordinateType = PageCoordinateType.MediaBox;
options.Brightness = 0.5F;
TiffDevice tiffDevice = new TiffDevice(resolutionObj, options);
RenderingOptions RenderingOption = new RenderingOptions();
RenderingOption.IgnoreResourceFontErrors = true;


tiffDevice.RenderingOptions = RenderingOption;
using (FileStream imageStream = new FileStream(dataDir + DateTime.Now.Millisecond + @".tif", FileMode.Create))
{
    tiffDevice.Process(_document, imageStream);
    imageStream.Close();
}

Thanks Team,

We will verify and update.

Hi Team,
We only see about 3-5% reduction in the memory usage with the latest Aspose.PDF library as suggested.

OS: Windows Server 2016
RAM: 8GB
Processor Cores: 4
Type: Windows Forms Application
Framework: .NET 4.7

@Manikandan.Murugan

Can you please share the screenshot of the memory consumption at your end? Also, are you using or have you tried using x64 mode of debugging?

Hi Team,

I’ve enclosed the screenshots of the memory consumption using x64 mode for debugging.

Aspose.PDF_23.7.jpg (121.9 KB)
Aspose.PDF_23.6.jpg (127.1 KB)

Thanks

@Manikandan.Murugan

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-55267

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thanks Team,

Could you please share us,

  1. The way we can track the Issue ID.
  2. The duration for the fix to releases and
  3. The difference in fixes for Free vs Paid support?

TIA.

@Manikandan.Murugan

You can check the issue status which is attached at the bottom of this thread. Apart from this, we will also keep you informed via this forum thread about issue progress and status.

Duration for the fix of the issue depends upon various factors. Please note that the issues in the free support model are resolved on a first come first serve basis. Resolution time of the issue depends upon the number of issues logged prior to it as well as nature and complexity of the issue itself. Furthermore, the issues in paid support are dealt with the highest priority and they have precedence over free support issues. In the paid support, immediate resolution of the issue is not guaranteed but investigation against the issue is performed quicker in order to provide fix ETA.

Hi Team,

Thanks for the update!

Hi Team,

Do you have any update on the fix for this Issue?

@Manikandan.Murugan

We are afraid that the earlier logged ticket has not been fully investigated yet. As soon as it is investigated, we will be able to share some updates about it fix or resolution ETA. Please be patient and spare us some time.

We are sorry for the inconvenience.

Thanks for the info.

Please keep us posted.

Hi Team,

Do you have any update on the fix for this Issue?

@Manikandan.Murugan

We are afraid that the earlier logged ticket has not been yet resolved due to other pending issues in the queue. Nevertheless, we have already recorded your concerns and will surely update you as soon as we make some progress towards ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi Team,

Gentle reminder!

Thanks in advance.

@Manikandan.Murugan

Your concerns have already been recorded and we are afraid that we do not have any updates yet regarding ticket resolution. We will certainly inform you as soon as some news is available about issue fix. Please spare us some time.

We apologize for the inconvenience.

Thanks for the update @asad.ali .!

We are to renew the license in Jan-2024. Will the fix be released before that? Also, will the new license have any impact on the .NET Total libraries?

@Manikandan.Murugan

Upgrading your license should not generally have any impact on the .NET Total APIs. Furthermore, we will let you know about the fix ETA for the logged ticket as soon as we complete the investigation.

Thanks @asad.ali !

Hi Team,

We tried 23.10, 23.11 & 23.11.1 and we see the text missing in the output TIFF. Could you please help?

Code snippet for reference:

public MemoryStream ConvertPDFPagetoTIFF(Aspose.Pdf.Document pdfDocument)
{
try
{
pdfDocument.Flatten();
MemoryStream outputStream = new MemoryStream();
/// Create Resolution object
Aspose.Pdf.Devices.Resolution resolution = new Aspose.Pdf.Devices.Resolution(Convert.ToInt32(this.PluginParameters[“Resolution”]));

      /// Create TiffSettings object
      Aspose.Pdf.Devices.TiffSettings tiffSettings = new Aspose.Pdf.Devices.TiffSettings
      {
          Depth = Aspose.Pdf.Devices.ColorDepth.Format8bpp,
          SkipBlankPages = false
      };
      tiffSettings.CoordinateType = Aspose.Pdf.PageCoordinateType.CropBox;
      /// Set TIFF Compression
    
          tiffSettings.Compression = Aspose.Pdf.Devices.CompressionType.LZW;
      
      /// Create TIFF device
      TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
      tiffDevice.FormPresentationMode = Aspose.Pdf.Devices.FormPresentationMode.Editor;
      tiffDevice.RenderingOptions = new RenderingOptions()
      {
          SystemFontsNativeRendering = true,
          UseFontHinting = true,
          ConvertFontsToUnicodeTTF = true
      };
      /// Convert PDF Stream to TIFF Stream
      tiffDevice.Process(pdfDocument, outputStream);
      /// Return the TIFF pages as MemoryStream object
      return outputStream;
  }
  catch (Exception ex)
  {
      throw ex;
  }

}

image.png (3.1 KB)