संपादित करें मैं iTextSharp का उपयोग कर किसी मौजूदा पीडीएफ फ़ाइल में एक टेक्स्ट जोड़ना चाहता हूं, मुझे विभिन्न तरीकों से मिला लेकिन उनमें से सभी में लेखक और पाठक अलग पीडीएफ फाइलें हैं। मुझे एक तरीका चाहिए ताकि मैं एक पीडीएफ खोल सकूं और विभिन्न स्थितियों में अलग-अलग चीजें लिख सकूं। अभी मेरे पास यह कोड है, लेकिन यह एक नई फ़ाइल बनाता है।ITextSharp मौजूदा पीडीएफ
using (FileStream stream1 = File.Open(path, FileMode.OpenOrCreate))
{
BaseFont bf = BaseFont.CreateFont(fontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
PdfReader reader = new PdfReader("C:\\26178DATA\\pdf\\holding.pdf");
var pageSize = reader.GetPageSize(1);
PdfStamper stamper = new PdfStamper(reader, stream1);
iTextSharp.text.Font tmpFont = new iTextSharp.text.Font(bf, fontSize);
PdfContentByte canvas = stamper.GetOverContent(1);
Phrase ph = new Phrase(words[1], tmpFont);
ph.Font = tmpFont;
canvas.SetFontAndSize(bf, fontSize);
ColumnText.ShowTextAligned(canvas, Element.ALIGN_LEFT, ph, iTextSharp.text.Utilities.MillimetersToPoints(x * 10), pageSize.GetTop(iTextSharp.text.Utilities.MillimetersToPoints(y * 10)), 0);
stamper.Close();
}