Reference to CommonUtilities

Hi I just installed GroupDocs.Assembly via nuget in Visual Studio. In C#, I have added references to GroupDocs.Assembly amd

GroupDocs.Assembly.Data, but I couldn’t find reference to CommonUtilities, eg. assembler.AssembleDocument(CommonUtilities.GetSourceDocument

(strDocumentTemplate). Where can I find the component?

Please note that I’m following this example: Generate PDF and Word Reports from JSON Data in C#

Thank you for your support.

1 Like

@j2bmw

CommonUtilities is a custom class. Please download or clone this updated example project and let us know if you face any issue. You can further explore this developer guide.

Hi Atir_Tahir,
Thanks for your reply.
We are evaluating PDF tools for generating PDF reports with 10000 lines quickly. We tried your Aspose.Cells. It took about 8s. We’s like to achieve it within 2s. I should be grateful if you can shed light. An example code would be appreciated. Please see my test code using Aspose below. I wonder GraphDocs may be an option.

    private static void ExportToPdfFromJson(List<HistoryLogReportRow> report)
    {
        var startTime = DateTime.Now;
        
        // create a Workbook object
        var workbook = new Workbook();

        // access default worksheet
        var worksheet = workbook.Worksheets[0];

        // read JSON data from file
        string jsonInput = JsonSerializer.Serialize<List<HistoryLogReportRow>>(report);

        // set JsonLayoutOptions to treat Arrays as Table
        var options = new JsonLayoutOptions();
        options.ArrayAsTable = true;

        // Obtaining the reference of the PageSetup of the worksheet
        PageSetup pageSetup = worksheet.PageSetup;

        // Setting worksheet name at the left section of the header
        pageSetup.SetHeader(0, "&\"Times New Roman,Bold\"&20 WMS+ History Report");

        // Setting current date and current time at the right section of the header
        // and changing the font of the header
        pageSetup.SetHeader(2, "&D-&T");

        // Setting current file name at the right section of the header and changing the
        // font of the header
        //pageSetup.SetHeader(2, "&\"Times New Roman,Bold\"&12&F");

        // Setting a string at the left section of the footer and changing the font
        // of a part of this string ("Carrier")
        pageSetup.SetFooter(0, "&\"Courier New\"&14 Carrier");

        // Setting the current page number at the central section of the footer
        //pageSetup.SetFooter(1, "&P");

        // Setting page count at the right section of footer
        pageSetup.SetFooter(2, "Page &P of &N");

        // import JSON data to worksheet starting at cell A1
        JsonUtility.ImportData(jsonInput, worksheet.Cells, 0, 0, options);

        //worksheet.AutoFitColumns();
        worksheet.Cells.SetColumnWidth(0, 20);
        worksheet.Cells.SetColumnWidth(1, 20);
        worksheet.Cells.SetColumnWidth(2, 80);
        worksheet.Cells.SetColumnWidth(3, 20);
        worksheet.Cells.SetColumnWidth(4, 20);

        foreach (Worksheet item in workbook.Worksheets)
        {
            item.PageSetup.Orientation = PageOrientationType.Landscape;
        }

        PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
        pdfSaveOptions.AllColumnsInOnePagePerSheet = true;
        // convert imported JSON to PDF
        workbook.Save("historyReport.pdf", pdfSaveOptions);

        // convert imported JSON to PDF
        //workbook.Save("historyReport.pdf", SaveFormat.Auto);

        var elapsedTime = DateTime.Now.Subtract(startTime).TotalMilliseconds;
    }

This topic has been moved to the related forum: https://forum.aspose.com/t/reference-to-commonutilities/236823