QQ图片20191211114329.png (58.3 KB)
代码如下:
// Instantiate Document object
Document doc = new Document();
// Add a page to pages collection of PDF file
Page page = doc.Pages.Add();
// Instantiate HtmlFragment with HTML contnets
HtmlFragment title = new HtmlFragment(“不要用js中的跳转功能,因为跳转之后,在app上点击返回,会又回到移动审批的页面,移动审批的页面层级比较深,有的页面回退会导致报错”);
//Font-family from ‘Verdana’ will be reset to ‘Arial’
title.TextState = new TextState(“Arial”);
title.TextState.FontSize = 20;
// Set bottom margin information
title.Margin.Bottom = 10;
// Set top margin information
title.Margin.Top = 400;
// Add HTML Fragment to paragraphs collection of page
page.Paragraphs.Add(title);
// Save PDF file
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
// Specify Default Font Name
pdfSaveOptions.DefaultFontName = “Arial”;
doc.Save("faf1.pdf", pdfSaveOptions);