@johnmann04
You can use ShapeBase.IsLayoutInCell property to set a flag indicating whether the shape is displayed inside a table or outside of it.
In ResizeAndPositionBarcode method, you can use following code to set this property.
bool isInCell = shape.GetAncestor(NodeType.Cell) != null;
if (isInCell)
{
shape.IsLayoutInCell = false;
}
Moreover, you need to save the document with following compatibility options.
doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2010);
doc.Save(@"c:\temp\20.2.docx");
If you do not want to optimize document for MsWordVersion.Word2010, you can use layout API to get the position of bookmark/shape inside the table’s cell and set the position of shape using Shape.Left and Shape.Top properties.
I think, you want to save the final document to PDF. So, please use the first approach to get the desired output.