guideExport to PDF - quick start

The aim of this article is to get you up and running with the Export to PDF feature in your CKEditor Premium Features free trial.

Follow the steps below:

# Subscribe to the CKEditor Premium Features free trial

Create an account by signing up to CKEditor Premium Features free trial. After signing up, you will receive access to the customer dashboard (CKEditor Ecosystem dashboard).

CKEditor Premium Features free trial sign up view.

You will be asked to check the features you are most interested in.

Checking these features does not affect the trial bundle contents — all the features will be available regardless of the choice. We just want to know your needs better.

# Log in to the CKEditor Ecosystem dashboard

Log in to the CKEditor Ecosystem dashboard. You will receive a confirmation email and will be asked to create a password for your account. Keep it safe.

# Account dashboard

After logging in, click “CKEditor” under the “Your products” header on the left. You will see the subscription parameters overview together with the management area below.

Your CKEditor trials view in the customer dashboard.

# Creating token endpoint

Before you can use your newly activated CKEditor Premium Features free trials bundle, you first need to create a security token endpoint in your application. The role of this endpoint is to securely authorize end users of your application to use CKEditor Cloud Services only if they should have access to the content or action they are requesting.

# Development token endpoint (fast and easy)

If you are just starting, you may use the development token endpoint URL which is available out of the box and requires no coding on your side. The URL of the development token endpoint can be obtained easily in three simple steps:

  1. To work with CKEditor Premium Features like export to PDF, you need to create an environment. Environments allow you to create access credentials, manage webhooks, configure features and connect to CKEditor Cloud Services. You may have more than one environment to serve separate instances or integrations. From the list the environments choose the one that you want to manage.

    Environments list.

    Please refer to the the environment management guide if needed.

  2. After choosing the environment, press the “Generate” button in the “Development token URL” section of the “CKEditor configuration” tab:

    Press the button to generate development token URL.

    The development token URL will show up in the “Development token URL” section:

    CKEditor configuration with the development token URL.

    The development token endpoint is a special endpoint to help you in getting started with CKEditor Cloud Services. It offers unrestricted, full access to the service and will expire 30 days after being used for the first time. You should not use it on production. Anyone knowing this URL will have full access to the associated environment.

# Writing your own token endpoint (advanced users)

Skip this step if you use the development token endpoint.

To write your own security token endpoint, you need to create access credentials for the selected environment by going to the “Access credentials” tab and clicking the “Create a new access key” button.

Read more in the Creating access credentials section of the Environments management guide.

# Integrating the Export to PDF feature with the editor

# Integrating the Export to PDF feature with CKEditor 4

You can use the Online builder for CKEditor 4 to integrate the Export to PDF plugin into your build.

There is just one thing you have to do to activate plugin - set a exportPdf_tokenUrl configuration option:

CKEDITOR.replace( 'editor', {
    exportPdf_tokenUrl: 'https://example.com/cs-token-endpoint'
} )

This is all. Refer to the Export to PDF configuration guide for step-by-step integration walk-through.

# Integrating the Export to PDF feature with CKEditor 5

To install the plugin into your WYSIWYG editor, use the online builder to generate a custom CKEditor 5 build with the plugin enabled. Alternatively, refer to the installation guide in the plugin documentation to do it on your own.

Configure the plugin using the token generated earlier, pasting the link in the configuration (see CloudServicesConfig):

    ClassicEditor
        .create( document.querySelector( '#editor' ), {
            cloudServices: {
                tokenUrl: 'https://example.com/cs-token-endpoint',
            }
        } )
        .then( ... )
        .catch( ... );

# Using the REST API service

The WYSIWYG editor plugin is not the only option possible to put the CKEditor Cloud Services HTML to PDF converter service. You can also generate your PDF documents programmatically from HTML data, using the feature’s REST API, as mentioned in the feature overview. It is a convenient and powerful solution if the data needs to be processed between edition and file generation, for example when serializing names, mail merge, etc.

Refer to the Export to PDF guide to get in-depth information about the REST API and check the available options.