Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It seems that you are missing the calls eb.CreateTextBegin() and eb.CreateTextEnd(). You should try something like this:</p> <pre><code> PDFNet.Initialize(); // Relative path to the folder containing test files. string input_path = "../../../../TestFiles/"; string output_path = "../../../../TestFiles/Output/"; PDFDoc doc = new PDFDoc(input_path + "form1.pdf"); ElementWriter writer = new ElementWriter(); ElementBuilder eb = new ElementBuilder(); for (int index = 1; index &lt;= doc.GetPageCount(); index++) { Page page = doc.GetPage(index); writer.Begin(page); eb.Reset(); // Begin writing a block of text string data = "Page " + index; Element element = eb.CreateTextBegin(Font.Create(doc, Font.StandardType1Font.e_times_roman, true), 10.0); writer.WriteElement(element); eb.CreateTextRun(data); element.SetTextMatrix(10, 0, 0, 10, 100, 100); GState gstate = element.GetGState(); gstate.SetTextRenderMode(GState.TextRenderingMode.e_fill_text); gstate.SetStrokeColorSpace(pdftron.PDF.ColorSpace.CreateDeviceRGB()); gstate.SetStrokeColor(new pdftron.PDF.ColorPt(1, 0, 0)); writer.WriteElement(element); writer.WriteElement(eb.CreateTextEnd()); writer.End(); } writer.Dispose(); eb.Dispose(); doc.Save(output_path + "element_builder.pdf", SDFDoc.SaveOptions.e_linearized); doc.Close(); </code></pre> <p>Btw. a possibly simpler way to add text to an existing page may be to use 'pdftron.PDF.Stamper' as shown in <a href="http://www.pdftron.com/pdfnet/samplecode.html#Stamper" rel="nofollow">Stamper sample</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload