This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/editor/page-manipulation/add-margins.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Add margins to PDF pages using JavaScript | Nutrient SDK

It’s possible to individually add margins to multiple document pages using the addPageMargins document operation.

This feature is only available to customers who have purchased the Document Editor component. If you want to try it, contact our Sales team.

How to add margins to pages using the programmatic API

You can use NutrientViewer.Instance#applyOperations to add margins to PDF document pages:

await instance.applyOperations([
{
type: "addPageMargins",
pageIndexes: [1, 2],
rect: new NutrientViewer.Geometry.Inset({
left: 10,
top: 10,
right: 10,
bottom: 10
})
}
]);

If you omit the pageIndexes property from the code above, all the PDF document’s pages will have their margins modified.