SaveDocumentVPDF
| Description |
Saves the PDF document. The SaveDocumentVPDF will add the text of the PDF to preserve text selection capabilities and searchability and will flatten (burn in) the PDF Forms if there are any. The saving operation will apply the pdfScale to the page sizes and positions, merge the rendered PDF page with the flattened annotations (PDF Forms), add the Text Objects, then finally apply the pdfPw password if it’s not empty. |
||||||||||||||||||||||||||||||
| Method Type | POST | ||||||||||||||||||||||||||||||
| URL | api/dm/save-pdf | ||||||||||||||||||||||||||||||
| Parameters |
|
||||||||||||||||||||||||||||||
| Response Type | JSON (JsonResult) | ||||||||||||||||||||||||||||||
| Return values |
{ uploadResponse (bihtml5BASE.UploadResponse) } |
Programming notes
None
Example
| JavaScript Example |
|
// Promise function for Saving PDF document with text and annotations (forms) const SaveVectorPDF = () => { return new Promise((resolve, reject) => { $.ajax({ type: "POST", url: API_SaveDocumentVPDF, /* Ajax/SaveDocumentVPDF.cshtml */ cache: false, data: { savePages: JSON.stringify(Pages), // Array of base64 page savePageInfos: JSON.stringify(PageInformation), // Array of PageInformation objects pdfPw: pdfPassword, // Original PDF password pdfAnnotations: JSON.stringify(PDFFields), // Array of PDFAnnotations objects pdfAnnotationsFlatten: JSON.stringify(FlattenPDFs), // Array of flattened PDFAnnotation objects pdfTextObjects: JSON.stringify(PDFPages), // Array of PDFTextObjects objects pdfScale: scale // The scaling factor used to render the PDF. By default its 3 }, success: function (r) { resolve(r); // return promise with the received memory handle }, error: function (xhr, textStatus, message) { // handle error reject(message); // reject promise if failed } }); }) }; // Example for chaining the steps of the saving function Save() { // Flattening the PDF form fields FlattenPDF().then( (result) => { // Saving the PDF document SaveVectorPDF().then( (handle) => { // Updating the document using the Content-Engine UpdateDocument(handle).then( (result) => { console.log("Saving finished."); } ) } ) } ) } |
Requirements
