Drawing a unique series of omr lines (vertical line shapes) inside the pdf document

Hi,

This request is related to the following requirements

https://forum.aspose.com/t/48620

<A href="</A></P> <P>Basically i am trying to add 8 vertical lines in each pages. These series of 8 vertical lines are uniquely drawn as shapes.</P> <P>I checked the documentation and there is a clue of using Pdf.Generator Graph class. But how do i instantiate from Aspose.Pdf.Document ? I am having difficulties on DrawOMROnPDF method as defined below :</P> <P> </P> <P> </P> <P> private void Process()<BR> {<BR> Document d = _Execute(currentActiveCust.ActiveReportJob, custNo);<BR> d.Save(tmpDoc, SaveFormat.Doc);</P> <P> MemoryStream dstStream = new MemoryStream();<BR> d.Save(dstStream, SaveFormat.Pdf);</P> <P><BR> Aspose.Pdf.Document pdfDocWithoutOMR = new Aspose.Pdf.Document(dstStream);</P> <P><BR> Aspose.Pdf.Document pdfDocWithOMR = DrawOMROnPDF(pdfDocWithoutOMR);<BR> }<BR> </P> <P><BR> private Aspose.Pdf.Document DrawOMROnPDF(Aspose.Pdf.Document doc)<BR> {<BR> foreach (Aspose.Pdf.Page page in doc.Pages)<BR> { <BR> Aspose.Pdf.Generator.Pdf pdfGen = new Aspose.Pdf.Generator.Pdf(</P> <P><BR> Aspose.Pdf.Generator.Section omrSection = pdfGen.Sections.Add();</P> <P> Aspose.Pdf.Generator.Graph box = new Aspose.Pdf.Generator.Graph(omrSection, 100, 400);<BR> <BR> }</P> <P><BR> return doc;<BR> }<BR></P> <P> </P> <P>Regards,</P> <P> </P> <P>hadi teo</P>

Hi,

Please close this thread. I have managed to use the Aspose.Pdf.TextStamp object to achive my objectives.

Regards,

hadi teo

Hi Hadi,

Thanks for contacting support.

I am glad to hear that your problem is resolved. However I have gone through the code snippet that you have shared and have observed that the problem was occurring because in method DrawOMROnPDF(…) you wanted to load PDF file in Aspose.Pdf.Generator.Pdf object. Please note that Aspose.Pdf.Generator namespace only supports the feature to create PDF document from scratch.

Besides this, you may also accomplish your requirement using [CreateLine] method of PdfContentEditor class present under Aspose.Pdf.Facades namespace.

[C#]

PdfContentEditor editor = new
PdfContentEditor();<o:p></o:p>

editor.BindPdf("example.pdf");

editor.CreateLine(new System.Drawing.Rectangle(0, 0, 100, 100), "Welcome to Aspose", 0, 0, 100, 100,

1, 1, System.Drawing.Color.Red, "D", new int[] { 2, 3 }, new string[] { "OpenArrow", "ClosedArrow" });

editor.Save("example_out.pdf");

In case of any further query, please feel free to contact.

Hi Nayyer,

Thanks very much for your assistance. At the end, i choose the AddStamp() method which achieves my objectives properly.

The details of the code snippet can be found in the following thread :

https://forum.aspose.com/t/89569

Regards,

hadi teo

Hi Hadi,


I am pleased to share that you have been able to accomplish your requirement using AddStamp(…). In the event of any further query, please feel free to contact.