Hello, I'm trying to get my text frame to a specific spot on the pdf but I can't seem to get ir there...
The textFrame has a QRCode Image, and with the code I've written it only appears of the top|right on the Pdf, not at all where I want it to!
I attached a File to show what I want to achieve.
and the code I use is here:
Code:
public static void UpdateQRSource(Document doc, string address, float x, float y, float width, float height, float prtsize)
{
ZXing.QrCode.QrCodeEncodingOptions options = new ZXing.QrCode.QrCodeEncodingOptions
{
DisableECI = true,
CharacterSet = "UTF-8",
Width = Convert.ToInt32(width),
Height = Convert.ToInt32(height),
};
var qr = new ZXing.BarcodeWriter();
qr.Format = ZXing.BarcodeFormat.QR_CODE;
qr.Options = options;
Bitmap result = new Bitmap(qr.Write(address));
byte[] image = null;
using (var ms = new MemoryStream())
{
result.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
image = ms.ToArray();
}
//img.Save(rndFile, ImageFormat.Png);
var pdfFrame = doc.LastSection.AddTextFrame();
pdfFrame.Width = width;
pdfFrame.Height = height;
//pdfFrame.Left = MigraDoc.DocumentObjectModel.Shapes.ShapePosition.Right;
//pdfFrame.Top = MigraDoc.DocumentObjectModel.Shapes.ShapePosition.Bottom;
pdfFrame.RelativeVertical = MigraRelativeVertical.Page;
pdfFrame.RelativeHorizontal = MigraRelativeHorizontal.Margin;
pdfFrame.MarginLeft = x;
pdfFrame.MarginBottom = y;
var QRImage = pdfFrame.AddImage("base64:" + Convert.ToBase64String(image));
}
How can I change the code to achieve what I want?