Skip to content

LoadFromBase64

Updates the document content from Base64. The previously created content will be lost.

1
myWriter.LoadFromBase64(base64: string, type?: ( "pdf" | "docx" | "html" | "rtf" | "xml" | "txt" | ".pdf" | ".docx" | ".html" | ".rtf" | ".xml" | ".txt" )):void

Parameters

string base64
    The document content as a Base64 string.

( "pdf" | "docx" | "html" | "rtf" | "xml" | "txt" | ".pdf" | ".docx" | ".html" | ".rtf" | ".xml" | ".txt" ) type optional
    The file type of the content. When omitted, the format is detected.

Remarks

Without type, the document library detects the input format. With type, the corresponding loader is forced. Invalid Base64, an unreadable document, or an unsupported explicit type throws.

Examples

Convert an uploaded Word document to PDF

1
2
3
4
var writer = new Writer();
writer.LoadFromBase64($Files.GetBase64($Xml.Evaluate('Contract')));

var pdf = $Files.AddBase64(writer.SaveToBase64('.pdf'), 'Contract.pdf', 'application/pdf');