GemBox C# - 将二维码放置在右上角
我正在 .net 项目中使用 GemBox 创建 PDF 文件,我想知道如何将二维码放置在右上角。
使用下面的代码,我替换了 Word 文件中的变量,并添加了二维码部分,二维码是在单独的页面而不是同一页面上创建的。
所以我的问题是,如何将二维码放在同一页面以及如何将其放置在右上角。
我希望有人能帮忙:)
var qrCodeValue = JsonConvert.SerializeObject(new
{
FirstName = data.firstName,
LastName = data.lastName,
CreationDate = data.documentCreationDate
});
var qrCodeField = new Field(document, FieldType.DisplayBarcode, $"{qrCodeValue} QR");
document.Sections.Add(new Section(document, new Paragraph(document, qrCodeField)));
document.Content.Replace("%FirstName%", data.firstName);
document.Content.Replace("%LastName%", data.lastName);
I am creating a PDF-file with GemBox in my .net project and I am wondering how to position the qr code in the top right corner.
With the code below, I am replacing variables in my word file and with the addition of the qr code section, the qr code is created on a separate page instead on the same page.
So my question is, how to place the qr code on the same page and how to position it in the top right corner.
I hope someone can help :)
var qrCodeValue = JsonConvert.SerializeObject(new
{
FirstName = data.firstName,
LastName = data.lastName,
CreationDate = data.documentCreationDate
});
var qrCodeField = new Field(document, FieldType.DisplayBarcode, quot;{qrCodeValue} QR");
document.Sections.Add(new Section(document, new Paragraph(document, qrCodeField)));
document.Content.Replace("%FirstName%", data.firstName);
document.Content.Replace("%LastName%", data.lastName);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将 QR 码添加到现有部分。
此外,要将其放置在右上角,您可以在开头或文档标题中插入右对齐的
Paragraph
,或者插入浮动的TextBox
。以下是所有三种建议方法的示例。
插入到现有部分的正文中
插入到现有部分的标题中
插入浮动文本框
You need to add the QR code to an existing section.
Also, to position it in the top right corner you could insert the right aligned
Paragraph
at the beginning or in the document's header or insert a floatingTextBox
.Here are the examples for all three suggested approaches.
Insert into the body of an existing section
Insert into the header of an existing section
Insert with a floating textbox