HTML JPG PDF XML PDF
Aspose.Cells  for C++
PDF

Encrypt PDF Files via C++

Convert Excel spreadsheets to PDF files and password protect them using Aspose.Cells C++ library.

How to Encrypt PDF File Using C++

In order to Encrypt PDF file, we’ll use

Aspose.Cells for C++

API which is a feature-rich, powerful and easy to use document encryption API for C++ platform. You can download its latest version directly, just open

NuGet

package manager, search for Aspose.Cells.Cpp and install. You may also use the following command from the Package Manager Console.

Aspose.Cells


PM> Install-Package Aspose.Cells.Cpp

Steps to Encrypt PDF Files via C++

Document protection using Aspose.Cells APIs can be done with just few lines of code.

  1. Use the Workbook class to load or create a new Excel file
  2. Set security options using PdfSecurityOptions class
  3. Save the encrypted PDF file by Save() method

System Requirements

Aspose.Cells for C++ supports on all major platforms and Operating Systems. Please make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with C++ Runtime Environment for Windows 32 bit, Windows 64 bit and Linux 64 bit.
  • Add reference to the Aspose.Cells for C++ DLL in your project.
 

Command


Aspose::Cells::Startup();

//load/creat the Excel file
Workbook wb;

//Set cell value
wb.GetWorksheets().Get(0).GetCells().Get(u"A1").PutValue(u"test");

//Set security options using PdfSecurityOptions class
PdfSecurityOptions securityOptions;
securityOptions.SetOwnerPassword(u"123");
securityOptions.SetPrintPermission(true);
securityOptions.SetAccessibilityExtractContent(true);

//Set saving PDF parameters
PdfSaveOptions pdfSaveOptions;
pdfSaveOptions.SetSecurityOptions(securityOptions);

//Save encrypted PDF files
wb.Save("security.pdf", pdfSaveOptions);

Aspose::Cells::Cleanup();
 
  • About Aspose.Cells for C++ API

    Aspose.Cells API can be used to create, edit, convert and render Microsoft Excel formats to different formats. Moreover, it can be used for comprehensive charting, scalable reporting and reliable calculations within software applications. Aspose.Cells is a standalone API and it does not require any software like Microsoft or OpenOffice.

    Free App to Protect PDF

    PDF What is PDF File Format?

    Portable Document Format (PDF) is a type of document created by Adobe back in 1990s. The purpose of this file format was to introduce a standard for representation of documents and other reference material in a format that is independent of application software, hardware as well as Operating System. The PDF file format has full capability to contain information like text, images, hyperlinks, form-fields, rich media, digital signatures, attachments, metadata, Geospatial features and 3D objects in it that can become as part of source document.

    Read More

    Other Supported Protection Documents

    Using C++, one can protect other files including.

    XLS (Excel Binary Format)
    XLSB (Binary Excel Workbook File)
    XLSM (Spreadsheet File)
    XLSX (OOXML Excel File)