Exception: Parameter not valid when convert MPP to PDF (C# .NET)

Hi,
There is error message -Parameter not valid when convert MPP to PDF in Aspose.Tasks DLL for .Net.
And we understood that there is Bitmap image issue in MPP file, but cannot find the where is the error in file.
Provide me solution on this.

Code:
Aspose.Tasks.Project(x.InputStream)

System.ArgumentException was caught
HResult=-2147024809
Message=Parameter is not valid.
Source=System.Drawing
StackTrace:
at System.Drawing.Bitmap…ctor(Int32 width, Int32 height, PixelFormat format)
at …ctor(Int32 , Int32 , Single , Single , PixelFormat )
at …ctor(Int32 , Int32 , Single , Single )
at …ctor(Int32 , Int32 )
at . ( , )
at . ( )
at ​ . ( , Boolean )
at ​ . ( )
at . ( )
at . ( )
at . ( )
at . ( )
at . ( )
at . ( )
at . ( )
at . ( )
at . ( )
at . ( )
at . ()
at . (Project , Stream )
at . (Stream , SaveOptions )
at Aspose.Tasks.Project.Save(Stream stream, SaveOptions options)
Thanks

@rajsirangu,

Can you please share source file so that we may further investigate to help you out.

Hi Adnan.Ahmad,

Thank you for your reply

Not_Merging_MSP.zip (43.2 KB)

Please find the attached MPP file.

Thanks

@rajsirangu,

I have worked with source file shared by you and unable to observe issue. I have also shared my generated result with you for your kind reference. Can you please share which Aspose.Tasks version you used on your end. MSP.pdf (68.0 KB)

Hi Adnan,

we are using Aspose.Tasks version of DLL is- 17.12.0.0 and this is licence of Aspose.Total for .NET
I have attached .Net code below for reference.

.Net Code to Generate PDF :

Dim taskStream As MemoryStream = New MemoryStream()
Dim projectTask As _
New Aspose.Tasks.Project(x.InputStream)
If x.InputStream.Length > 0 Then
Dim saveOptions As New Aspose.Tasks.Saving.PdfSaveOptions()

                        saveOptions.FitContent = True
                      
                        projectTask.Save(taskStream, saveOptions) //Exception is coming here
                       taskStream.Position = 0

Thanks

@rajsirangu,

Please try to use Aspose.Tasks latest version 19.6.1 on your end and share feedback with us if there is still an issue.

Thank you it is working with New version 19.6.1 with out license file in my local system, when we have applied with license file it gives error message like “The subscription included in this license allows free upgrades until 11 Feb 2019, but this version of the product was released on 11 Jun 2019. Please renew the subscription or use a previous version of the product.”.

Old license is working for other conversion, Word, excel, ppt etc…

What we do next… Please suggest.

Thanks

Continue on my previous post,PDF file is generated but some content is missing in the file after conversion from MPP.But we need file should be like this-Document.pdf (416.9 KB).
And We are able to generate correct PDF file from Old version 17.12.0 without license applied in the code.

@rajsirangu,

The error message means that the new version has been released after expiry of your license. Therefore, you need to renew your subscription.

I suggest you to please first try using latest Aspose.Tasks for .NET 19.6.1 for rendering to PDF and share if there is any issue in PDF.

I have tried with latest version 19.6.1 and it is generating the PDF file, but some content is missing in the file and content should be - Document.pdf.
We tried with Old version 17.12.0 and able to generate correct file as attached.
Why it is not working with license old version?

@rajsirangu,

I have observed the information shared by you. An issue with ID TASKSNET-3330 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

@rajsirangu,

We have internally verified the issue on our end. The reason is that in evaluation version the dates are “moved” to year 2000, but view is rendered for actual dates (2018 year). The licensed version of Aspose.Tasks produces the correct PDF.

At the moment the you can choose one of following options:

  • Use the licensed version of Aspose.Tasks
    or
  • Specify the dates explicitly using the following code:
            var saveOptions = new PdfSaveOptions()
            {
                FitContent = true,
                StartDate = new DateTime(2000, 1, 1),
                EndDate = new DateTime(2001, 1, 1) 
            };

@mudassir.fayyaz
Thank you for your help

I will apply this and let you know if further support is required.

@rajsirangu,

Thank you for the feedback.

@mudassir.fayyaz
I have small doubt
Can i change the start date and end date and what is the range of start date and end date?

@rajsirangu,

Actually, I have shared the mechanism for setting date time explicitly for start and end dates. You may set dates as per your requirements.

@mudassir.fayyaz,
Thank you
We already using license version of 17.12.0 , but not working without start date and end date explicit setup.
New License version 19.6.1 will maintain the start date and end date dynamically?

Thank you in Advance

@rajsirangu

Please refer to my following response

I have shared two possible options for you. The first one suggest to use product license using Aspose.Tasks for .NET 19.6.1. This will serve the purpose. The other work around approach was to specify the dates explicitly in save options. The better is to use valid license using Aspose.Tasks for .NET 19.6.1.

The issues you have found earlier (filed as TASKSNET-3330) have been fixed in this update.