Free Support Forum - aspose.com

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

Hi,

This request is related to the following requirements

http://www.aspose.com/community/forums/permalink/432395/432395/showthread.aspx#432395

http://www.aspose.com/community/forums/thread/431275.aspx

Basically i am trying to add 8 vertical lines in each pages. These series of 8 vertical lines are uniquely drawn as shapes.

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 :

private void Process()
{
Document d = _Execute(currentActiveCust.ActiveReportJob, custNo);
d.Save(tmpDoc, SaveFormat.Doc);

MemoryStream dstStream = new MemoryStream();
d.Save(dstStream, SaveFormat.Pdf);


Aspose.Pdf.Document pdfDocWithoutOMR = new Aspose.Pdf.Document(dstStream);


Aspose.Pdf.Document pdfDocWithOMR = DrawOMROnPDF(pdfDocWithoutOMR);
}


private Aspose.Pdf.Document DrawOMROnPDF(Aspose.Pdf.Document doc)
{
foreach (Aspose.Pdf.Page page in doc.Pages)
{
Aspose.Pdf.Generator.Pdf pdfGen = new Aspose.Pdf.Generator.Pdf(


Aspose.Pdf.Generator.Section omrSection = pdfGen.Sections.Add();

Aspose.Pdf.Generator.Graph box = new Aspose.Pdf.Generator.Graph(omrSection, 100, 400);

}


return doc;
}

Regards,

hadi teo

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 :

http://www.aspose.com/community/forums/permalink/432997/432997/showthread.aspx#432997

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.