PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Add header and footer to an existing pdf document https://forum.pdfsharp.net/viewtopic.php?f=2&t=3238 |
Page 1 of 1 |
Author: | welby [ Sat Dec 05, 2015 8:07 pm ] |
Post subject: | Add header and footer to an existing pdf document |
Hi, I would like to add or modify the header and the footer of an existing pdf document. I'm only able to add a header and a footer to a new pdf document using migradoc. Is it a way to add a header to an existing pdf document? Thanks Welby |
Author: | TH-Soft [ Sat Dec 05, 2015 10:55 pm ] |
Post subject: | Re: Add header and footer to an existing pdf document |
Hi, Welby, you can add header and footer using PDFsharp. You can use MigraDoc to create a document with just header and footer and then use PDFsharp to merge the new document with the old document. |
Author: | welby [ Sun Dec 06, 2015 9:39 am ] |
Post subject: | Re: Add header and footer to an existing pdf document |
Hi Thomas Do you have an example using pdfsharp? With pdfsharp I m only able to open an existing pdf but not add an header. Thanks Welby |
Author: | TH-Soft [ Sun Dec 06, 2015 4:40 pm ] |
Post subject: | Re: Add header and footer to an existing pdf document |
welby wrote: Do you have an example using pdfsharp? One example that draws text:http://pdfsharp.net/wiki/HelloWorld-sample.ashx One example that uses MigraDoc and PDFsharp: http://pdfsharp.net/wiki/MixMigraDocAnd ... ample.ashx There are more samples on the site. |
Author: | welby [ Sun Dec 06, 2015 6:44 pm ] |
Post subject: | Re: Add header and footer to an existing pdf document |
Hi Thomas, The following code adds a header and a footer to a new pdf document. I would like to do the same but for an existing pdf document. Is it possible or not? Can anyone help me on this? Thanks Code: Try
Dim myDoc As Document = New Document Dim mySect As Section = myDoc.AddSection() mySect.AddParagraph("test hello world") Dim paragrph As Paragraph = mySect.Headers.Primary.AddParagraph() paragrph.AddText("Label: labelA1" & vbCrLf & "Issue: Issue1") paragrph.Format.Alignment = ParagraphAlignment.Right Dim paragrphFooter As Paragraph = mySect.Footers.Primary.AddParagraph() paragrphFooter.AddText("Footer reference") paragrphFooter.Format.Alignment = ParagraphAlignment.Right Dim myRenderer As PdfDocumentRenderer = New PdfDocumentRenderer(True, PdfFontEmbedding.Always) myRenderer.Document = myDoc myRenderer.RenderDocument() Const filename As String = "c://Demo1.pdf" myRenderer.PdfDocument.Save(filename) Process.Start(filename) Catch ex As Exception Debug.Print(ex.Message) End Try |
Author: | Thomas Hoevel [ Mon Dec 07, 2015 8:56 am ] |
Post subject: | Re: Add header and footer to an existing pdf document |
welby wrote: Is it possible or not? It is possible with some effort on your side.First option: create a new PDF document with MigraDoc containing headers and footers and lay the new pages over the existing pages using PDFsharp. Second option: Follow the MixingMigraDocAndPDFsharp sample and draw header and footer directly onto the existing pages using "docRenderer.RenderPage(gfx, idx + 1); ". |
Author: | herowin [ Wed Jul 13, 2016 7:22 am ] |
Post subject: | Re: Add header and footer to an existing pdf document |
Hi Thomas, Please help me a option 1, i have a urgent task for this situation. I really important with me. Thanks Tuan Nguyen. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |