How to place an image and a paragraph on PDF document header?

蹲街弑〆低调 提交于 2020-01-06 03:31:25

问题


I'm trying to place an image and a text below this image on document header using MigraDoc.

Unfortunately I'm unable to do so. It seems to only be accepting image or paragraph but not both.

This is what I've tried:

var image = section.Headers.Primary.AddImage("image.jpg");
var text = section.Headers.Primary.AddParagraph("title");

It may be possible that paragraph is placed under image, making it invisible. It doesn't seem to be the case though.


回答1:


You can add images to paragraphs - you add the image to the header without a paragraph.

I'd try putting image and text into the same paragraph with a linebreak between them.

Untested code:

var para = section.Headers.Primary.AddParagraph();
var image = para.AddImage("image.jpg");
para.AddLineBreak();
para.AddText("title");


来源:https://stackoverflow.com/questions/32974285/how-to-place-an-image-and-a-paragraph-on-pdf-document-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!