@abhisheknagarro
Thank you for contacting us.
HTML to PDF conversion**
Please check HTML to PDF Conversion article regarding how to convert HTML document to PDF. The article contains cURL examples as well as SDK Examples. You may use Aspose.HTML Cloud SDKs to quickly integrate Aspose.HTML APIs into your project.
HTML to WORD conversion**
Unfortunately, there is no API to directly convert HTML document to Word. But you can convert PDF document to Word with the following API:
POST /words/{name}/saveAs
Please check Convert PDF Document to Word article for documentation of this API. Aspose.Words Cloud SDKs are available at following GitHub account: Aspose.Words Cloud · GitHub
However, While going thru your api I could not find an option to provide header footer for conversion. I want my header and footer to repeat on every page so I cant pass it in html.
Is there a way?
With Aspose.Words Cloud APIs you can add Header and Footer to a new or existing Word document. Following are the steps to add Header and Footer:
1- Add header with PUT method (it will create one empty paragraph). You may test the API live in the browser by setting following values of the parameters:
name
= SampleDocument.docx
headerFooterType
= “HeaderFirst” (Note the Double quotes)
destFileName
= SampleDocument_Result.docx
The API should return the following response:
{
"HeaderFooter": {
"Paragraphs": {
"link": {
"Href": "http://api.aspose.cloud/v1.1/words/SampleDocument_Result.docx/sections/0/headersfooters/0/paragraphs",
"Rel": "self",
"Type": null,
"Title": null
}
},
"DrawingObjects": {
"link": {
"Href": "http://api.aspose.cloud/v1.1/words/SampleDocument_Result.docx/sections/0/headersfooters/0/drawingObjects",
"Rel": "self",
"Type": null,
"Title": null
}
},
"Type": "HeaderFirst",
"link": {
"Href": "http://api.aspose.cloud/v1.1/words/SampleDocument_Result.docx/sections/0/headersfooters/0",
"Rel": "self",
"Type": null,
"Title": null
}
},
"Code": 200,
"Status": "OK"
}
The possible values of headerFooterType
parameter values are:
- HeaderEven
- HeaderPrimary
- FooterEven
- FooterPrimary
- HeaderFirst
- FooterFirst
2- Please use the following API to add text to paragraph (or add another paragraph or image or anything that you want):
PUT /words/{name}/{paragraphPath}/runs
The parameter values would be:
name
= SampleDocument_Result.docx
paragraphPath
= sections/0/headersfooters/0/paragraphs/0
run
= { “Text”: “hello!” }
The API response should be as follows:
{
"Run": {
"Text": "hello!",
"NodeId": "0.0.0.0",
"link": {
"Href": "http://api.aspose.cloud/v1.1/words/SampleDocument_Result.docx/sections/0/headersfooters/0/paragraphs/0/runs/0",
"Rel": "self",
"Type": null,
"Title": null
}
},
"Code": 200,
"Status": "OK"
}
Now finally set DifferentFirstPageHeaderFooter
value to true
using following API:
POST /words/{name}/sections/{sectionIndex}/pageSetup. The parameter values would be:
name
= SampleDocument_Result.docx
sectionIndex
= 0
pageSetup
= { “DifferentFirstPageHeaderFooter”: true }
The API response should be as follows:
{
"PageSetup": {
"Bidi": false,
"BorderAlwaysInFront": true,
"BorderAppliesTo": "AllPages",
"BorderDistanceFrom": "Text",
"BottomMargin": 36,
"DifferentFirstPageHeaderFooter": true,
"FirstPageTray": 0,
"FooterDistance": 35.4,
"Gutter": 0,
"HeaderDistance": 35.4,
"LeftMargin": 36,
"LineNumberCountBy": 0,
"LineNumberDistanceFromText": 0,
"LineNumberRestartMode": "RestartPage",
"LineStartingNumber": 1,
"Orientation": "Portrait",
"OtherPagesTray": 0,
"PageHeight": 841.95,
"PageNumberStyle": "Arabic",
"PageStartingNumber": 1,
"PageWidth": 595.35,
"PaperSize": "A4",
"RestartPageNumbering": false,
"RightMargin": 36,
"RtlGutter": false,
"SectionStart": "NewPage",
"SuppressEndnotes": false,
"TopMargin": 36,
"VerticalAlignment": "Top",
"link": {
"Href": "http://api.aspose.cloud/v1.1/words/SampleDocument_Result.docx/sections/0/pagesetup",
"Rel": "self",
"Type": null,
"Title": null
}
},
"Code": 200,
"Status": "OK"
}
Input Document: SampleDocument.docx.zip (49.8 KB)
Output Document: SampleDocument_Result.docx.zip (97.4 KB)
Support for merging files**
Please use following API to merge PDF documents:
PUT /pdf/{name}/merge
Support for Converting large files ( i.e 100-200 pages)**
With Aspose APIs you can convert documents of any size.
We hope this helps.