We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Essential PDF - Is it possible to insert HTML into the header of a PDFDocument?

Thread ID:

Created:

Updated:

Platform:

Replies:

119065 May 7,2015 05:49 PM UTC May 12,2015 12:19 PM UTC ASP.NET MVC (Classic) 5
loading
Tags: PDF
potato
Asked On May 7, 2015 05:49 PM UTC

I followed this sample: http://help.syncfusion.com/ug/js/index.html#!Documents/creatingagrid.htm
and want to add an HTML header. Can this be done?

Thanks for looking.

Abirami Selvan [Syncfusion]
Replied On May 8, 2015 10:36 AM UTC

Hi Potato ,

Thank you for using Syncfusion product.
Currently , We don’t have support for adding the html tag into PdfGrid header. So we have created the sample to draw the html tag in header using PdfLightTable and also to add the html tag into pdf document header.
Please refer sample in the below link :
http://www.syncfusion.com/downloads/support/forum/119065/MvcApplication11939157227.zip
Please let us know if you need any further assistance.

Thanks,
Abirami.

potato
Replied On May 8, 2015 06:24 PM UTC

This is what I'm looking for. Thanks!

Abirami Selvan [Syncfusion]
Replied On May 11, 2015 04:52 AM UTC

Hi Potato ,

Thank you for your update.
Please let us know if you need any further assistance.

Regards,
Abirami.

potato
Replied On May 11, 2015 05:59 PM UTC

The help was pretty much spot on. The only issue I ran into is that the first page of my document grid overlapped my header. All the other pages were fine.

The solution for me was to move PdfPage page = document.Pages.Add(); so that it comes after setting document.Template.Top = header;.
This meant that I couldn't use page.Graphics.ClientSize.Width. So I changed PdfPageTemplateElement header = new PdfPageTemplateElement(new RectangleF(0, 0, page.Graphics.ClientSize.Width, 100)); to PdfPageTemplateElement header = new PdfPageTemplateElement(new RectangleF(0, 0, document.PageSettings.Width, 100));

If this isn't sound logic or if there is an easier way let me know :P. But hopefully this helps anyone else who has the same issue.

Abirami Selvan [Syncfusion]
Replied On May 12, 2015 12:19 PM UTC

Hi Potato,

We have to draw the grid table according to the header height. We can achieve to draw the grid in bottom of header using paginatebounds in layoutformat.

Please refer the below code snippet :

PdfLayoutFormat format=new PdfLayoutFormat();

format.Layout=PdfLayoutType.Paginate;

format.PaginateBounds = new RectangleF(0, 110, document.PageSettings.Width, document.PageSettings.Height);



//Draw the table

table.Draw(page, new RectangleF(0, 110, document.PageSettings.Width, document.PageSettings.Height), format);


AddHeader(document);


// Save and close the document.
document.Save("Sample.pdf",HttpContext.ApplicationInstance.Response,HttpReadType.Save);

Also we have attached the sample for your reference in below link :
http://www.syncfusion.com/downloads/support/forum/119065/MvcApplication1-2100998301.zip

Please try this and let us know the result, if you still faces any issue please modify the attached sample to reproduce the issue and provide us. So that we can analyze in this to provide you the better solution.

Regards,
Abirami.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;