Posted 9 June 2020, 1:25 am EST
We discovered that it has to do with an extension method we added to be able to copy a section of a document into another document.
Each time we use the fonction to copy a zone, the entire source page size is added to the destination document instead of only the copied zone. Do you see something wrong with the code ?
public static void CopyZoneTo(
this GcPdfDocument sourceDoc,
GcPdfDocument destinationDoc,
int destinationDocPageIndex,
float sourceX,
float sourceY,
float sourceWidth,
float sourceHeight,
int sourceDocPageIndex,
float destinationXOffset = 0,
float destinationYOffset = 0,
float pageHeight = 792)
{
if (sourceDoc == null) throw new ArgumentNullException(nameof(sourceDoc));
if (destinationDoc == null) throw new ArgumentNullException(nameof(destinationDoc));
var sourceObject = new FormXObject(destinationDoc, sourceDoc.Pages[sourceDocPageIndex])
{
Bounds = new RectangleF(sourceX, pageHeight - (sourceHeight + sourceY), sourceWidth, sourceHeight)
};
destinationDoc.Pages[destinationDocPageIndex].Graphics.DrawForm(
sourceObject,
new RectangleF(destinationXOffset, pageHeight - sourceObject.Bounds.Height + destinationYOffset, sourceObject.Bounds.Width, sourceObject.Bounds.Height),
null,
ImageAlign.ScaleImage);
}