Aspose.Total for C++ file format automation libraries allows C++ developer to convert PS to DOCM in two simple steps. Firstly, you can use Aspose.PDF for C++ API to convert PS file format to DOC. Secondly, by using advanced Word Document Processing API Aspose.Words for C++ , you can export DOC to DOCM.
C++ API to Render PS to DOCM
Get Started with C++ File Automation APIs
Install from command line as
nuget install Aspose.Total.Cpp or via Package Manager Console of Visual Studio with
Alternatively, get the offline MSI installer or DLLs in a ZIP file from downloads .
// load PS file with an instance of Document class reference auto doc = MakeObject<Document>(u"sourceFile.ps"); // save PS as a DOC doc->Save(u"DocOutput.doc", SaveFormat::Doc); // load DOC with an instance of Document System::SharedPtr<Document> wordDoc = System::MakeObject<Document>(u"DocOutput.doc"); // save document as Docm wordDoc->Save(u"output.Docm");
Change Password of PS Document via C++
In the process of rendering PS to DOCM, you can open a password protected PS and also change its password. In order to change the password of a PS file, you must know the owner password of that document. You can load password protected PDF document with Aspose.PDF for C++ by specifying its owner password and use ChangePasswords method to change the password.
// load an existing PS Document auto doc = MakeObject<Document>(L"input.ps", L"owner"); // change password of PS Document doc->ChangePasswords(L"owner", L"newuser", L"newuser"); // save the document doc->Save(L"output.Doc");
Restrict DOCM File Editing via C++
You can also restrict DOCM file editing using using Aspose.Words for C++ API. Sometimes you may need to limit the ability to edit a document and only allow certain actions with it. API enables you to control the way you restrict the content using the ProtectionType enumeration parameter. The following code example demonstrates how to restrict editing in a document so only editing in form fields is possible.
// load Doc with an instance of Document auto doc = System::MakeObject<Document>("input.doc"); // document protection only works when document protection is turned and only editing in form fields is allowed. doc->Protect(ProtectionType::AllowOnlyFormFields, u"password"); // save the protected document. doc->Save(u"Protected.Docm");
Explore PS Conversion Options with C++
What is PS File Format?
The PS (PostScript) file format is a page description language developed by Adobe Systems. It is commonly used for printing and is supported by a wide range of printers and imaging devices. PS files contain instructions that describe how elements such as text, images, and graphics should be rendered on a printed page.
PS files are created by applications that generate PostScript output, such as Adobe Illustrator, Adobe InDesign, or other graphics software. They are primarily used in professional printing workflows, where high-quality and consistent output is required.
The PS file format is based on a stack-based programming language, where commands and operands are placed on a stack and executed in a sequential manner. This allows for precise control over page layout, typography, color, and other printing parameters.
PS files are typically text-based and can be opened and edited with a text editor. They consist of a series of ASCII characters that represent the PostScript code. The code describes the arrangement and appearance of objects on a page, including text positioning, image placement, and graphical transformations.
While PS files are primarily used for printing, they can also be converted to other formats for digital distribution or further processing. For example, PS files can be converted to PDF (Portable Document Format) files, which are widely supported and can be easily viewed and printed on various devices.
What is DOCM File Format?
The DOCM file format is an extension used by Microsoft Word to indicate a document that contains macros. Microsoft Word is a widely used word processing program that allows users to create and edit various types of documents. Macros in Word are small programs or scripts that automate repetitive tasks, enhance functionality, or add custom features to documents.
The inclusion of macros in DOCM files enables users to automate tasks within their Word documents, such as performing complex calculations, generating dynamic content, or applying specific formatting. Macros are typically written in Visual Basic for Applications (VBA), a programming language integrated into Microsoft Office applications.
By using macros, users can streamline their workflow, save time, and increase productivity. They can create personalized templates, automate document formatting, or develop custom solutions tailored to their specific needs. Macros in DOCM files can be accessed and executed by users, providing an interactive and dynamic experience within the document.
It’s important to note that DOCM files can potentially contain malicious macros, as macros can be used to execute harmful actions or spread malware. As a security measure, Microsoft Word applies various security settings to restrict the execution of macros in DOCM files. Users are typically prompted to enable or disable macros when opening a DOCM file from an unknown or untrusted source.
The DOCM format is fully compatible with Microsoft Word and can be opened, edited, and saved using the application. However, compatibility with other word processing software or older versions of Microsoft Word may vary. To ensure compatibility across different platforms, it is advisable to save DOCM files in alternative formats, such as DOCX, which do not support macros.