JS API 4.15: Custom Print template issue

390
3
Jump to solution
12-14-2020 11:50 AM
shaileshgavathe
Occasional Contributor

Hello,

 

Not sure, how to fix this one particular issue. 

Published the custom print python tool for the Custom Layout (pagx) files by following the guidelines https://enterprise.arcgis.com/en/server/latest/create-web-apps/windows/tutorial-publishing-additiona...

Able to see the new Template options under Print Tool, but when we try it to print it, it gives the below error.

[esri.core.Accessor] Accessor#set 'Custom_Quicklook_Template_11x17_105' is not a valid value for this property, only the following values are valid: 'map-only', 'a3-landscape', 'a3-portrait', 'a4-landscape', 'a4-portrait', 'letter-ansi-a-landscape', 'letter-ansi-a-portrait', 'tabloid-ansi-b-landscape', 'tabloid-ansi-b-portrait'

Then added the extend to the TemplateOptions from Accessor but the error still exist.

export interface TemplateOptions extends __esri.Accessor {

    
    layout:
    | "map-only"
    | "a3-landscape"
    | "a3-portrait"
    | "a4-landscape"
    | "a4-portrait"
    | "letter-ansi-a-landscape"
    | "letter-ansi-a-portrait"
    | "tabloid-ansi-b-landscape"
    | "tabloid-ansi-b-portrait"
    | "Custom_Quicklook_Template_11x17_105";
    /**
    * When `false`, the legend is not displayed on the printout.
    *
    *
    * @default true
    */
}
 
 
Thanks and Regards,
Shay

 

0 Kudos
1 Solution

Accepted Solutions
shaileshgavathe
Occasional Contributor

Found the workaround by Intercepting the request with esriConfig.

 

             if(esriConfig){                    
                    esriConfig?.request?.interceptors?.push({
                        // set the `urls` property to the URL of the print service so that this
                        // interceptor only applies to requests made to the print service URL
                        before: function(params) {
                            if (params.url.includes("Print")) {
                                params.requestOptions.query.Layout_Template = "customtemplate";                                  
                            }
                        }
                        
                    });
                }

View solution in original post

0 Kudos
3 Replies
ReneRubalcava
Frequent Contributor

What version of the API is this? I think this error happened a couple of versions ago, but has since been fixed.

Never mind, version in title. This is fixed in 4.16 and above.

0 Kudos
shaileshgavathe
Occasional Contributor

Thanks ReneRubalCava.  Upgraded to 4.17. Unfortunately the Error still exist?

Used below packages

   "@arcgis/webpack-plugin""4.17.5",
   "@types/arcgis-js-api""4.17.0",
 
0 Kudos
shaileshgavathe
Occasional Contributor

Found the workaround by Intercepting the request with esriConfig.

 

             if(esriConfig){                    
                    esriConfig?.request?.interceptors?.push({
                        // set the `urls` property to the URL of the print service so that this
                        // interceptor only applies to requests made to the print service URL
                        before: function(params) {
                            if (params.url.includes("Print")) {
                                params.requestOptions.query.Layout_Template = "customtemplate";                                  
                            }
                        }
                        
                    });
                }

View solution in original post

0 Kudos