0
나는 기존 시스템에서 pdf를 생성하기 위해 ABC.PDF를 사용하고 있습니다. 양식 인증 메커니즘이 있습니다. 내가 pdf를 생성 할 때 항상 로그인 페이지를 생성합니다. 내 기능은 다음과 같습니다. 도와주세요, 고맙습니다.양식 인증 시스템에서 ABCpdf.net을 사용하여 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;
}
답장을 보내 주셔서 감사합니다.하지만 양식 인증이 필요합니다. 인증 메커니즘을 사용하여 PDF를 생성하는 방법이 없습니다 – Denuka
폼 인증을 사용하지 않고 ASP.NET 양식 인증 환경에서 URL 콘텐츠를 pdf로 변환하는 정확한 해결책을 찾기가 어렵습니다. 몇 일 동안 사용해 보았지만 쓸모가 없었습니다. 나는 사람들에게 조언했습니다. 이 제품을 구입할 예정입니다. 폼 인증으로 시도해보십시오. 그들이 제안하는 메커니즘 또한 안전하지 않습니다. 자세한 내용은 다음을 참조하십시오. [http://codeasp.net/blogs/vivek_iit/microsoft-net/2190/hiqpdf-one-of-the-best-pdf-libraries-in-net] – Denuka