Cloud Convert gives an option to provide html for header and footer. The html is a seperate html doc in itself containing head (containing css) and body(containing html).
We have worked with the data shared by you and would like to update you that CSS3 is supported by Aspose.PDF for .NET API. Problem appears to be with the HTML string you are passing in below line of code:
page.Header.Paragraphs.Add(new HtmlFragment());
if you replace this line with below code then everything works as expected:
page.Header.Paragraphs.Add(new HtmlFragment("<h1>I am a Header</h1>"));
Please double check the HTML string and then share your kind feedback with us. We have tested it with sample HTML string as in attached file. HeaderSample.zip
We were also trying to put header/footer in a word dcument. Can you please guide us in acheiving that.
We took use of the below api :
Put /words/{name}/{sectionPath}/headersfooters "Insert to document header or footer " :
Not sure of the parameters to pass in this .
Moreover, Is this an api to put header/footer into an existing document? If you guys can share a working sample of putting header/footer to a word and pdf document. It would really be helpful.
Or share a sample raw http request along with headers/queryParams/paylod to achieve the same.
We have worked with attached file in proper format, and everything is working as expected. Please use the line of code in attached TXT file Sample Code.zip and add the header in generated PDF file.
...
//Replace this line from attached file
string test = "";
foreach (Aspose.Pdf.Page page in doc.Pages)
{
page.Header = new Aspose.Pdf.HeaderFooter();
page.Header.Paragraphs.Add(new HtmlFragment(test));
page.Footer = new Aspose.Pdf.HeaderFooter();
page.Footer.Paragraphs.Add(new HtmlFragment("<h1>I am a Footer</h1>"));
}
doc.Save(dataDir + "HeaderFooter_18.8.pdf");
Moreover, we do not provide technical support on phone as forums are recommended channel for discussion over technical issues. However you can discuss sales/licensing related queries with Sales team through numbers shared on Contact page.
For Cloud related queries, please create posts over Cloud forums and our colleague from Aspose.Cloud team will take care of your concerns.
We are trying to HTML -> PDF conversion using htmls for header and footer. The header is coming fine if we pass whole html doc string in header, but the same is not coming for footer.
If we pass “
I am a Footer
” as page.Footer.Paragraphs.Add(new HtmlFragment(“
I am a Footer
”)), it’s coming fine, but if we pass whole html doc in footer, it’s not coming.
We are doing HTML -> PDF conversion. While doing the conversion, the width and height of the generated pdf is much more than A4 size. We have tried passing width and height using code below
var loadoptions = new HtmlLoadOptions();
loadoptions.PageInfo.IsLandscape = false;
loadoptions.PageInfo.Width = PageSize.A4.Height;
loadoptions.PageInfo.Height = PageSize.A4.Width;
loadoptions.PageInfo.Margin = new MarginInfo(15, 50, 15, 50);
But is is not working as expected. Can you help us out here.
Moreover can you let us know, what is the unit type (px, inch etc) for width, height and margin. There is no documentation for the same.
We have been able to notice the problem while adding footer with HtmlFragment. A ticket with ID PDFNET-45347 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.
Regarding page size problem, please create a separate post while sharing source and generated files so that we may try to reproduce and investigate it in our environment.
The ticket PDFNET-45347 has recently been logged in our issue management system and is pending for investigations owing to previously logged tickets in the queue. It will be investigated on its due turn which may take some months. We will update you as soon as this ticket will be resolved. We appreciate your patience and comprehension in this regard.
However, we also offer Paid Support, where issues are used to be investigated with higher priority. Our customers, who have paid support subscription, report their issue there which are meant to be investigated urgently. In case your reported issue is a blocker, you may please consider subscribing for Paid Support. For further information, please visit Paid Support FAQs.