Export

Discover the simple and flexible export options in the Picsart Photo and Video Editor SDK, catering to various project requirements.

Export made easy

The export method can be called through the button located in the top-right corner of the Picsart Photo and Video Editor SDK's navigation bar. It serves as the "Next" button, and its label can be customized.

Export from outside

You can also initiate project export from outside the editor's scope. This is particularly useful when the top navigation bar is disabled.

PicsartInstance.export();

Both options mentioned above trigger the execution of the onExport callback function, which sends the export data. More details about this can be found below.

👍

That's it !

Easy peasy.

Control what to export

When preparing the editor for opening, you can provide the list of resources that should be exported. At least one format should be specified, as well as you can add more than one resource to be exported.

For each export format listed, it's possible to define additional settings like presented in the example below.

Additionally, you can control the quality of the exported image as well as whether the resource should be provided as a blob, a buffer or a base64 string.

PicsartInstance.open({
  // additional configurations
  exportFormats: ['print/pdf'],
  exportSettings: {
     'print/pdf': {
        pageInfo: true, 
        colorBars: true,
        emptyMarging: true,
        starTarget: true,
        registrationMark: true,
        cropMark: true,
        colorBar: true,
        tintBar: true
     }
  },
  exportType: 'blob'
  quality: 90,
  // additional configurations
);

The full list of available options are described in the full list of parameters.

onExport

Now that you have set up the editor, and filled in what and how the result should be exported, the editor is ready for use. When it's time to export the result, you can handle the output by either configuring a callback during Picsart Photo and Video Editor SDK initialization like here

PicsartInstance.open({
  // most of the configurations go here, plus
  onClose:      () => {
  },
  onExport:     (result) => {
  },
  onError:      (message) => {
  }
);

or separately, as shown in the example below:

PicsartInstance.onExport((result) => {
    if (result.data.imageData) {
        const photo = result.data.imageData;
    }

    if (result.data.videoData) {
       const taskId = result.data.videoData.taskId;
    }
    
    if (result.data.replayData) {
       const replay = result.data.replayData;
    }
    
    if (result.data.printData) {
       const printPDF = result.data.printData;
    }

    if (result.data.previewPdfData) {
       const printPDF = result.data.previewPdfData;
    }
    
     if (result.done === undefined || result.done >= 100) {
       PicsartInstance.close();
    }
});

The onExport callback is triggered once all the configured exports (see exportFormats above) are ready. The result of each export format is stored within its respective data object, as demonstrated in the example above.

Export Parameters

Below is a comprehensive list of parameters that can be used to customize the export process.

NameTypeDescriptionDefault
dataObjectThis object contains the export data for all requested export formats. The actual value of the data may vary depending on the chosen export type (buffer, base64, blob).

data.imageData - all image formats do get exported here.
data.printData - the print-ready PDF data does get exported here.
data.previewPdfData - the preview PDF data does get exported here.
result.data.replayData - the saved design/project state does get exported here. Note, video-enabled cases do not support this option.

data.videoData - all video formats do get exported here. The exception for the video is that it doesn't contain the actual video file, but the data.videoData.taskId, which is a unique ID used to request the video after it is created. To retrieve the exported video you will need to make an API call as described here. Another element that one gets with the videoData is the subtitles information through data.videoData.subtitles (as a blob, base64, buffer).

Note, that if the exportFormats doesn't list, for example, that a video format should be exported, then data.videoData will be a null.
data.imageData = (blob)
appliedTextsArrayAn array of texts that were added during the editing process.[]
appliedTemplateIdStringThe ID of the template used in the current editing session.empty
doneNumberThis parameter is only included when async export is set to true, it returns the percentage of export done based on the amount of export files configured to be exported, once it reached 100 the Editor is good to get closed. If async is set to false (default) done parameter will be undefined.empty