Office-to-PDF Conversion

PSPDFKit for Web Server-Backed enables you to convert Office documents to PDF. This capability is coming soon to PSPDFKit for Web Standalone. For more information, see our proof of concept.

To convert an Office file to PDF, you need to upload your Office document to PSPDFKit for Web Server-Backed.

Launch Demo

Licensing

To convert Office documents to PDF with PSPDFKit for Web Server-Backed, contact Sales to add Office support to your license.

Example

The following example illustrates conversion using a Word file. To create a new document from a Word file, POST its contents to /api/document:

Request

curl -X POST http://localhost:5000/api/documents \
  -H "Authorization: Token token=<secret token>" \
  -F file=@/path/to/word.docx
POST /api/documents HTTP/1.1
Content-Type: multipart/form-data; boundary=customboundary

--customboundary
Content-Disposition: form-data; name="file"; filename="word.docx"
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

<DOCX data>
--customboundary--

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "document_id": ...,
    "errors": [],
    "sourcePdfSha256": ...,
    "title": "..."
  }
}

PSPDFKit for Web Server-Backed will automatically convert the uploaded file to a PDF and store it for you. Afterward, you can download it as a PDF using the document ID that was previously returned:

Request

GET /api/documents/:document_id/pdf
Authorization: Token token="<secret token>"
$ curl "http://localhost:5000/api/documents/:document_id/pdf \
   -H "Authorization: Token token=<secret token>"

Response

HTTP/1.1 200 OK
Content-Type: application/pdf

<PDF data>

Once an Office file is uploaded and converted, you can also treat it as you would any other document, using all the features PSPDFKit for Web Server-Backed provides.