Select to view content in your preferred language

Print widget prints wrong extent

2139
11
01-16-2020 06:23 AM
ae
by
Occasional Contributor II

Hi, 

I'm trying to add print functionality to a 4.x solution I'm working on using the PrintViewModel. I'm able to use all the functionality as described in the documentation, but there seems to be an inherent problem where the actual printout (pdf) returned from the printservice only contain a portion of the map that is visible in the browser. 

It's very easy to reproduce this by opening the official print sample in fullscreen (Print widget - 4.14), and hitting print. The resulting printout will vary depending on your screen size, but in the majority of cases the printout will only contain a center envelope of the map which is displayed in the application. 

Here are some screenshots to illustrate the problem: 

This is what the user sees in the browser window when hitting print: 

This is the result from  the print service: 

This is not a new problem and I've seen several questions about this on other forums. The problem also exists in version 3.x. Probably the problem is more connected to the print service than the JS api.

I've tried using the map-only option in PrintTemplate to specify a width and a height, and this kind of solves the problem, but then I'm stuck with a new problem which is that it is impossible to include a legend when printing using map-only. 

For those of you familiar with Geocortex (which is a partner of ESRI), I've noticed that they have somehow solved the problem there, but I cannot access any readable source code to figure out how they've done it. In geocortex applications they show a print preview box, which illustrates what is going to be included in the printout. They also allow the user to specify which scale to use in the print. I want to build the same kind of printing functionality in my solution but currently I'm stuck with the bug above. If I at least could add a preview box so that the user could see what would be included in the printout that would be a huge step in the right direction.

Please, does anyone have any advice/suggestions? 

Tags (2)
0 Kudos
11 Replies
Kara_Lara
New Contributor III

@LefterisKoumis Try the PrintPlus widget. Though at my last attempt, it required some modifications to print the proper scale/bounded area as well. Apologies if I misunderstood your request.

0 Kudos
LefterisKoumis
Regular Contributor II

Thank you for the response. Does the print plus work with JS 4.x ?

0 Kudos