Generic GDI error on PDF to TIFF conversion

I have a generic GDI exception on a vector PDF, I attach it, my code is:

 Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(streamInput);
 bool IsLandscape = IsPageLandscape(pdfDocument.Pages.First());
 var bookmarkEditor = new Aspose.Pdf.Facades.PdfBookmarkEditor();
 bookmarkEditor.BindPdf(pdfDocument);
 MemoryStream streamBookmark = new MemoryStream();
 bookmarkEditor.ExportBookmarksToXML(streamBookmark);

 Resolution resolution = new Resolution(_conversionConfig.Tiff_DPI);
 TiffSettings tiffSettings = new TiffSettings();
 tiffSettings.Compression = CompressionType.None;
 tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Default;
 tiffSettings.Shape = IsLandscape ? ShapeType.Landscape : ShapeType.Portrait;
 tiffSettings.SkipBlankPages = _conversionConfig.Tiff_SkipBlankPages;

 TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);

 using (ZipArchive oArchive = new ZipArchive(streamOutput, ZipArchiveMode.Create, true))
 {
     int idx = 0;

     using (MemoryStream streamTiff = new MemoryStream())
     {
         tiffDevice.Process(pdfDocument, streamTiff);

error occours on tiffDevice.Process call

F11252-0000.dwg.pdf (1.4 MB)

@ilbarzo

A generic GDI exception during PDF to TIFF conversion can occur for several reasons. Here are some troubleshooting steps you can take:

  1. Check File Permissions: Ensure that your application has the necessary permissions to read the PDF file and write the TIFF file to the specified directory.

  2. Verify Input File: Make sure the PDF file is not corrupted. Open it with a PDF viewer to confirm it displays correctly.

  3. System Resources: Ensure your system has enough memory and resources available, as GDI exceptions can occur when resources are low.

  4. Correct Output Path: Verify that the output path for the TIFF file is valid and writable.

  5. Update Aspose.PDF Library: Ensure you are using the latest version of the Aspose.PDF library, as newer releases may fix bugs.

  6. Use Try-Catch Blocks: Wrap your conversion code in try-catch blocks to catch specific exceptions and log detailed error messages for further diagnosis.

  7. Investigate Image Settings: If you are using specific settings for the image conversion (like resolution, color depth, etc.), try simplifying them to see if the error persists.

  8. Check for GDI+ Issues: If your application runs in a restricted environment (like a web application), you might face GDI+ limitations. Consider running your code in a different environment to isolate the issue.

If the problem continues after checking these factors, consider reaching out to Aspose support with detailed information about your environment and the specific code snippet you are using for the conversion.