0

i'm trying to manipulate pdf and i tried some of opensource libraries (e.g pdfSharp, pdfjet) and i cannot achive what i must do. Because pdfsharp add it with a new page to pdf, or pdfjet put an advert into pdf. So, i cannot use those libraries.

What i must achive is:

i must put a string at the end of the last page of pdf. If last page have enough space to put the string, then there is no need to add a new page, otherwise, string can be splitted or add a new page to pdf.

Here is a code sample i tried;

HtmlToPdf renderer = new IronPdf.HtmlToPdf();
IronPdf.PdfDocument doc = IronPdf.PdfDocument.FromFile(existingPdfPath);
doc.AppendPdf(renderer.RenderHtmlAsPdf(stringAddToPdf));
doc.SaveAs(newPdfPath);

Thanks for helps,

Vecihi Baltacı
  • 352
  • 4
  • 20

1 Answers1

0

From what I can understand, AppendPdf is actually designed to always insert a new page..

https://ironpdf.com/c%23-pdf-documentation/html/M_IronPdf_PdfDocument_AppendPdf.htm

My suggestion would be to add the string as a footer as this should be possible either with AddHeaders/AddFooters/AddHTMLHeaders/AddHTMLFooters

https://ironpdf.com/c%23-pdf-documentation/html/Methods_T_IronPdf_PdfDocument.htm

Matthew
  • 76
  • 7
  • First of all, thanks for answer. Your answer is true, the appendPdf adds new page to the end of the file. But addHeaders or footers does not meet our requirements even if i use the htmlFooter or header. I mailed to support of ironPdf, but they're not answering my questions. Thanks again. – Vecihi Baltacı Mar 04 '20 at 14:16