generate a pdf report from LMV
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
.gitignore
LICENSE
README.md
index.html
old-example.html
pdfReport.jpg
report-floor1.pdf
report-floor2.png

README.md

Generate a PDF Report from LMV Canvas (line-style)

Use Forge Viewer to create a PDF report (client side only)

Original:

Introduction

Here is a quick way to generate a PDF report of the LMV canvas through the browser. It uses the jsPDF library.

DEMO

Results.PDF

How to use:

Steps:

  1. Add <script src="https://unpkg.com/jspdf/dist/jspdf.min.js"></script> to your index.html
  2. Take a screenshot of LMV canvas using getScreenShotBuffer(), like this ...
viewer.getScreenShotBuffer(
 viewer.canvas.width,
 viewer.canvas.height, 
 img => createPDF(img)); });
  1. Then add the PNG into a new PDF using jsPDF, like this...
var doc = new jsPDF()
doc.addImage(imgData, 'JPEG', 0, 40, 180, 120);
doc.save('Floor1_PDFreport.pdf')

You can find a complete example GitHub here: https://github.com/wallabyway/forge-pdf-report

Line Styling:

Add this to your viewer code:

viewer.impl.setPostProcessParameter("style","graphite");

viewer.impl.setPostProcessParameter("brightness",1.0)

reference: LMV ChangeLog v3.3

--

Follow me on twitter

Feel free to add any issues you find to my Github issues repo.

Follow me on Twitter @micbeale