Use Forge Viewer to create a PDF report (client side only)
Here is a quick way to generate a PDF report of the LMV canvas through the browser. It uses the jsPDF library.
Steps:
- Add
<script src="https://unpkg.com/jspdf/dist/jspdf.min.js"></script>
to yourindex.html
- Take a screenshot of LMV canvas using
getScreenShotBuffer()
, like this ...
viewer.getScreenShotBuffer(
viewer.canvas.width,
viewer.canvas.height,
img => createPDF(img)); });
- 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
Add this to your viewer code:
viewer.impl.setPostProcessParameter("style","graphite");
viewer.impl.setPostProcessParameter("brightness",1.0)
reference: LMV ChangeLog v3.3
--
Feel free to add any issues you find to my Github issues repo.
Follow me on Twitter @micbeale