PageSourceSearch

https://www.pdfgear.com/js/converter-edit.js

js pdfgear.com collected 2026-10-01 10:11:33 UTC 13,863 bytes, 307 lines download raw bytes

1const loadCss = (url) => {
2    var link = document.createElement('link');
3    link.rel = 'stylesheet';
4    link.type = 'text/css';
5    link.href = url;
6    document.getElementsByTagName('head')[0].appendChild(link);
7}
8loadCss("https://cdn.syncfusion.com/ej2/28.2.7/ej2-base/styles/material.css")
9loadCss("https://cdn.syncfusion.com/ej2/28.2.7/ej2-pdfviewer/styles/material.css")
10loadCss("https://cdn.syncfusion.com/ej2/28.2.7/ej2-buttons/styles/material.css")
11loadCss("https://cdn.syncfusion.com/ej2/28.2.7/ej2-popups/styles/material.css")
12loadCss("https://cdn.syncfusion.com/ej2/28.2.7/ej2-navigations/styles/material.css")
13loadCss("https://cdn.syncfusion.com/ej2/28.2.7/ej2-dropdowns/styles/material.css")
14loadCss("https://cdn.syncfusion.com/ej2/28.2.7/ej2-lists/styles/material.css")
15loadCss("https://cdn.syncfusion.com/ej2/28.2.7/ej2-inputs/styles/material.css")
16loadCss("https://cdn.syncfusion.com/ej2/28.2.7/ej2-splitbuttons/styles/material.css")
17loadCss("https://www.pdfgear.com/css/converter-edit.css")
18
19const multiText = {
20    en: {
21        getApp: `Get PDFgear app to edit texts in PDF.`,
22        downloadPdf: `Download PDF`,
23        editPdf: `Edit PDF`,
24        save: `Save`,
25        edit: `Edit`,
26        addImage: `Add Image`
27    },
28    de: {
29        getApp: `Laden Sie die PDFgear-App herunter, um Texte in PDFs zu bearbeiten.`,
30        downloadPdf: `PDF herunterladen`,
31        editPdf: `PDF bearbeiten`,
32        save: `Speichern`,
33        edit: `Bearbeiten`,
34        addImage: `Bild hinzufügen`
35    },
36    fr: {
37        getApp: `Téléchargez l’application PDFgear pour modifier le texte dans les PDF.`,
38        downloadPdf: `Télécharger le PDF`,
39        editPdf: `Modifier le PDF`,
40        save: `Enregistrer`,
41        edit: `Modifier`,
42        addImage: `Ajouter une image`
43    },
44    it: {
45        getApp: `Scarica l’app PDFgear per modificare i testi nei PDF.`,
46        downloadPdf: `Scarica PDF`,
47        editPdf: `Modifica PDF`,
48        save: `Salva`,
49        edit: `Modifica`,
50        addImage: `Aggiungi immagine`
51    },
52    pt: {
53        getApp: `Baixe o app PDFgear para editar textos em PDF.`,
54        downloadPdf: `Baixar PDF`,
55        editPdf: `Editar PDF`,
56        save: `Salvar`,
57        edit: `Editar`,
58        addImage: `Adicionar imagem`
59    },
60    es: {
61        getApp: `Descargue la aplicación PDFgear para editar textos en archivos PDF.`,
62        downloadPdf: `Descargar PDF`,
63        editPdf: `Editar PDF`,
64        save: `Guardar`,
65        edit: `Editar`,
66        addImage: `Añadir imagen`
67    },
68    id: {
69        getApp: `Dapatkan aplikasi PDFgear untuk mengedit teks dalam PDF.`,
70        downloadPdf: `Unduh PDF`,
71        editPdf: `Edit PDF`,
72        save: `Simpan`,
73        edit: `Edit`,
74        addImage: `Tambah Gambar`
75    },
76    vi: {
77        getApp: `Tải ứng dụng PDFgear để chỉnh sửa văn bản trong PDF.`,
78        downloadPdf: `Tải PDF`,
79        editPdf: `Chỉnh sửa PDF`,
80        save: `Lưu`,
81        edit: `Chỉnh sửa `,
82        addImage: `Thêm ảnh`
83    },
84    ru: {
85        getApp: `Скачайте приложение PDFgear для редактирования текста в PDF.`,
86        downloadPdf: `Скачать PDF`,
87        editPdf: `Редактировать PDF`,
88        save: `Сохранить`,
89        edit: `Редактировать`,
90        addImage: `Добавить изображение`
91    },
92    ja: {
93        getApp: `PDF のテキストを編集するには PDFgear アプリを入手してください。`,
94        downloadPdf: `PDF をダウンロード`,
95        editPdf: `PDF を編集`,
96        save: `保存`,
97        edit: `編集`,
98        addImage: `画像を追加`
99    },
100    ar: {
101        getApp: `حمّل تطبيق PDFgear لتحرير النصوص في ملفات PDF.`,
102        downloadPdf: `تنزيل ملف PDF`,
103        editPdf: `تعديل PDF`,
104        save: `حفظ`,
105        edit: `تحرير`,
106        addImage: `إضافة صورة`
107    },
108}
109
110const currentText = multiText[document.documentElement.lang.slice(0, 2)] || multiText['en'];
111
112$("body").append(`<div class="todl-popup">
113			<div class="todl-popup-cont">
114				<span class="todl-popup-close"></span>
115				<b>${currentText.getApp}</b>
116				<div class="pdfgear-btn" data-scene="toolpop"></div>
117			</div>
118		</div>`)
119
120window.loadJS = (url, callback) => {
121    const script = document.createElement("script");
122    script.src = url;
123    script.onload = callback;
124    document.body.appendChild(script);
125};
126
127loadJS("https://www.pdfgear.com/js/error.js");
128
129window.loadJS("https://cdn.syncfusion.com/ej2/28.2.7/dist/ej2.min.js", () => {
130    initial()
131});
132
133(function (e) { e[atob('c3luY2Z1c2lvbg==')] = {}; e[atob('c3luY2Z1c2lvbg==')][atob('aXNMaWNWYWxpZGF0ZWQ=')] = !![] })(window);
134
135const isReadSeries = !!document.querySelector('link[rel="alternate"][hreflang="x-default"][href="https://www.pdfgear.com/read-pdf/"]');
136const initial = () => {
137    const templateType = getUrlParam('template')
138    console.log(templateType);
139
140    if (templateType != null && templateType != '') {
141
142        $("#pdfviewer").show();
143        $(".bodyread").hide();
144        $(".infheader").hide();
145        $("html").css("height", "100%");
146        if (ismobile() == "TRUE") {
147            const css = `#fc_frame{ bottom: 70px !important; }`;
148            $("<style>").html(css).appendTo("head");
149        }
150        const templateParts = templateType.split('/');
151        var pdfviewer = new ej.pdfviewer.PdfViewer({
152            documentPath: `https://www.pdfgear.com/${templateParts[0]}/pdf/${templateParts[1]}.pdf`,
153            resourceUrl: 'https://cdn.syncfusion.com/ej2/28.2.7/dist/ej2-pdfviewer-lib',
154            documentLoad: function () {
155                console.log('Document loaded successfully');
156                dataLayer.push({ 'event': 'show_pdfviewer', });
157
158                if (!isReadSeries) {
159                    pdfviewer.toolbar.annotationItem.click();
160                }
161
162                if (this.__initFileName) {
163                    this.fileName = this.__initFileName;
164                    this.viewerBase.downloadFileName = this.__initFileName;
165                    this.__initFileName = null;
166                }
167                if (ismobile() == "FALSE" && !$(".fixed-dlbtn").length) {
168                    $("body").append(`<button class="fixed-dlbtn">${currentText.downloadPdf}</button>`)
169                    $(".fixed-dlbtn").on("click", function () {
170                        dataLayer.push({ 'event': 'click_extra_download', });
171                        pdfviewer.download()
172                    })
173                    $(".e-pv-annotation-container").before(`<button class="inline-editbtn">${currentText.editPdf}</button>`)
174                    $(".inline-editbtn").on("click", function () {
175                        $(".todl-popup").fadeIn();
176                    })
177                } else if (ismobile() == "TRUE" && !$(".inline-dlbtn").length) {
178                    $(".e-pv-mobile-toolbar .e-toolbar-left").append(`<button class="inline-dlbtn">${currentText.save}</button><button class="inline-editbtn-mo">${currentText.edit}</button>`)
179                    $(".inline-dlbtn").on("click", function () {
180                        dataLayer.push({ 'event': 'click_extra_download', });
181                        pdfviewer.download()
182                    })
183                    $(".inline-editbtn-mo").on("click", function () {
184                        $(".todl-popup").fadeIn();
185                    })
186                }
187            }
188        });
189
190        pdfviewer.appendTo('#pdfviewer');
191        pdfviewer.printMode = 'NewWindow';
192    } else {
193        var pdfViewer = new ej.pdfviewer.PdfViewer({
194            height: "100%",
195            width: "100%",
196            documentLoad: function () {
197                console.log('Document loaded successfully');
198                dataLayer.push({ 'event': 'show_pdfviewer', });
199                if (!isReadSeries) {
200                    pdfViewer.toolbar.annotationItem.click();
201                }
202
203                if (this.__initFileName) {
204                    this.fileName = this.__initFileName;
205                    this.viewerBase.downloadFileName = this.__initFileName;
206                    this.__initFileName = null;
207                }
208                if (ismobile() == "FALSE" && !$(".fixed-dlbtn").length) {
209                    $("body").append(`<button class="fixed-dlbtn">${currentText.downloadPdf}</button>`)
210                    $(".fixed-dlbtn").on("click", function () {
211                        dataLayer.push({ 'event': 'click_extra_download', });
212                        pdfViewer.download()
213                    })
214                    $(".e-pv-annotation-container").before(`<button class="inline-editbtn">${currentText.editPdf}</button>`)
215                    $(".inline-editbtn").on("click", function () {
216                        $(".todl-popup").fadeIn();
217                    })
218                    $('#pdfviewer_annotation_freeTextEditContainer').after(`<div class="e-toolbar-item e-pv-freetext-separator-container e-separator"></div><div class="e-toolbar-item e-custom-stamp"><span class="eicon"></span><span class="etips">${currentText.addImage}</span></div>`)
219                    $(".e-custom-stamp").on("click", function () {
220                        dataLayer.push({ 'event': 'click_pdfviewer_annotation_addImage', });
221                        $('.e-menu-item.e-menu-caret-icon').click();
222                        $('li[aria-label="Custom Stamp"]').click();
223                    })
224                } else if (ismobile() == "TRUE" && !$(".inline-dlbtn").length) {
225                    $(".e-pv-mobile-toolbar .e-toolbar-left").append(`<button class="inline-dlbtn">${currentText.save}</button><button class="inline-editbtn-mo">${currentText.edit}</button>`)
226                    $(".inline-dlbtn").on("click", function () {
227                        dataLayer.push({ 'event': 'click_extra_download', });
228                        pdfViewer.download()
229                    })
230                    $(".inline-editbtn-mo").on("click", function () {
231                        $(".todl-popup").fadeIn();
232                    })
233                    $('#pdfviewer_annotation_freeTextEditContainer').after(`<div class="e-toolbar-item e-pv-freetext-separator-container e-separator"></div><div class="e-toolbar-item e-custom-stamp"><span class="eicon"></span></div>`)
234
235                    $(document).on('click', '.e-custom-stamp', function () {
236                        dataLayer.push({ 'event': 'click_pdfviewer_annotation_addImage', });
237                        $('.e-menu-item.e-menu-caret-icon').first().click();
238                        $('li[aria-label="Custom Stamp"]').click();
239                    })
240
241                    $(document).on('click', '.e-toolbar-item', function () {
242                        //console.log('$("#pdfviewer_backward").length')
243                        setTimeout(() => {
244                            // console.log($("#pdfviewer_backward").length)
245                            if ($("#pdfviewer_backward").length) {
246                                $('.e-btn-icon.e-pv-backward-icon').on('click', function () {
247                                    setTimeout(() => {
248                                        $('#pdfviewer_annotation_freeTextEditContainer').after(`<div class="e-toolbar-item e-pv-freetext-separator-container e-separator"></div><div class="e-toolbar-item e-custom-stamp"><span class="eicon"></span></div>`)
249                                    }, 100);
250                                })
251                            }
252                        }, 100);
253                    })
254
255                    $(document).on('click', '#pdfviewer_annotationContainer', function () {
256                        $('#pdfviewer_annotation_freeTextEditContainer').after(`<div class="e-toolbar-item e-pv-freetext-separator-container e-separator"></div><div class="e-toolbar-item e-custom-stamp"><span class="eicon"></span></div>`)
257                    })
258                }
259            }
260        });
261
262        pdfViewer.appendTo('#pdfviewer');
263        pdfViewer.printMode = 'NewWindow';
264        document.querySelector('#file1').onchange = uploadread;
265        function uploadread(e) {
266            if (document.querySelector('#file1').files[0].type !== 'application/pdf') {
267                window.errorPopup.alert("unsupported");
268                return
269            }
270
271            if (document.querySelector('#file1').files[0].size > 100 * 1024 * 1024) {
272                window.errorPopup.alert("size", 100);
273                return
274            }
275
276            $("#pdfviewer").show();
277            $(".bodyread").hide();
278            $(".infheader").hide();
279            $("html").css("height", "100%");
280            if (ismobile() == "TRUE") {
281                const css = `#fc_frame{ bottom: 70px !important; }`;
282                $("<style>").html(css).appendTo("head");
283            }
284
285            var file = e.target.files[0];
286            pdfViewer.__initFileName = file.name;
287
288            var reader = new FileReader();
289            reader.onload = function (e) {
290                var base64String = e.target.result.split(',')[1];
291                var pdfDataUrl = 'data:application/pdf;base64,' + base64String;
292                pdfViewer.load(pdfDataUrl, null);
293            };
294            reader.readAsDataURL(file);
295        }
296    }
297
298    $(".todl-popup, .todl-popup-close").on("click", function () {
299        $(".todl-popup").hide();
300    })
301
302    $(".todl-popup-cont").on("click", function (event) {
303        event.stopPropagation();
304    })
305
306}
307

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.