Posted by a ceTe Software moderator
Hello T.Z,
You are getting error most likely because the Properties.Resource.dplxFileName might be returning a null. The DocumentLayout class constructor will take full file path or DplxFile object.
If you are using version 4 DynamicPDF ReportWriter (this was posted in a version 4 section of our forums) then you can only load the DPLX file using file path. Since the Properties.Resource.dplxFileName returns the byte array, it is not possible to load it using either DocumentLayout class or DpLxFile class. The only workaround to overcome this is to save the byte array to disk (temporary folder) using other .NET class members. Then use the file path to load the DPLX file.
The latest DynamicPDF ReportWriter for .NET product is capable of loading the DPLX file using file path or DPLX file in the form of byte array or Stream. Below is the code sample for loading the DPLX file which is added as resource file to the project using latest DynamicPDF ReportWriter API.
//Accessing the Document3.DPLX file which is added as resource file to the project.
byte[] ByteData=TestDPLX.Properties.Resources.Document3;
DplxFile DplxfileObj = new DplxFile(ByteData);
DocumentLayout report = new DocumentLayout(DplxfileObj);
Document document=report.Run();
document.Draw(@"C:\Temp\MyDocument.pdf");
You can download latest DynamicPDF ReportWriter for .NET product from our website
here.
Thanks,
ceTe Software Support Team.