new DplxFile(Properties.Resource.file)?

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for .NET (v4)  /  new DplxFile(Properties.Resource.file)?

DynamicPDF Generator for .NET (v4) Forum


I know that the constructor of DocumentLayout can take an address of DynamicPDF file as the parameter. But what if I add the DynamicPDF .dplx as a project resource file, can I create a new DocumentLayout by (new DplxFile(Properties.Resource.dplxFileName))? It seems DplxFile object has the byte[] constructor, which is exactly the form of the dplxFile in the Resource. If so, why it says "value cannot be null. parameter name: path1" when I tried so?


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();

You can download latest DynamicPDF ReportWriter for .NET product from our website here.

ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 5:47 AM.