Skip to content
Advertisement

How to convert editable PDF to non-editable PDF in PHP/NodeJS?

Problem

I would like to know is there any PHP/NodeJS API available to convert editable PDF to non-editable PDF online. We have a client application where we need a scenario where the user downloads the PDF should not able to modify it thought any software (eg. Foxit reader, Adobe)

Basically, we are using PDF-LIB right now and it seems there is no solution for the non-editable pdf API to set access privileges, I have search a lot but does not found any API for that, Am not using the pdf-flatten because we want everything selectable, Appreciate your help.

List of libraries tried and fail to achieve the results

  1. bpampuch/pdfmake issue can’t load an existing pdf
  2. PDF-LIB issue can’t support permissions
  3. nrhirani/node-qpdf issue File restrictions not working properly

Advertisement

Answer

After a lot of research work and tried multiple libraries in PHP/Node. I don’t found any library that is mature enough to proceed with that, so I decided to make an API that will build in different technology C# and Java

Solution we post the PDF URL through API, the API download that file, and apply for multiple permission according to the dataset.

Library the library we choose is ASPOSE

// These can be true/false
config.IsPrint = true;

// Document is allowed to be changed.
config.IsModify = false;

// Annotation is allowed.
config.IsAnnot = true;

// Form filling is allowed.
config.IsFillForm = true;

// Content extraction is allowed.
config.IsExtract = true;
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement