Foxit pdf SDK for MAC

Build a fully customized PDF Viewer with our Mac OS PDF SDK where you choose what features are available to your users. Add annotations, form filling and signatures all with a few lines of code and an excellent library of functionality to choose from. Our core API provides the power you need to build your own PDF viewer and editor or backend PDF workflows that make sense to your business goals.

Developing with PDF SDK for Mac

Foxit PDF SDK for Mac makes developing feature rich apps easy. Our core API, designed with Mac developers in mind, has a powerful PDF library for taking your apps to the next level. Code in C++ or Objective-C using Xcode or your preferred IDE and build a PDF solution that will be fast, robust and beautiful.

PDF SDK for Mac Support

FEATURES

PDF Viewing

Our core API provides for high-fidelity rendering of PDF documents with optimized performance for desktop and mobile platforms.

Digital Signature

Use ink signatures to let customers sign documents in their digital devices. No need to print a file to sign again!

PDF Forms

Give users the ability to fill out digital forms on the go with their device of choice. Apps have never been more productive!

PDF Password Android
Strikeout annotation
Full Text Search

Rights Management

Our PDF SDK can generate secure PDFs with native encryption/decryption or integrate with customized DRM or IRM security systems. Our technology integrates with Microsoft RMS.

PDF Annotations

Our PDF SDK provides full support for annotating and marking up content with an extensive range of functions for creating, editing or importing/exporting annotations.

Full-Text Search

Fast full-text search for any PDF document, language, or encoding type. The SQLite-based full-text search delivers near-instant results, even for repositories on any digital device.

New!

Introducing PDF SDK 6.1

Foxit PDF SDK 6.1 introduces full support for Xamarin, Cordova, and React Native on Android and iOS, and Kotlin on Android, as well as support for Associated Files, Embedded fonts, and improvements to our Redaction features. Try it today for free for 15 days!

ADVANCED TECHNOLOGY

XFA FORMS

XFA Forms are XML-based forms wrapped inside a PDF. Securely capture, present, move, process, output, update and print information associated with static and dynamic XFA forms. Simplify your data sharing, transportation and availability with XFA.

RIGHTS MANAGEMENT

Keep your PDF documents secure by connecting your application and files to Microsoft's Rights Management Services platform natively. Foxit PDF SDK also integrates with your IRM and DRM solution.

OCR

Convert scanned documents to searchable text PDFs with our highly accurate enterprise optical character recognition (OCR) software. Designed for scanning, and archiving, our robust functionality outputs 13 different file formats including PDF & PDF/A.

REDACTION

Programmatically search and sensor sensitive information in a document for legal or security purposes to keep your customer and employee information safe.XFA.
Achieve full GDPR-compliance.

CONNECTED PDF

Leverage Foxit's cutting-edge technology that powers document intelligence, security and collaboration services, programmatically, for PDF files. Secure files, access analytics, and collaborate in real time, all within one SDK.

CONVERSION

Leverage our conversion and compression technology to speed up file conversion and archiving. Convert TIFF, JPEG, Word, Email, HTML, ASCII text and more to file formats including PDF and PDF/A.

XFA FORMS

XFA Forms are XML-based forms wrapped inside a PDF. Securely capture, present, move, process, output, update and print information associated with static and dynamic XFA forms. Simplify your data sharing, transportation and availability with XFA.

Rights Management

Keep your PDF documents secure by connecting your application and files to Microsoft's Rights Management Services platform natively. Foxit PDF SDK also integrates with your IRM and DRM solution.

OCR

Convert scanned documents to searchable text PDFs with our highly accurate enterprise optical character recognition (OCR) software. Designed for scanning, and archiving, our robust functionality outputs 13 different file formats including PDF & PDF/A.

REDACTION

Programmatically search and sensor sensitive information in a document for legal or security purposes to keep your customer and employee information safe. Achieve full GDPR-compliance.

CONNECTEDPDF

Leverage Foxit's cutting-edge technology that powers document intelligence, security and collaboration services, programmatically, for PDF files. Secure files, access analytics, and collaborate in real time, all within one SDK.

