Hexagon Geospatial
MENU

Developers Knowledge Base

WebGIS enables powerful geospatial web applications and services that securely share your organization’s rich geospatial data, and provides tools to deeply examine spatial data and create value added products, on demand.
Showing results for 
Search instead for 
Do you mean 

Custom Snapshot Page for Printing

by Technical Evangelist on ‎04-12-2016 07:43 AM - edited on ‎04-07-2017 07:55 AM by Technical Evangelist (1,843 Views)

Geospatial Portal Printing Workflow

  • Portal performs local printing on the server using one of two engines
    • Internet Explorer
    • PhantomJS
  • Server-Side printing is performed using a „Snapshot Page” that is opened in the server-side printing engine
  • After the snapshot page is fully loaded, the printing engine captures a bitmap
  • EP05 introduces customization of the snapshot page allowing developer to load additional scripts
  • Local printout may be then piped to the printing service for further processing

Custom snapshot page

  • With EP05 it is possible to implement custom snapshot page that generates image used for the printout
  • Custom snapshot page may use API.js
  • Custom snapshot page may inject custom script tags
  • For example custom script tags may handle dynamic predicate based styles

 

Obraz1.png

Custom snapshot page implementation 

 

Obraz2.png

 

Custom snapshot page

  • Custom snapshot page inherits from SnapshotPage and allows to override LoadScripts method
  • SDK EP05 contains example implementation

PhantomJS printing configuration

Obraz3.png

 

<printing tileSize="2000" mapSizeLimit="5000" timeout="00:02" defaultService="FirstExternal" precisionGeographic="7" precisionProjected="0" printingEngine="phantomJS" phantomJSProgramLocation="c:\intergraph\Geospatial Portal\Program\PhantomJS\phantomjs.exe" />

Custom snapshot page registration in web.config

Obraz4.png

 

<!-- Custom snapshot page to be used for printing. It is possible to add custom scripts. See MySnapshotPage.cs and js/PrintingScripts.js for reference -->
<add key="SnapshotPage" value="MySnapshotPage.WebClient.ashx" />

Predicate based style

Obraz5.png

Printing

Obraz6.png

PrintOut

Obraz7.png

Comments
by rksinha28
on ‎10-11-2016 09:18 PM

Hi,

 

Is it possible to have a sample code for above?

 

Regards

Rohit Kumar Sinha

by Technical Evangelist
on ‎12-13-2016 02:02 AM

Hi,

 

I don't think there's much more code needed than what is present on the screenshots. Just create an empty ASP.NET page, inherit it from the SnapshotPage class and fill in the code.

 

Regards,

Jan

by Technical Evangelist
on ‎12-14-2016 06:22 AM

Ok, I've checked that and it works fine in Portal SDK but does not work for normal Portal instance. Will try to get some more details.

 

Jan

by
on ‎02-12-2018 06:04 AM

Thanks - will study in more detail - is the purpose to be able to produce custom map display?  I don't want to change appearance of the map but i do want to include text based on attributes of feature displayed in map. I would like to run a query of a feature table to get the record for one parcel and then format that information.

by Technical Evangelist
on ‎02-12-2018 06:14 AM

Purpose of the custom snapshot page is to alter the HTML content ONLY of the actual map window. You can for instance alter WFS styling, remove map scale bar. The snapshot page is actually just a copy of the actual Portal map window.

Overview