This will add a new page to the document. The default tags, name and layout will be applied if set. The page mode is predetermined (single or spread) based on the product configuration.
Optional
callback: ((page) => void)The callback will be triggered once the function has finished. If successfull, it will pass the new page object as a parameter. Otherwise it will pass null.
Optional
afterPageOrId: string | PageAn optional parameter to define the page (via object or id) after which to insert the new page. Otherwise it will be added at the end.
Optional
ignorePageLimit: booleanFlag to control if the page limit should be ignored for the new page (e.g. would allow to go over the maximum count). This can only be used for server side code in the output generation stage.
Helper function to add media items to the current document - similar to the ME Upload UI. The media items are added full page. For multi page media items it can optionally add all pages by also inserting pages. It will also resize the pages to match the media.
It does the following actions:
The zero based starting index where to insert the pages into. It will add pages if they do not exist if necessary, otherwise reuse existing pages. All pages will be cleared.
The media item to insert. If this is a multi page media item, it will add all pages by also inserting pages based on the flag. If possible, it will resize the pages to match the media.
Flag to control if all children of the media item should be added as well. This is only relevant for multi page media items.
Optional
callback: ((success) => void)This optional callback is triggered once the process has finished (the overlay has been removed). The parameter will indicate if all media items could be added or not.
Return a single page either by it's unique id (id) or by it's zero-based index. Return null if not found
If this is a number, we will try to find the page by it's index. If this is a string, we will try to find the page by it's id.
The Page object if index or id is valid, otherwise null.
Return pages by their name. If exact is set to true, the name has to match exactly, otherwise it will return pages where the name parameter is within the page name. This will return an array, so it can be any number of matching results.
The name of the string to search for.
Optional
callback: null[Deprecated] Optional callback to be triggered once the search has finished with the results as parameter. Shouldn't be used anymore, please pass null instead.
Optional
exact: booleanBoolean flag to control if the name has to match exactly or if it is enough if the name is contained within the page name.
An array of the found pages. If no pages are found, the array will be empty.
Clears content on the given page
The page to clear. Identified by zero-based index, page id, page name or page object.
Optional
drawingsOnly: booleanOptional flag to clear only drawings - that is only fields of type PathField. Default is false.
Optional
callback: null[Deprecated] Optional callback to be triggered once the clear has finished. Shouldn't be used anymore, please pass null instead.
Optional
keepDoNotSelectAndDelete: booleanOptional flag to delete all fields except those which are marked as doNotDelete and doNotSelect. Default is false. This is very useful to clear a page but keep the original design parts.
Returns true if the page has been found and has been cleared, otherwise false.
Deletes a page from the document. Note that there are two areas which control the delete feature. At first comes the product configuration which defines which pages can never be deleted. In addition, a script can mark a page as not deletable. Only the first constraint will be checked here. The script setting is for UI only.
The page to delete. Identified by zero-based index, page id, page name or page object.
True if the page has been deleted, otherwise false.
Changes the order of a page by moving it within the page listing forward or backwards based on the advance parameter. The advance parameter can be positive or negative and the code ensures that the page will not be moved outside of the page listing (e.g. you can use a large negative number to move the page to the start of the listing). The function will not ensure that the final page order is valid (e.g. in case of cover or spread start/end pages) - that needs to be done by the caller.
The page to move. Identified by zero-based index, page id, page name or page object.
The number of pages to move the page. This can be positive or negative.
True if the page has been moved, otherwise false.
Helper function to change the z-index of the fields on a page in one call. This is helpfull to rearrange the fields on a single page easily instead of adjusting the z-index of each field individually. Notes:
That means this should be called ideally only with all fields on that page to get a deterministic result.
The page to rearrange. Identified by zero-based index, page id, page name or page object.
The list of fields, either as field objects or as their ids. The order of this array will determine the order of the result.
Flag to control if an undo record should be created.
Flag to control if change events should be triggered
Returns true if the page has been found and has been rearranged, otherwise false.
Helper function to generate a render of the given page. This will return a base64 encoded image of the page or false if the render failed.
The page to render. Identified by zero-based index, page id, page name or page object.
The size of the render identified by the width in pixels. The height will be calculated based on the aspect ratio of the page.
The callback will be triggered once the render is ready. It will pass as the first parameter the base64 encoded image or false if the render failed.
Optional
renderPrintOnly: booleanOptional flag to control if only fields marked for print should be rendered or if all fields should be included. By default all fields are included.
Set the background to a determined background item. This will remove any existing background item.
The page to set the background for. Identified by zero-based index, page id, page name or page object.
The background item to set. This can be null to remove the background.
Optional
position: SubPagePositionOptional position, this can be used to target only the left or right page of a spread. Default is Any.
True if the background has been set, otherwise false.
Set the background to a determined color. This will remove any existing background item. Any MegaEdit color value can be used.
The page to set the background for. Identified by zero-based index, page id, page name or page object.
The color to set. Any MegaEdit color value can be used.
Optional
position: SubPagePositionOptional position, this can be used to target only the left or right page of a spread. Default is Any.
True if the background has been set, otherwise false.
Set the deletable flag for the page. Note that there are two areas which control the delete feature. At first comes the product configuration which defines which pages can never be deleted. In addition, scripts can flag certain pages which can never be deleted despite the configuration sees them as optional.
The page to set the delete flag for. Identified by zero-based index, page id, page name or page object.
The deletable flag. If false, the page cannot be deleted via the UI. If true, the system may still prevent deletion based on the product configuration (e.g. spread start/end pages, cover, min page count etc).
Sets a layout to a page. This will adjust the target page contents and copy data from the old layout to the new layout if possible.
The page to set the layout for. Identified by zero-based index, page id, page name or page object.
The new layout to set.
Optional
index: numberThe zero based index of the subpage. This is only relevant for double pages. Default is 0 for single pages and full spread layouts as well as for spread pages for the left subpage. 1 is used for the right subpage of a spread page.
Optional
callback: (() => void)The callback gets triggered once the layout has been applied.
Set the name of a page. If the name is empty, it will be autogenerated.
The page to set the name for. Identified by zero-based index, page id, page name or page object.
The new page name or an empty string to use the autogenerated name.
True if the name has been set, otherwise false.
Set the page tags to the given list. This will replace any existing tags.
The page to set the tags for. Identified by zero-based index, page id, page name or page object.
The tag array. Note that each tag should be unique and may not contain the '|' character.
True if the tags have been set, otherwise false.
Changes the visibility state of a page. This is only applied to the user interface. The page would be part of the output (delete the page to remove it from there).
The page to set the visibility for. Identified by zero-based index, page id, page name or page object.
Flag to control if the page should be visible or not.
True if the visibility has been set, otherwise false.
Call to update the small page preview within the UI for the page selector. This is because not all changes to the page will trigger an update of the preview - only when triggered via the UI. This can be used to update an individual page - or by passing null, all pages will be updated.
The optional page to update. If null, all pages will be updated. Identified by zero-based index, page id, page name or page object.
Optional
callback: ((hasUpdated) => void)The callback will be triggered once the update has finished. The parameter will indicate if the preview has been updated or not, which can be false if the page does not exist.
Generated using TypeDoc
The pages interface gives access to manage and maintain the pages within the document.
Note that this manages MegaEdit page objects, which are, depending on the configuration, full spreads or individual pages.