I am trying to write a script which can be used either as part of a REST api endpoint or as a scheduled job to export the full content of a page (read: layout and Images) either as a file (preferably PDF) or as (X)HTML.
The script I've got so far seems to only export basic content elements with no CSS formatting and no inline images, below is a copy of my script code:
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonBuilder
import groovy.transform.BaseScript
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
import javax.ws.rs.core.MediaType
import com.atlassian.confluence.pages.PageManager
import com.atlassian.sal.api.component.ComponentLocator
import java.lang.RuntimeException
@BaseScript CustomEndpointDelegate delegate
//End point name is the same as the method's name
getapipage(httpMethod: "GET", groups: ["confluence-administrators"]) { MultivaluedMap queryParams, String body ->
def pageManager = ComponentLocator.getComponent(PageManager)
def page = pageManager.getPage("SPACE NAME","PAGE TITLE")
return Response.ok(page.getBodyAsString(),MediaType.TEXT_HTML).build()I've looked at using : DefaultXhtmlContent.convertWikiToView but I am not entirely sure if that is the way to go.
Any help or tips would be greatly appreciated 