Experimenting with the trial version, created a simple console app to convert a DGN file to a PDF file. Exception is GroupDocs.Conversion.ExceptionsGroupDocsConversionException - Object reference not set to an instance of an object.
I’m using a microstation file v8 exported back to v7
Console app is as follows:
using System;
using System.Drawing;
namespace ConvertToPdf
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(“Hello World!”);
System.Diagnostics.Trace.Write(“running application”);
var converter = new GroupDocs.Conversion.Converter(“C:\tmp\txe20037.dgn”);
var convertOptions = converter.GetPossibleConversions()[“pdf”].ConvertOptions;
converter.Convert(“c:\tmp\converted.pdf”, convertOptions);ERROR HERE
}
}
}
@jochanan1234
Please specify the API version (e.g. 20.1, 21.1) and share the problematic file with us. We’ll then investigate this issue.
My download was GroupDocs.Conversion for .NET 21.2 MSI installer.
I’m not seeing any way to upload my .dgn file to you.
1 Like
@jochanan1234
You’ve to compress the file to a ZIP format or in case of file size issue, you can upload it to some cloud storage (e.g. Google drive) and share link here.
You can find the file at this link:
https://bartonmalow.box.com/s/x7335uu7bajxuh4fnbguqixjf4hi6noi
1 Like
@jochanan1234
We cannot reproduce this issue using API version 21.2. Please have a look at this output.zip (1.3 MB). Could you please share a sample console application using that issue could be reproduced?
I’ve sent you a link to my application .zip file.
@jochanan1234
Could you please send the link again?
https://bartonmalow.box.com/s/8i6ghmvb4an3xcvexuvnisaaunmygine
Ok, I have my code working… now it crashes if I try to convert dgn to PDF using the Grayscale property. It works if I use options in the
converter.Convert(@“c:\tmp\converted.pdf”, options);
How do I implement the PdfOptions shown as part of the PdfConvertOptions class?
using GroupDocs.Conversion.Options.Convert;
using GroupDocs.Conversion.FileTypes;
using GroupDocs.Conversion.Contracts;
namespace ConvertToPdf
{
class Program
{
static void Main(string[] args)
{
var converter = new GroupDocs.Conversion.Converter(@"C:\tmp\txe20037.dgn");
PdfOptions po = new PdfOptions(); KILLS MY APP IF i USE po in place of the options below.
po.Grayscale = true;
PdfConvertOptions options = new PdfConvertOptions
{
PageNumber = 2,
PagesCount = 1,
//Rotate = Rotation.On90,
PdfOptions (not allowed in this class)
Dpi = 300,
Width = 1024,
Height = 768
};
converter.Convert(@"c:\tmp\converted.pdf", options);
}
}
}
1 Like
@jochanan1234
Please have a look at the following code:
PdfConvertOptions options = new PdfConvertOptions
{
Height = 768,
PdfOptions =
{
Grayscale = true
}
};
Then you can pass options to the Convert method. Please note that setting Grayscale to True will excess CPU load and the resultant PDF could in in large size.
So many troubles!
I’ve implemented the PdfOptions class into the PdfConvertOptions…
Last line of debugger:
Exception thrown: ‘System.Reflection.AmbiguousMatchException’ in System.Private.CoreLib.dll
@jochanan1234
Can you please share a sample application using that issue could be reproduced? Do you face the same issue with API NuGet package?
Yes NuGet has been installed. If I don’t use the PdfOptions={Grayscale=true} option it will work with all the other “PdfConvertOptions” options.
link to zip file Box
@jochanan1234
This issue is reproduced at our end. Hence, we’ve logged it in our internal issue tracking system with ID CONVERSIONNET-4548. You’ll be notified in case of any update.
The issues you have found earlier (filed as CONVERSIONNET-4548) have been fixed in this update. This message was posted using Bugs notification tool by nikola.yankov