Comment on page
Learn how to generate your first PDF document.
Now that you have an S3 bucket created, Paperplane needs to be able to upload files to it. To do this you'll create an AWS user and generate credentials which are used to upload to S3.
Next, navigate to "Users". You'll see a screen looking something like this:
Next, click "Add user" and choose a suitable user name. Make sure that "Programmatic access" is enabled:
Click through to "Permissions" and select the option to attach the "AmazonS3FullAccess" policy directly to the user:
Click through the following steps, and finally create the user.
Using the "
AllowS3FullAccess" policy is the easiest way to get started, but gives Paperplane broad access to your S3 buckets. You may want to take a look at the guide on restricting AWS permissions which explains how to restrict access using a minimal set of permissions.
After creating the user, you'll be able to download the "Access key ID" and "Secret access key". Make sure to save these as you won't be able to access the secret key again (although you can easily generate a new set of credentials).
Viewing the access key and secret key for the new user
To confirm the user is properly set up, let’s go to Paperplane and create a new "Destination".
Under “Destination”, click “New Destination”. Enter the AWS credentials, bucket name and bucket region:
Finally, click "Create API Key" to add an API key to the destination:
Choose an appropriate name to identify the API key:
Your API key is now ready to use!
Now you’re ready to create a PDF. Here’s an example of creating a new PDF job using the
curlcommand line utility:
myapikeywith the API key you just generated.
$ curl -u myapikey: https://api.paperplane.app/jobs -d url="https://en.wikipedia.org/wiki/Airplane"
The URL you supply must be publicly accessible so that Paperplane can load it. However, you can use an unguessable key such as a UUID in the URL to ensure data remains private. For more details, check out the guide on “Securing access to HTML documents”.
When you create a new job, the API returns the job’s ID and current status, which will initially be
queued. Soon afterwards (normally within 30 seconds) Paperplane will start processing the job by visiting the URL, saving a PDF and uploading it to your S3 bucket. You can check the status of the job by using its ID. Here’s an example using
$ curl -u myapikey: https://api.paperplane.app/jobs/fe748521-5d8f-43d8-9093-7970d2d032d7
When the PDF has been delivered to S3, the job status will update to
delivered. If the job fails for any reason, that status will update to either
delivery_failed. More details on the job statuses can be found in the API reference.