We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Pdf Issue

We recently upgraded to v8.0 of Aspose.Pdf (.NET). We’re noticing an issue while trying to create an image of a given PDF document’s first page. The error appears to be occurring while executing the Process method of GifDevice class. Below is the error information:

System.ArgumentException: Parameter is not valid.
at System.Drawing.Bitmap…ctor(Int32 width, Int32 height, PixelFormat format)
at .…ctor(? , )
at ..?(? , )
at .?.(? , ? , , ? , )
at .?.?(? )
at .?.( , )
at ..?( , , )
at ..( ) at .?.?( , ArrayList )
at .?.(? , , ? )
at ..?()
at Aspose.Pdf.Devices.GifDevice.Process(Page page, Stream output)

Here is the function that is used to create the image:
Public Shared Function CreateFirstPageImage(ByVal sInputPdfFileName As String) As String
Dim sDestFileName As String = sInputPdfFileName + WEB_IMAGE_EXTS.Keys(3)
’ changed from 0 (PNG) to 3 (GIF) for TR-409
Const FIRST_PAGE As Integer = 1
Const RES_VALUE As Integer = 300
Const MULTIPLIER As Double = 1.5
’ this is used to expand the dimensions of the pdf image

Dim oASPOSELicense As Aspose.Pdf.License = New Aspose.Pdf.License

Dim pdfDocument As New Document(sInputPdfFileName)
Dim pdfPageCollection As PageCollection = pdfDocument.Pages

Dim pdfPage = pdfPageCollection(FIRST_PAGE)
Dim resolution As New Devices.Resolution(RES_VALUE)
Dim widthBuff As Double = pdfPage.ArtBox.Width * MULTIPLIER
Dim heightBuff As Double = pdfPage.ArtBox.Height * MULTIPLIER
Dim fppGif As New Devices.GifDevice(CInt(widthBuff), CInt(heightBuff), resolution)
Dim newFirstPagePreview As New FileStream(sDestFileName, FileMode.Create)
fppGif.Process(pdfPage, newFirstPagePreview)

Return sDestFileName
End Function

Any help to resovle this issue is greatly appreciated.

Hi Manoj,

Thanks for contacting support and sorry for the delayed response.

Can you please share the source PDF file causing this problem so that we can test the scenario at our end. We are really sorry for this inconvenience.


I have attached the file our customer provided us.



Hi Manoj,

Sorry for the inconvenience faced. While using the latest version of Aspose.Pdf for NET 8.2.0, I've managed to reproduce this issue on my side and logged the issue in our bug tracking system as PDFNEWNET-35588 for further investigation and resolution. I've also linked your request to this issue and you will be notified via this thread as soon as it is resolved.

Please feel free to contact us for any further assistance.

Best Regards,

Any updates on the resolution?

Hi Manoj,

Thanks for your patience.

I am pleased to share that the issue reported earlier has been fixed in latest release of Aspose.Pdf for .NET 8.3.0. Please try using the latest release and in case you encounter any issue or you have any further query, please feel free to contact.