Improper Alignment due to default package setting
In a report generation software, with the option available “Export as PDF” the reports are exported in PDF formats that can be downloaded. Not quite, whenever the reports were exported to PDF formats, the PDF files lacked readability as there was an improper alignment issue.
When we looked into the improper alignment, we found the issues were due to the default settings of the PDFMake package content. The application collects contents from data centers and generates the PDF report.
We use an API call to invoke the data centres that responds with a . JSON format(encrypted) with a 64 — bit base. Only after the code’s been decoded, it employs the PDFMake Package 0.1.54 to generate the PDF report.
Still, we did not get an expected outcome. Moreover, the report could not be manually aligned. By default, the contents in the report were left aligned. While re checking it was found that the package did not employ the properties “preserveLeadingSpaces and preserveTrailingSpaces”.
After restarting the execution, the contents still lacked alignment. We identified this was because of the default font style “ROBOTO” that comes with the PDFMake Package. To overcome this, download and include the “LUCIDA CONSOLE” font style. Now we got a perfectly aligned readable PDF report.