We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF Creation & Absolute Placement

This library seems very robust, but frankly the documentation for creating new PDF is lacking. In fact the documentation in general leaves a lot to be desired. I say this because I think the product has a lot of potential and I’d really love to see that part shored up.


I have a situation where I need to create to create a PDF from scratch. I need to draw native shapes and place them via X,Y coordinates MYSELF. I need to be able to do transparent fills and place text on an X,Y axis as well. I’m close with:

Document d = new Document();


d.Pages.Add();

d.Pages[1].SetPageSize(8.5 * 72, 11 * 72);


OperatorCollection c = d.Pages[1].Contents;


c.Add(new Operator.GSave());

c.Add(new Operator.MoveTo(25, 25));

c.Add(new Operator.LineTo(500, 500));

c.Add(new Operator.SetRGBColorStroke(.5, 0, 0));

c.Add(new Operator.Stroke());

c.Add(new Operator.GRestore());


d.Save("C:/temp/out/a.pdf");


So I can place a line and stroke it. I'm also able to draw boxes and fill them, but how can I draw a semi-transparent box with this method and place text at any X,Y position?

I also tried the Generator.* series of classes but it seems as if it doesn't allow for absolute X,Y placement.