Delivering generated pdfs through ASP.Net



  • Avatar
    Tim Sullivan

    Hi Mark,

    Hi Mark,


    I have a couple of recommendations right off the bat :

    1) After setting TK.InputByteArray, you can set PdfBytes = null so the GC can deal with it.  The internal TK .NET interface code does marshal the byte array, but only temporarily as it makes a copy into Toolkit's internal memory manager. 

    2) Calling .Dispose directly after your done with the file instead of waiting for the GC will also free up internal TK memory structures.

    Insofar as your follow up comment : What TK is "seeing" is not a named pipe but rather a pointer to a mount point called \\.\pipe .

    I have a couple of other recommendations/questions :

    1) Are you loading the input file via a byte array because it's coming from a centralized source? (eg SQL Server) If so, have you considered implementing a cache system for the input file?  It might actually perform faster in the long run.

    2) You mentioned that you are dealing with PDF's form templates originating in Asia.   When dealing  with templates like these, the biggest issue are CJK fonts.  If you are not using one of the Adobe Acrobat built in fonts, the entire font is typically placed into the PDF because the actual characters used cannot be anticipated...the result is a 20MB PDF where 16MB of it is just the font!  A couple of things you can do in this situation : 1) Use the built in Adobe Acrobat built in CJK fonts.  Toolkit completely supports those as well as all the encodings for those fonts.  2) Host the font on your server but don't embed in the template PDF.  Toolkit will pick it up and use external font.

    3) Do the users actually interact with these PDF forms once they are filled out?  If not, have you considered flattening them AND making sure subset fonts is turned on?  Toolkit will squeeze that 20MB file way down.

    I hope some of these suggestions help.  I can't always say when I'll be poking around, so for further assistance I recommend opening a ticket in Support.

    Thank you,


    Tim Sullivan

    Comment actions Permalink
  • Avatar
    Mark Modrall

    So I got around to testing this.  I wrote some named pipe client code and tried to TK.OpenOutputFile(@"\\.\pipe\pdfPipe") but got a -1 back from the toolkit, so it was a no-go.

    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk