children) {
232 | OrgChartItem result = null;
233 | for (int i = 0; i < children.size() && result == null; i++) {
234 | result = getById(id, children.get(i));
235 | }
236 | return result;
237 | }
238 |
239 | /**
240 | * Sets the template generation function used to customize the internal structure of nodes. {@code
241 | * functionBody} is the body of a javascript function that recieves one parameter (the JSON
242 | * datasoure representing a node) and returns an HTML snippet. The name of this parameter is given
243 | * by {@code parameterName}.
244 | *
245 | * Example:
246 | * setNodeTemplate("item","return ''+item.name+'';")
247 | *
configures the following JS function as node template:
248 | * function(item) { return ''+item.name+''; }
249 | *
{@linkplain OrgChartItem#setData(String, String) custom properties} are accessible
250 | * through {@code item.data}
251 | *
252 | * @param parameterName the name of the parameter of a javascript function
253 | * @param functionBody the body of a javascript function
254 | */
255 | public void setNodeTemplate(String parameterName, String functionBody) {
256 | getState().nodeTemplateParam = parameterName;
257 | getState().nodeTemplate = functionBody;
258 | }
259 |
260 | /**
261 | * Adds a {@link DragAndDropEvent} listener to the component.
262 | *
263 | * @param listener the listener to be added.
264 | */
265 | public void addDragAndDropListener(ComponentEventListener listener) {
266 | addListener(DragAndDropEvent.class, listener);
267 | }
268 |
269 | /**
270 | * Fires a {@link DragAndDropEvent}.
271 | *
272 | * @param draggedItem the item being dragged.
273 | */
274 | protected void fireDragAndDropEvent(OrgChartItem draggedItem, boolean fromClient) {
275 | fireEvent(new DragAndDropEvent(this, draggedItem, fromClient));
276 | }
277 |
278 | /** Event thrown when a node is dragged and dropped. */
279 | public static class DragAndDropEvent extends ComponentEvent {
280 |
281 | private final OrgChartItem draggedItem;
282 |
283 | public DragAndDropEvent(OrgChart source, OrgChartItem draggedItem, boolean fromClient) {
284 | super(source, fromClient);
285 | this.draggedItem = draggedItem;
286 | }
287 |
288 | public OrgChartItem getDraggedItem() {
289 | return draggedItem;
290 | }
291 |
292 | public OrgChart getOrgChart() {
293 | return (OrgChart) source;
294 | }
295 | }
296 |
297 | public Registration addOnNodeClickListener(ComponentEventListener listener) {
298 | return addListener(NodeClickEvent.class, listener);
299 | }
300 |
301 | /**
302 | * Fires a {@link NodeClickEvent}.
303 | *
304 | * @param clickedItem the item being clicked.
305 | */
306 | protected void fireNodeClickEvent(OrgChartItem clickedItem, boolean fromClient) {
307 | fireEvent(new NodeClickEvent(this, clickedItem, fromClient));
308 | }
309 |
310 | /** Event thrown when a node is clicked. */
311 | public static class NodeClickEvent extends ComponentEvent {
312 |
313 | private final OrgChartItem clickedItem;
314 |
315 | public NodeClickEvent(OrgChart source, OrgChartItem clickedItem, boolean fromClient) {
316 | super(source, fromClient);
317 | this.clickedItem = clickedItem;
318 | }
319 |
320 | public OrgChartItem getClickedItem() {
321 | return clickedItem;
322 | }
323 |
324 | public OrgChart getOrgChart() {
325 | return (OrgChart) source;
326 | }
327 | }
328 |
329 | /** Collapses all nodes except the root */
330 | public void setCollapsedNodes() {
331 | setChartDepth(1);
332 | }
333 | }
334 |
--------------------------------------------------------------------------------
/src/main/java/com/flowingcode/vaadin/addons/orgchart/OrgChartItem.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * OrgChart Add-on
4 | * %%
5 | * Copyright (C) 2017 - 2025 Flowing Code S.A.
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.vaadin.addons.orgchart;
21 |
22 |
23 | import java.io.Serializable;
24 | import java.util.ArrayList;
25 | import java.util.Collections;
26 | import java.util.HashMap;
27 | import java.util.List;
28 | import java.util.Map;
29 | import java.util.Optional;
30 |
31 | import com.fasterxml.jackson.annotation.JsonProperty;
32 |
33 | /** @author pbartolo */
34 | @SuppressWarnings("serial")
35 | public class OrgChartItem implements Serializable {
36 |
37 | private String name;
38 |
39 | private String title;
40 |
41 | private String className;
42 |
43 | private Integer id;
44 |
45 | private List children = new ArrayList<>();
46 |
47 | private Map data;
48 |
49 | private boolean hybrid;
50 |
51 | public OrgChartItem(Integer id, String name, String title) {
52 | super();
53 | this.id = id;
54 | this.name = name;
55 | this.title = title;
56 | }
57 |
58 | public OrgChartItem(OrgChartItem original) {
59 | OrgChartItem orgChartCopy =
60 | new OrgChartItem(original.getId(), original.getName(), original.getTitle());
61 | for (OrgChartItem child : original.getChildren()) {
62 | orgChartCopy.addChildren(new OrgChartItem(child));
63 | }
64 | }
65 |
66 | /** Return the map of {@linkplain #setData(String, String) custom properties}. */
67 | public Map getData() {
68 | return Optional.ofNullable(data)
69 | .map(Collections::unmodifiableMap)
70 | .orElse(Collections.emptyMap());
71 | }
72 |
73 | /**
74 | * Add or remove a custom property.
75 | *
76 | * @param name the name of the custom property
77 | * @param value the value of the custom property
78 | */
79 | public void setData(String name, String value) {
80 | if (data == null) {
81 | data = new HashMap<>();
82 | }
83 | if (value != null) {
84 | data.put(name, value);
85 | } else {
86 | data.remove(name);
87 | }
88 | }
89 |
90 | public String getName() {
91 | return name;
92 | }
93 |
94 | public void setName(String name) {
95 | this.name = name;
96 | }
97 |
98 | public Integer getId() {
99 | return id;
100 | }
101 |
102 | public void setId(Integer id) {
103 | this.id = id;
104 | }
105 |
106 | public String getTitle() {
107 | return title;
108 | }
109 |
110 | public void setTitle(String title) {
111 | this.title = title;
112 | }
113 |
114 | public String getClassName() {
115 | return className;
116 | }
117 |
118 | public void setClassName(String className) {
119 | this.className = className;
120 | }
121 |
122 | public List getChildren() {
123 | return children;
124 | }
125 |
126 | public void setChildren(List children) {
127 | if (this.children != children) {
128 | this.children = new ArrayList<>(children);
129 | }
130 | }
131 |
132 | public void addChildren(OrgChartItem item) {
133 | this.children.add(item);
134 | }
135 |
136 | /**
137 | * Indicates whether this item is a hybrid node.
138 | * A hybrid node arranges its descendant children vertically instead of
139 | * horizontally.
140 | *
141 | * @return {@code true} if this item is hybrid; {@code false} otherwise
142 | */
143 | public boolean isHybrid() {
144 | return this.hybrid;
145 | }
146 |
147 | /**
148 | * Sets whether this item is a hybrid node.
149 | * When {@code true}, the item's descendant children will be arranged
150 | * vertically.
151 | *
152 | * @param hybrid {@code true} to mark this node as hybrid; {@code false}
153 | * otherwise
154 | */
155 | @JsonProperty("isHybrid")
156 | public void setHybrid(boolean hybrid) {
157 | this.hybrid = hybrid;
158 | }
159 |
160 | @Override
161 | public int hashCode() {
162 | final int prime = 31;
163 | int result = 1;
164 | result = prime * result + ((id == null) ? 0 : id.hashCode());
165 | return result;
166 | }
167 |
168 | @Override
169 | public boolean equals(Object obj) {
170 | if (this == obj) return true;
171 | if (obj == null) return false;
172 | if (getClass() != obj.getClass()) return false;
173 | OrgChartItem other = (OrgChartItem) obj;
174 | if (id == null) {
175 | if (other.id != null) return false;
176 | } else if (!id.equals(other.id)) return false;
177 | return true;
178 | }
179 |
180 | @Override
181 | public String toString() {
182 | StringBuilder sb = new StringBuilder();
183 | printChildren(this, sb, 0);
184 | return sb.toString();
185 | }
186 |
187 | private void printChildren(OrgChartItem item, StringBuilder sb, int count) {
188 | String tabs = count > 0 ? String.format("%-" + count + "s", "").replace(' ', '\t') : "";
189 | sb.append(tabs + item.getName() + "\n");
190 | count++;
191 | for (int i = 0; i < item.getChildren().size(); i++) {
192 | printChildren(item.getChildren().get(i), sb, count);
193 | }
194 | }
195 | }
196 |
--------------------------------------------------------------------------------
/src/main/java/com/flowingcode/vaadin/addons/orgchart/client/OrgChartState.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * OrgChart Add-on
4 | * %%
5 | * Copyright (C) 2017 - 2025 Flowing Code S.A.
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.vaadin.addons.orgchart.client;
21 |
22 |
23 | import com.flowingcode.vaadin.addons.orgchart.client.constants.ChartConstants;
24 | import com.flowingcode.vaadin.addons.orgchart.client.enums.ChartDirectionEnum;
25 | import java.io.Serializable;
26 |
27 | /** @author pbartolo */
28 | @SuppressWarnings("serial")
29 | public class OrgChartState implements Serializable {
30 |
31 | public String value;
32 |
33 | public String chartTitle;
34 |
35 | public String chartNodeContent;
36 |
37 | public String chartNodeTitle = ChartConstants.CHART_NODE_TITLE_DEFAULT;
38 |
39 | public String chartDirection =
40 | ChartDirectionEnum.TOP_TO_BOTTOM.getAbreviation(); // default value in the library
41 |
42 | public Boolean chartZoom = false;
43 |
44 | public Boolean chartPan = false;
45 |
46 | public Double chartZoominLimit = ChartConstants.CHART_ZOOM_IN_LIMIT_DEFAULT;
47 |
48 | public Double chartZoomoutLimit = ChartConstants.CHART_ZOOM_OUT_LIMIT_DEFAULT;
49 |
50 | public Boolean chartExportButton = false;
51 |
52 | public String chartExportFileName = ChartConstants.DEFAULT_CHART_EXPORT_FILENAME;
53 |
54 | public String chartExportFileExtension =
55 | ChartConstants.CHART_EXPORT_EXTENSION_PNG; // default value in the library
56 |
57 | public Boolean chartToggleSiblingsResp = false;
58 |
59 | public Integer chartDepth = ChartConstants.CHART_DEPTH_DEFAULT; // orgchart visibleLevel option
60 |
61 | public Integer chartVerticalDepth; // orgchart verticalLevel options
62 |
63 | public Boolean chartExpandCollapse = false;
64 |
65 | public Boolean chartDraggable =
66 | false; // Note from library: this feature doesn't work on IE due to its poor support for HTML5
67 | // drag & drop
68 |
69 | public String chartNodeId = ChartConstants.CHART_NODE_ID_DEFAULT;
70 |
71 | public String nodeTemplate;
72 |
73 | public String nodeTemplateParam = "item";
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/java/com/flowingcode/vaadin/addons/orgchart/client/constants/ChartConstants.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * OrgChart Add-on
4 | * %%
5 | * Copyright (C) 2017 - 2025 Flowing Code S.A.
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.vaadin.addons.orgchart.client.constants;
21 |
22 |
23 | public interface ChartConstants {
24 |
25 | public static String DEFAULT_CHART_EXPORT_FILENAME = "OrgChart";
26 |
27 | public static String CHART_EXPORT_EXTENSION_PNG = "png"; // default value in the library
28 |
29 | public static String CHART_EXPORT_EXTENSION_PDF = "pdf";
30 |
31 | public static Double CHART_ZOOM_IN_LIMIT_DEFAULT = 7.0;
32 |
33 | public static Double CHART_ZOOM_OUT_LIMIT_DEFAULT = 0.5;
34 |
35 | public static Integer CHART_DEPTH_DEFAULT = 999;
36 |
37 | public static String CHART_NODE_TITLE_DEFAULT = "name";
38 |
39 | public static String CHART_NODE_ID_DEFAULT = "id";
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/flowingcode/vaadin/addons/orgchart/client/enums/ChartDirectionEnum.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * OrgChart Add-on
4 | * %%
5 | * Copyright (C) 2017 - 2025 Flowing Code S.A.
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.vaadin.addons.orgchart.client.enums;
21 |
22 |
23 | /**
24 | * Enumeration of the directions that the organization chart can have.
25 | * Default one is "t2b = Top to Bottom".
26 | *
27 | * @author pbartolo
28 | */
29 | public enum ChartDirectionEnum {
30 | TOP_TO_BOTTOM("t2b"),
31 | BOTTOM_TO_TOP("b2t"),
32 | LEFT_TO_RIGHT("l2r"),
33 | RIGHT_TO_LEFT("r2l");
34 |
35 | private String abreviation;
36 |
37 | ChartDirectionEnum(String abreviation) {
38 | this.abreviation = abreviation;
39 | }
40 |
41 | public String getAbreviation() {
42 | return abreviation;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/flowingcode/vaadin/addons/orgchart/extra/TemplateLiteralRewriter.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * OrgChart Add-on
4 | * %%
5 | * Copyright (C) 2017 - 2025 Flowing Code S.A.
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 |
21 | package com.flowingcode.vaadin.addons.orgchart.extra;
22 |
23 | /**
24 | * ES6 template literal parser that rewrites the literal as an ES5 expression. This class is
25 | * experimental and subject to change, with no guarantee of completeness (but it should work for
26 | * simple expressions).
27 | *
28 | * @author Javier Godoy / Flowing Code
29 | */
30 | public class TemplateLiteralRewriter {
31 |
32 | // https://www.ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components
33 |
34 | public static String rewriteFunction(String s) {
35 | return "return " + rewrite(s) + ";";
36 | }
37 |
38 | // rewrites an ES6 template literal as an ES5 expression
39 | public static String rewrite(String s) {
40 | StringBuilder sb = new StringBuilder();
41 | sb.ensureCapacity(s.length() + 1);
42 | rewriteTemplate(s, 0, sb, true);
43 | return sb.toString();
44 | }
45 |
46 | /**
47 | * Parse a Template literal in {@code s} starting at index {@code i} and rewrite it into {@code
48 | * sb}.
49 | *
50 | * @param s The ES6 template literal
51 | * @param i The index into {@code s} where the expression begins.
52 | * @param sb The result buffer
53 | * @throws IllegalArgumentException if the template literal is not closed with a backtick
54 | * @return the index of the closing backtick that ends the Template literal
55 | */
56 | private static int rewriteTemplate(String s, int i, StringBuilder sb, boolean implicit) {
57 | int begin = i;
58 | sb.append('"');
59 | // https://www.ecma-international.org/ecma-262/6.0/#sec-static-semantics-templatestrings
60 | outer:
61 | for (; i < s.length(); i++) {
62 | char c = s.charAt(i);
63 | switch (c) {
64 | case '"':
65 | // escape quotes in TemplateCharacters since we are using them for the string literals
66 | sb.append('\\').append('"');
67 | break;
68 | case '\r':
69 | // The TV of TemplateCharacter :: LineTerminatorSequence is the TRV of
70 | // LineTerminatorSequence.
71 | // The TRV of LineTerminatorSequence :: is the sequence consisting of the code
72 | // unit value 0x000A.
73 | // The TRV of LineTerminatorSequence :: is the code unit value 0x000A.
74 | if (i < s.length() - 1 && s.charAt(i + 1) == '\n') {
75 | ++i;
76 | }
77 | // fallthrough
78 | case '\n':
79 | // The TRV of LineTerminatorSequence :: is the code unit value 0x000A.
80 | sb.append("\\n");
81 | continue;
82 | case '\u2028':
83 | // The TRV of LineTerminatorSequence :: is the code unit value 0x2028.
84 | sb.append("\\u2028");
85 | continue;
86 | case '\u2029':
87 | // The TRV of LineTerminatorSequence :: is the code unit value 0x2029.
88 | sb.append("\\u2029");
89 | continue;
90 | case '\\':
91 | if (++i == s.length()) {
92 | throw new IllegalArgumentException("Unterminated escape sequence at index " + i);
93 | }
94 | c = s.charAt(i);
95 | if (c == '\r' || c == '\n' || c == '\u2028' || c == '\u2029') {
96 | if (i < s.length() - 1 && s.charAt(i + 1) == '\n') {
97 | ++i;
98 | }
99 | // LineTerminator :: | | |
100 | // The TV of LineContinuation :: \ LineTerminatorSequence is the empty code unit
101 | // sequence.
102 | continue;
103 | } else {
104 | // EscapeSequence
105 | sb.append('\\').append(c);
106 | continue;
107 | }
108 | case '$':
109 | {
110 | if (i == s.length() - 1 || s.charAt(i + 1) != '{') {
111 | // this was a dangling dollar sign
112 | sb.append(c);
113 | continue;
114 | }
115 |
116 | sb.append("\"+(");
117 | // expression substitution
118 | i = rewriteExpression(s, i + 2, sb);
119 | sb.append(")+\"");
120 | continue;
121 | }
122 | case '`':
123 | {
124 | if (implicit) {
125 | throw new IllegalArgumentException("Unexpected backtick at index " + i);
126 | } else {
127 | break outer;
128 | }
129 | }
130 | default:
131 | sb.append(c);
132 | }
133 | }
134 |
135 | if (!implicit && i >= s.length()) {
136 | throw new IllegalArgumentException("Unterminated template at index " + begin);
137 | }
138 |
139 | // end of Template
140 | sb.append('"');
141 | return i;
142 | }
143 |
144 | /**
145 | * Parse a Expression in {@code s} starting at index {@code i} and rewrite it into {@code sb}.
146 | *
147 | * @param s The ES6 template literal
148 | * @param i The index into {@code s} where the expression begins.
149 | * @param sb The result buffer
150 | * @return the index where the corresponding TemplateSubstitutionTail starts.
151 | */
152 | private static int rewriteExpression(String s, int i, StringBuilder sb) {
153 | int begin = i;
154 |
155 | if (begin == s.length()) {
156 | throw new IllegalArgumentException("Expected expression at index " + begin);
157 | }
158 | if (s.charAt(begin) == '}') {
159 | throw new IllegalArgumentException("Unexpected token } at index " + begin);
160 | }
161 |
162 | for (; i < s.length(); i++) {
163 | char c = s.charAt(i);
164 | switch (c) {
165 | case '}':
166 | // TemplateSubstitutionTail
167 | return i;
168 | case '`':
169 | // nested template literal
170 | sb.append("(");
171 | i = rewriteTemplate(s, i + 1, sb, false);
172 | sb.append(")");
173 | continue;
174 | case '"':
175 | // fallthrough
176 | case '\'':
177 | int end = s.indexOf(c, i + 1);
178 | if (end < 0)
179 | throw new IllegalArgumentException("Unterminated string literal at index " + i);
180 | sb.append(s.substring(i, end)).append(c);
181 | i = end;
182 | continue;
183 | default:
184 | sb.append(c);
185 | }
186 | }
187 |
188 | throw new IllegalArgumentException("Expected TemplateSubstitutionTail at index " + begin);
189 | }
190 | }
191 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/VAADIN/package.properties:
--------------------------------------------------------------------------------
1 | vaadin.allowed-packages=com.flowingcode
2 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/frontend/fc-orgchart.js:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * OrgChart Add-on
4 | * %%
5 | * Copyright (C) 2017 - 2025 Flowing Code S.A.
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 |
21 | import {html, PolymerElement} from '@polymer/polymer/polymer-element.js';
22 | import jQuery from "jquery";
23 | import html2canvas from 'html2canvas';
24 | import JSONDigger from "json-digger/dist/json-digger.js";
25 |
26 | /**
27 | * `fc-orgchart`
28 | *
29 | * OrgChart element.
30 | *
31 | * @customElement
32 | * @polymer
33 | */
34 | class FCOrgChart extends PolymerElement {
35 |
36 | initializeOrgChart(statestring,data,identifier) {
37 | var $ = window.jQuery || jQuery;
38 | var state = $.parseJSON(statestring);
39 |
40 | let exportChart = state.chartExportButton;
41 | let exportExt = state.chartExportFileExtension;
42 | if(exportChart & exportExt == "pdf"){
43 | var src = "https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js";
44 | var jsfile = $("