Mixed up coordinate systems

I am placing text and graphics (rectangles) at specific locations on the page (using Aspose.PDF). I can find NO definitive explanations of the coordinate systems involved, but have deduced the following…


All coordinates use a base unit of 1/72 inch, usually expressed as a double, but often as a float

Text is aligned by baseline, in a BOTTOM LEFT coordinate system (bottom left of the page is 0,0)

Graph objects are positioned in a TOP LEFT coordinate system (top left of the page is 0,0)

Using 0,0 for graph objects is “special”, it seems to produce a position relative to the previous graph object, or the object may not show up at all if it is the first on the page.

Drawing objects within a graph are positioned BOTTOM LEFT graph relative (not page relative)

Can anyone confirm or deny all this, and explain what is going on with (0,0) graph objects?

What about other objects, floating boxes, etc. am I missing some documentation? I am tiired of trying to understand Aspose.PDF by trial and error.


Hi Albert,


Thanks for contacting support.

I have tested the scenario using following code snippet and as per my observations, the TextFragment and Graph objects are properly render on locations specified in code. Can you please share the code snippet which you are using, so that we can test the scenario in our environment. We are sorry for this inconvenience.

[C#]

Document doc = new
Document();<o:p></o:p>

doc.Pages.Add();

TextFragment fragment = new TextFragment("sample text...");

// In order to set position, specify the margin infomation

fragment.Margin.Left = 50;

// position property has not impact on normal objects inside PDF

// fragment.BaselinePosition= new Position(50, 0);

doc.Pages[1].Paragraphs.Add(fragment);

// Create Graph instance

Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(20,10);

// create rectangle object

Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(0,20, 10,10);

graph.Shapes.Add(rect);

doc.Pages[1].Paragraphs.Add(graph);

doc.Save(“c:/pdftest/FragmentSave.pdf”);