https 图片不支持ABCpdf,当我们生成 pdf 时,我们会得到十字符号。
请帮帮我。
谢谢
答案 0 :(得分:0)
//Get the HTML. In this example I'm reading the html from a text file (for demonstration purposes)
string HTML_STRING;
var streamReader = new StreamReader(@"c:\html.txt");
HTML_STRING = streamReader.ReadToEnd();
streamReader.Close();
//****************************************
// Create PDF
//****************************************
//Initiate the document
var theDoc = new Doc();
theDoc.TextStyle.Size = 20;
theDoc.Rect.Inset(40, 55);
theDoc.Color.String = "255 255 255"; //Clear rectangle
//Add the html
int theId = theDoc.AddImageHtml(HTML_STRING);
//We now chain subsequent pages together. We stop when we reach a page which wasn't truncated
while (true)
{
theDoc.FrameRect();
if (!theDoc.Chainable(theId))
break;
theDoc.Page = theDoc.AddPage();
theId = theDoc.AddImageToChain(theId);
}
////////////////////////////////////////////////////
// Set pagenumber
////////////////////////////////////////////////////
theDoc.HtmlOptions.LinkPages();
//Set the position for the page number
theDoc.Rect.String = "35 30 580 50";
theDoc.Font = theDoc.AddFont("Trebuchet");
theDoc.FontSize = 11;
int pagenumber = 1;
//flatten the pages. We can't do this until after the pages have been added because flattening will invalidate our previous ID and break the chain.
for (int i = 1; i <= theDoc.PageCount; i++)
{
theDoc.PageNumber = i;
//Add page number
//========================================
string txt = pagenumber.ToString();
theDoc.Color.String = "169 169 169"; //Dark grey text
//Positioning depends on if the page is even or odd
theDoc.VPos = 1.0;
if ((i%2) == 0)
{
//Even
theDoc.HPos = 0.01;
}
else
{
//Odd
theDoc.HPos = 0.99;
}
//Add the page number
theDoc.AddText(txt);
//Add a line above page number
theDoc.AddLine(21, 55, 590, 55);
//Flatten page
theDoc.Flatten();
//Increase the page number count
pagenumber++;
}
//==============================
////////////////////////////////////////////////////
// Save the pdf file
////////////////////////////////////////////////////
// Save the document
theDoc.Save(@"c:\pdf.pdf");
//Clear
theDoc.Clear();