CONVERSION

Leverage our conversion and compression technology to speed up file conversion and archiving. Convert TIFF, JPEG, Word, Email, HTML, ASCII text and more to file formats including PDF and PDF/A.

Try our Technology

Our Mac PDF Reader is built with the same technology as our PDF SDK for Mac and is free to download from the App Store. Try our technology today.

Benefits

INTEGRATED DEVELOPMENT

Our Mac PDF SDK is built with Apple developers in mind. Fire up Xcode or your IDE of choice, jump in and enjoy developing your app using an SDK that has been thoroughly road-tested by our own Mac and iOS developers. 

Easy to Integrate

We developed our Mac PDF Library with platform considerations a priority. This means that we follow Mac specific naming conventions and coding conventions to make our product native to it.

Feature Rich

Our feature set is consistent across mobile and desktop platforms to make cross platform development linear and easy. We are always updating our feature set, so keep an eye on our product page for announcements

Powered by Foxit's Core Technology

The core technology of Foxit PDF SDK has been around for years and is trusted by a large number of well-known companies, Foxit’s powerful engine makes document viewing fast and consistent in all environments.

SYSTEM REQUIREMENTS

  • Mac OS X 10.6 to 10.14
  • XCode version 8 or higher

LOADING A FILE AND ADDING AN IMAGE in XCode

int main(int argc, char *argv[])
{
  int err_ret = 0;
  WString input_file = input_path + L"AboutFoxit.pdf";

  WString output_directory = output_path + L"bookmark/";
#if defined(_WIN32) || defined(_WIN64)
  _mkdir(String::FromUnicode(output_directory));
#else
  mkdir(String::FromUnicode(output_directory), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
#endif

  WString output_file1 = output_directory + L"bookmark_add.pdf";
  WString output_file2 = output_directory + L"bookmark_change.pdf";
  WString bookmark_info_file = output_directory + L"bookmark_info.txt";

  SdkLibMgr spSdkLibMgr;
  ErrorCode error_code = spSdkLibMgr.Initialize();
  if (error_code != foxit::e_ErrSuccess) {
    return 1;
  }

  try {
    PDFDoc doc(input_file);
    ErrorCode error_code = doc.Load();
    if (error_code != foxit::e_ErrSuccess) {
      printf("The Doc [%s] Error: %d\n", (const char*)String::FromUnicode(input_file), error_code);
      return 1;
    }

    // Show original bookmark information.
    ShowBookmarksInfo(doc, bookmark_info_file);

    //Get bookmark root node or Create new bookmark root node.
    Bookmark root = doc.GetRootBookmark();
    if (root.IsEmpty())
    {
      root = doc.CreateRootBookmark();
    }
    for (int i = 0; i < doc.GetPageCount(); i += 2) {
      Destination dest = Destination::CreateFitPage(doc, i);
      CFX_WideString ws_title;
      ws_title.Format((FX_LPCWSTR)L"A bookmark to a page (index: %d)", i);
      Bookmark child = root.Insert(ws_title,
        foxit::pdf::Bookmark::e_PosLastChild);
      child.SetDestination(dest);
      child.SetColor(i * 0xF68C21);
    }
    doc.SaveAs(output_file1, PDFDoc::e_SaveFlagNoOriginal);

    // Get first bookmark and change properties.
    Bookmark first_bookmark = root.GetFirstChild();
    first_bookmark.SetStyle(foxit::pdf::Bookmark::e_StyleItalic);
    first_bookmark.SetColor(0xFF0000);
    first_bookmark.SetTitle(L"Change bookmark title, style, and color");

    // Remove next sibling bookmark
    if (!first_bookmark.GetNextSibling().IsEmpty()) {
      doc.RemoveBookmark(first_bookmark.GetNextSibling());
    }

    WString bookmark_info_file = output_directory + L"bookmark_info1.txt";
    ShowBookmarksInfo(doc, bookmark_info_file);

    doc.SaveAs(output_file2, PDFDoc::e_SaveFlagNoOriginal);
    cout << "Bookmark demo." << endl;

  } catch (const Exception& e) {
    cout << e.GetMessage() << endl;
    err_ret = 1;
  }
  catch(...)
  {
    cout << "Unknown Exception" << endl;
    err_ret = 1;
  }

  return err_ret;
}
class SdkLibMgr {
public:
  SdkLibMgr() : isInitialize(false){};
  ErrorCode Initialize() {
    ErrorCode error_code = Library::Initialize(sn, key);
    if (error_code != foxit::e_ErrSuccess) {
      printf("Library Initialize Error: %d\n", error_code);
    } else {
      isInitialize = true;
    }
    return error_code;

  }
  ~SdkLibMgr(){
    if(isInitialize)
      Library::Release();
  }
private:
  bool isInitialize;
};

WString output_directory = output_path + L"pdf2image/";

void Save2Image(Bitmap& bitmap, int nPageIndex, const char* sExt)
{
  // Add the bitmap to image and save the image.
  Image image;
  image.AddFrame(bitmap);
  WString s;
  s.Format((FX_LPCWSTR)L"AboutFoxit_%d",nPageIndex);
  s = output_directory + s + WString::FromLocal(sExt);
  image.SaveAs(s);

  cout << "Save page " << nPageIndex << " into a picture of " << sExt << " format." << endl;
}

void Save2Image(Image& image, const char* sExt)
{
  WString s = L"AboutFoxit";
  s = output_directory + s + WString::FromLocal(sExt);
  image.SaveAs(s);

  cout << "Save pdf file into a picture of " << sExt << " format." << endl;
}

int main(int argc, char *argv[])
{
#if defined(_WIN32) || defined(_WIN64)
  _mkdir(String::FromUnicode(output_directory));
#else
  mkdir(String::FromUnicode(output_directory), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
#endif

  int err_ret = 0;
  WString input_file = input_path + L"AboutFoxit.pdf";
  const char* support_image_extends[] = {".bmp", ".jpg", ".jpeg", ".png", ".jpx", ".jp2"};
  const char* support_multi_image[] = {".tif", ".tiff"};
  SdkLibMgr spSdkLibMgr;
  ErrorCode error_code = spSdkLibMgr.Initialize();
  if (error_code != foxit::e_ErrSuccess) {
    return 1;
  }

  try {
    PDFDoc doc=PDFDoc(input_file);
    ErrorCode error_code = doc.Load();
    if (error_code != foxit::e_ErrSuccess) {
      printf("The Doc [%s] Error: %d\n", (const char*)String::FromUnicode(input_file), error_code);
      return 1;
    }

    Image image;
    // get page count
    int nPageCount = doc.GetPageCount();
    for(int i=0;i<nPageCount;i++)
    {
      PDFPage page = doc.GetPage(i);
      // Parse page.
      page.StartParse(foxit::pdf::PDFPage::e_ParsePageNormal, NULL, false);

      int width = static_cast<int>(page.GetWidth());
      int height = static_cast<int>(page.GetHeight());
      Matrix matrix = page.GetDisplayMatrix(0, 0, width, height, page.GetRotation());

      // Prepare a bitmap for rendering.
      Bitmap bitmap(width, height, foxit::common::Bitmap::e_DIBArgb, NULL, 0);
      bitmap.FillRect(0xFFFFFFFF, NULL);

      // Render page
      Renderer render(bitmap, false);
      render.StartRender(page, matrix, NULL);
      image.AddFrame(bitmap);
      for(unsigned int j=0;j<sizeof(support_image_extends)/sizeof(support_image_extends[0]);j++)
      {
        const char* extend = support_image_extends[j];
        Save2Image(bitmap,i,extend);
      }
    }

    for(unsigned int j=0;j<sizeof(support_multi_image)/sizeof(support_multi_image[0]);j++)
    {
      const char* extend = support_multi_image[j];
      Save2Image(image,extend);
    }

  } catch (const Exception& e) {
    cout << e.GetMessage() << endl;
    err_ret = 1;
  }
  catch(...)
  {
    cout << "Unknown Exception" << endl;
    err_ret = 1;
  }

  return err_ret;
}