|
| 1 | +# Browser API to Process & Manipulate PDF Files |
| 2 | + |
| 3 | +Add PDF processing, manipulation, and conversion features to your front-end applications. |
| 4 | + |
| 5 | +[Aspose.PDF for JavaScript via C++](https://products.aspose.com/pdf/javascript) allows you to work with PDF documents, pages, text, images, attachments, fonts, security, and signatures. |
| 6 | + |
| 7 | +<p align="center"> |
| 8 | + <a title="Download complete Aspose.PDF for JavaScript via C++ code" href="https://releases.aspose.com/pdf/javascriptcpp/new-releases/"> |
| 9 | + <img src="https://raw.github.com/AsposeExamples/java-examples-dashboard/master/images/downloadZip-Button-Large.png" /> |
| 10 | + </a> |
| 11 | +</p> |
| 12 | + |
| 13 | +## PDF Processing via JavaScript |
| 14 | + |
| 15 | +- **Extract text** from PDF pages or search for a particular text segment using regular expressions. |
| 16 | +- **Add or extract** images to & from PDF documents. |
| 17 | +- **Concatenate** or **split** PDF files. |
| 18 | +- **Linearization** of PDF documents for web optimization. |
| 19 | +- **Convert** PDF documents to Office, web, and image formats with the highest visual fidelity. |
| 20 | +- Manipulate PDF files to manage bookmarks, hyperlinks, watermarks, attachments & annotations. |
| 21 | +- **Encrypt** or **decrypt** PDF documents and set document privileges or modify passwords. |
| 22 | +- **Digitally sign PDF** documents or remove signatures. Also, verify if the PDF is signed and the signature is valid. |
| 23 | + |
| 24 | +## Read & Write PDF & Other Formats |
| 25 | + |
| 26 | +**Fixed Layout:** PDF, PDF/A, PDF/UA |
| 27 | + |
| 28 | +## Save PDF Documents As |
| 29 | + |
| 30 | +**Microsoft Office:** DOC, DOCX, XLS, XLSX, PPTX |
| 31 | +**Images:** JPEG, PNG, BMP, TIFF, EMF |
| 32 | +**Others:** EPUB, DICOM, SVG, SVG(ZIP), GRAYSCALE PDF, PDF/A, TEX, TXT |
| 33 | + |
| 34 | +## Platform Independence |
| 35 | + |
| 36 | +Aspose.PDF for JavaScript via C++ is a WebAssembly-based library that can be used to create applications in any browser that supports this technology. |
| 37 | +The library was written in C++ and does not require additional runtime environments. |
| 38 | + |
| 39 | +## Getting Started with Aspose.PDF for JavaScript via C++ |
| 40 | + |
| 41 | +Are you ready to give Aspose.PDF for JavaScript via C++ a try? |
| 42 | + |
| 43 | +- Execute `npm install git+https://github.com/asposepdf/aspose-pdf-js.git` in Terminal in Visual Studio Code or in another console. |
| 44 | +- You can also add one line in `dependency` section of `package.json` manually |
| 45 | + |
| 46 | +```json |
| 47 | +"dependencies": { |
| 48 | + "some-package": "link", |
| 49 | + "aspose-pdf-js": "github:asposepdf/aspose-pdf-js", |
| 50 | + "another-package": "link" |
| 51 | + } |
| 52 | +``` |
| 53 | + |
| 54 | +## Setting up |
| 55 | + |
| 56 | +- Rename `setting.json.default` into `settings.json` |
| 57 | +- Add desired values into `settings.json` |
| 58 | +- Put `arial.ttf` and `times.ttf` into `fonts` folder |
| 59 | + |
| 60 | +You need to use `encrypt_lic.html` to get an encrypted license file for running in full-featured mode. |
| 61 | + |
| 62 | +## Extract Text From Whole PDF |
| 63 | + |
| 64 | +```js |
| 65 | +// Add this function as handler for file-upload element |
| 66 | +var ffileExtract = function (e) { |
| 67 | + const file_reader = new FileReader(); |
| 68 | + file_reader.onload = (event) => { |
| 69 | + /*Extract text from a PDF-file*/ |
| 70 | + const json = AsposePdfExtractText(event.target.result, e.target.files[0].name); |
| 71 | + if (json.errorCode == 0) document.getElementById('output').textContent = json.extractText; |
| 72 | + else document.getElementById('output').textContent = json.errorText; |
| 73 | + }; |
| 74 | + file_reader.readAsArrayBuffer(e.target.files[0]); |
| 75 | + }; |
| 76 | +``` |
| 77 | + |
| 78 | +## Save PDF as Office Formats |
| 79 | + |
| 80 | +One of the most popular features of Aspose.PDF for JavaScript via C++ is to convert PDF documents to other formats without needing to understand the underlying structure of the resultant format. |
| 81 | + |
| 82 | +Give the following snippet a try with your samples: |
| 83 | + |
| 84 | +```js |
| 85 | +// Add this function as handler for file-upload element |
| 86 | +var ffileToDocX = function (e) { |
| 87 | + const file_reader = new FileReader(); |
| 88 | + file_reader.onload = (event) => { |
| 89 | + /*convert a PDF-file to DocX and save the "ResultPDFtoDocX.docx"*/ |
| 90 | + const json = AsposePdfToDocX(event.target.result, e.target.files[0].name, "ResultPDFtoDocX.docx"); |
| 91 | + if (json.errorCode == 0) document.getElementById('output').textContent = json.fileNameResult; |
| 92 | + else document.getElementById('output').textContent = json.errorText; |
| 93 | + /*make a link to download the result file*/ |
| 94 | + DownloadFile(json.fileNameResult, |
| 95 | + "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); |
| 96 | + } |
| 97 | + file_reader.readAsArrayBuffer(e.target.files[0]); |
| 98 | + } |
| 99 | +``` |
| 100 | + |
| 101 | +[Home](https://www.aspose.com/) | [Product Page](https://products.aspose.com/pdf/javascript-cpp) | [Docs](https://docs.aspose.com/pdf/javascript-cpp/) | [Demos](https://products.aspose.app/pdf/family) | [API Reference](https://apireference.aspose.com/pdf/javascript-cpp) | [Examples](https://github.com/aspose-pdf/aspose-pdf-js) | [Blog](https://blog.aspose.com/category/pdf/) | [Search](https://search.aspose.com/) | [Free Support](https://forum.aspose.com/c/pdf) | [Temporary License](https://purchase.aspose.com/temporary-license) |
0 commit comments