Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Regular Contributor
Posts: 246
Registered: ‎10-26-2015

How to customize printing templates used by external printing service

I am customising the standard print templates delivered with the Geospatial Portal print service for a customer and haven't been able to achieve the customisations listed below.

 

I have read the article https://community.hexagongeospatial.com/t5/WebGIS-Tutorials/How-to-customize-printing-templates-used... which doesn't appear to cover what I need.

 

  1. Can I display the user selected page size within a binding in the print template? I would like to to display the text "1:100000 at A4" and don't want to hard code the page size in each template as this means I need a different template for each page size.
  2. The Geospatial Portal web application is using IIS Forms Authentication. I would like to hard code into the template the display of the Authenticated Username rather than allowing a user to optionally enter a username using the Print Dialog Template Options tab. How can I do this?
  3. I would like to display text and a binding within a single text string where the text is wrapped. I am trying to achieve a text string such as "This plan is suitable for information only. Customer accepts no liability for any error whatsoever. Copyright © 2018 Customer, OpenStreetMap contributors." I would like to use the binding "{Binding Source={xSmiley Frustratedtatic sysSmiley Very HappyateTime.Now},StringFormat= 'yyyy'}" within this text string to display the current year. Reading online this should be possible using just a TextBlock and a series of <Run> parameters but I couldn't get the binding to show the year, the binding was treated as text.

 

https://stackoverflow.com/questions/789222/having-hardcoded-text-with-a-binding-in-a-textblock

 

<TextBlock TextWrapping="Wrap">
    <Run>The value</Run>
    <Run Text="{Binding Path=MyProperty1, Mode=OneWay}" FontWeight="Bold" />
    <Run>was invalid. Please enter it with the format... </Run>
    <LineBreak/><LineBreak/>
    <Run>Here is another value in the program</Run>
    <Run Text="{Binding Path=MyProperty2, Mode=OneWay}" FontWeight="Bold" />
</TextBlock>  

Thanks,

Colin

Technical Evangelist
Posts: 1,118
Registered: ‎09-11-2015

Re: How to customize printing templates used by external printing service

[ Edited ]

Hi Colin,

 

  1. I think this is not possible, as the page size is not known to the XAML template during processing time. But perhaps somebody could correct me.
  2. Print Template doesn't know anything about the authentication protocol. But maybe, you could find a way, how to pre-fill the user name box in the Printing Dialog using JS, in theory:
    • Get username using $GP.user.getCurrent()
    • Find the proper HTML element (you could use some pre-filled text in the XAML template such as '<user-name-xx>' as a hint for the DOM searcher: <TextBlock Text="<user-name-xx>" ... />
    • Fill into the generated input box the user name
  3. How about splitting the sentense into multiple TextBlocks wrapped into WrapPanel? Something like:
    <WrapPanel Orientation="Horizontal" 
    	Grid.Row="4" 
    	Grid.ColumnSpan="3"
    	VerticalAlignment="Top"
    	HorizontalAlignment="Left">
     <TextBlock FontSize="10pt"
    	Text="This plan is suitable for information only. Intergraph accepts no liability for any error whatsoever. Copyright © " />
     <TextBlock FontSize="10pt" Text="{Binding Source={x:Static sys:DateTime.Now},StringFormat= 'yyyy'}"/>		
     <TextBlock FontSize="10pt" Text=" Customer, OpenStreetMap contributors" />
    </WrapPanel>        
    
Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.