# Positioning of Text in a Graphics3D

I have an interesting problem to solve. I want to have Text in a Graphics3D. This can easily be done in the following way:

lineandnumber = Graphics3D[{{Black, , AbsoluteThickness[2], Line[{{-0.5, -0.5, -0.5}, {0.5, 0.5, 0.5}}]},
{Black, Text[Style["1", Black, FontSize -> 18, FontFamily -> "Arial"], {0.5, 0.5, 0.7}, {0, 0}]},
{Black, Text[Style["2", Black, FontSize -> 18, FontFamily -> "Arial"], {-0.5, -0.5, -0.7}, {0, 0}]}},
Boxed -> False, ViewProjection -> "Orthographic", Boxed -> False, ViewVertical -> {0, 0, 1},
ViewPoint -> {-6, -18, 5}, , ViewCenter -> {6, 17, -4.1}, ViewAngle -> 2.5, PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}},
ImageSize -> {200, 200}]


Here we create a line with the numbers 1 and 2 at the ends, which looks like this:

The problem is that during the Export to a pdf the text gets rasterized. This is a very famous known problem since Mathematica 10 that it is basically impossible to get an unrasterized vector graphic from Graphics3D. The known workarounds like using Inset or GraphicRow in Graphics do also not work anymore (at least in Mathematica 12.1 and 13.1, which I am using).

Therefore I want to built a workaround by Rasterizing the Graphics3D without the Text, put this Rasterimage as an Inset into Graphics and add the numbers there. This looks like this:

lineandnumber2 = Graphics[{{Inset[line],
Black, Text[Style["1", Black, FontSize -> 18, FontFamily -> "Arial"], {0.5, 0.7}, {0, 0}]},
{Black, Text[Style["2", Black, FontSize -> 18, FontFamily -> "Arial"], {-0.5, -0.7}, {0,0}]}},
PlotRange -> {{-1, 1}, {-1, 1}}, ImageSize -> {200, 200}]


The Inset ist just the rasterized line from above without Text. This results in:

In the pdf export the numbers are now indeed Vectorgraphics. But of cause their positioning is completely wrong. This is because their correct positioning has to be calculated as a 2D projection from the 3D plot information. Because it is an "Orthographic" ViewProjection, the only thing which we have to think about is the shortest distance of the Textpositions in 3D from the infinite Line going from ViewPoints to ViewCenter, which we have to transform into (x,y) coordinates.

The only thing in the way is that I dont know how large the actual viewframe is? The ViewAnge is useful in a normal ViewProjection, but really has no meaning in an "Orthographic" projection? It basically just opens and closes the viewframe without any information on how large it actually is?

A different approach would be to take the Rasterized Plot3D with the Rasterized Text and somehow with Textrecognition automatically figure out at which position in the Raster which Text is and translate this into Graphics.