Skip to content

Why does using ConvertDocument not directly set pageSetup, but require secondary processing of the page #12

@Sunny-UU

Description

@Sunny-UU

const wordsApi = new WordsApi(clientId, secret);
const document = Readable.from(content)

const request = new ConvertDocumentRequest({
  format: "docx",
  document,
});

//first processing of convertDocument
const word = await wordsApi.convertDocument(request)

const wordBuf = Readable.from(word.body)

const requestPageSetup = new PageSetup({
  paperSize: PageSetup.PaperSizeEnum.A4,
  orientation: PageSetup.OrientationEnum.Landscape
})

//secondary processing of the page
const updateRequest = new UpdateSectionPageSetupOnlineRequest({
  document: wordBuf,
  sectionIndex: 0,
  pageSetup: requestPageSetup
});

const wordsResponse = await wordsApi.updateSectionPageSetupOnline(updateRequest)

fs.writeFile("a4.docx", wordsResponse.body.document.values().next().value);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions