I have a large (6 pages, 222 fields) fillable PDF that I am using as a template with iTextSharp PdfReader. When this object instantiates it takes 5 minutes or more. I have tried:
string pdfPath = Path.Combine(context.Server.MapPath("~/apps/ssgenpdf/App_Data"), "07-2011 Worksheets.pdf");
reader = new PdfReader(pdfPath);
alternatively I have tried reading the file into a memory stream and passing the memory stream to the PdfReader constructor. Additionally I have tried using:
reader = new PdfReader(new RandomAccessFileOrArray(pdfPath), null);
none of these alternatives show significant gains.
This is an ASP.Net app, and so my interim solution is to do this creation on application start and caching the reader, then I check to see if I get a valid reader from the cache and instantiate a new reader from that reader. Now I routinely see under 50 millisecond response from this approach.
My concern is that this does not seem scalable if others in my group want to use this "fillable PDF a开发者_如何学Pythons template with iTextSharp" strategy. Does anyone have any suggestions for alternate strategies to balance performance with scalability?
Make sure the PDF you are using are same on the server as well as locally.sometime from source control they get corrupted.[I have face the issue with VSS with fillable pdf forms which i have created via nitro.] Also better to ask the question and relevant forum http://forum.pdfsharp.net
精彩评论