Skip to content

wallabyway/forge-pdf-report

Repository files navigation

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.

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

Releases

No releases published

Packages

No packages published

Languages