ABC.PDF を使用して、既存のシステムから PDF を生成しています。フォーム認証メカニズムがあります。PDFを生成すると、常にログインページが生成されます。これが私の機能です。助けてください、よろしくお願いします。
プライベート ドキュメント GeneratePDFPage() {
var theDoc = new Doc();
theDoc.HtmlOptions.Engine = EngineType.MSHtml;
theDoc.HtmlOptions.AddLinks = true;
var uri = Context.Request.Url.ToString();
theDoc.HtmlOptions.LogonName = Context.User.Identity.Name;
theDoc.HtmlOptions.LogonPassword = "7126c198-5aee-47b2-8e6a-09c558892703";
var html = Response.Filter;
int theId = theDoc.AddImageUrl(uri);
//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;
////theDoc.HtmlOptions.UseScript = true;
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(CultureInfo.InvariantCulture);
////theDoc.Color.String = "169 169 169"; //Dark grey text
//Positioning depends on if the page is even or odd
theDoc.VPos = 1.0;
theDoc.HPos = (i % 2) == 0 ? 0.01 : 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++;
}
return theDoc;
}