예제 #1
0
 /// <summary>
 /// Generate to memory
 /// </summary>
 /// <param name="outputFileName"></param>
 public static byte[] Generate(ref int dataSize)
 {
     try
     {
         IntPtr bufferResult = PdfFactoryInterface.GenerateToMemory(ref dataSize);
         if (bufferResult == IntPtr.Zero)
         {
             throw new GeneratorFailureException();
         }
         else
         {
             byte[] byteResult = new byte[dataSize];
             Marshal.Copy(bufferResult, byteResult, 0, dataSize);
             return(byteResult);
         }
     }
     catch (PdfFactoryEngineException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw new PdfFactoryEngineException(Strings.FailedGeneratingPdf, ex);
     }
 }
예제 #2
0
 /// <summary>
 /// This will shutdown generator
 /// </summary>
 public static void ShutdownGenerator()
 {
     try
     {
         PdfFactoryInterface.ShutdownGenerator();
     }
     catch (Exception ex)
     {
         throw new PdfFactoryEngineException(Strings.FailedGeneratorShutdown, ex);
     }
 }
예제 #3
0
 /// <summary>
 /// This will initialize generator
 /// </summary>
 public static void InitializeGenerator(string companyName, string serialNumber)
 {
     try
     {
         PdfFactoryInterface.InitializeGenerator(companyName, serialNumber);
     }
     catch (Exception ex)
     {
         throw new PdfFactoryEngineException(Strings.FailedGeneratorInitializing, ex);
     }
 }
예제 #4
0
 /// <summary>
 /// Attach template from File
 /// </summary>
 /// <param name="templateName"></param>
 public static void AttachTemplate(string templateName)
 {
     try
     {
         if (PdfFactoryInterface.AttachTemplateFromFile(templateName) == 0)
         {
             throw new TemplateUsageException(Strings.FailedAttachingTemplateFromFile);
         }
     }
     catch (TemplateUsageException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw new TemplateUsageException(Strings.FailedAttachingTemplateFromFile, ex);
     }
 }
예제 #5
0
 /// <summary>
 /// Generate to File
 /// </summary>
 /// <param name="outputFileName"></param>
 public static void Generate(string outputFileName)
 {
     try
     {
         if (PdfFactoryInterface.GenerateToFile(outputFileName) == 0)
         {
             throw new GeneratorFailureException();
         }
     }
     catch (PdfFactoryEngineException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw new PdfFactoryEngineException(Strings.FailedGeneratingPdf, ex);
     }
 }
예제 #6
0
        /// <summary>
        /// Attach template from memory
        /// </summary>
        /// <param name="templateName"></param>
        public static void AttachTemplate(Stream templateStream)
        {
            try
            {
                byte[] templateData = new byte[templateStream.Length];
                int    templateSize = 0;
                templateStream.Read(templateData, 0, (int)templateStream.Length);

                if (PdfFactoryInterface.AttachTemplateFromMemory(templateData, templateSize) == 0)
                {
                    throw new TemplateUsageException(Strings.FailedAttachingTemplateFromMemory);
                }
            }
            catch (TemplateUsageException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new TemplateUsageException(Strings.FailedAttachingTemplateFromMemory, ex);
            }
        }
예제 #7
0
 /// <summary>
 /// Set Initialize DataStream callback
 /// </summary>
 /// <param name="initializeDataStreamCallback"></param>
 public static void SetInitializeDataStreamCallback(PdfFactoryInterface.InitializeDataStreamCallback initializeDataStreamCallback)
 {
     PdfFactoryInterface.SetInitializeDataStreamCallback(initializeDataStreamCallback);
 }
예제 #8
0
 /// <summary>
 /// Set readDataCallback
 /// </summary>
 /// <param name="readDataCallback"></param>
 public static void SetReadDataCallback(PdfFactoryInterface.ReadDataCallback readDataCallback)
 {
     PdfFactoryInterface.SetReadDataCallback(readDataCallback);
 }
예제 #9
0
 /// <summary>
 /// Sets reset data callback
 /// </summary>
 /// <param name="resetDataStreamCallback"></param>
 public static void SetResetDataStreamCallback(PdfFactoryInterface.ResetDataStreamCallback resetDataStreamCallback)
 {
     PdfFactoryInterface.SetResetDataStreamCallback(resetDataStreamCallback);
 }
예제 #10
0
 /// <summary>
 /// Set Logging level
 /// </summary>
 /// <param name="enable"></param>
 /// <param name="logLevel"></param>
 public static void SetLogging(bool enable, LoggingLevel logLevel)
 {
     PdfFactoryInterface.SetLogging(enable ? (short)1:(short)0, (short)logLevel);
 }
예제 #11
0
 /// <summary>
 /// Sets reset data callback
 /// </summary>
 /// <param name="resetDataStreamCallback"></param>
 public static void SetResetDataStreamCallback(PdfFactoryInterface.ResetDataStreamCallback resetDataStreamCallback)
 {
     PdfFactoryInterface.SetResetDataStreamCallback(resetDataStreamCallback);
 }
예제 #12
0
 /// <summary>
 /// Set request data callback
 /// </summary>
 /// <param name="requestDataCallback"></param>
 public static void SetRequestDataCallback(PdfFactoryInterface.RequestDataCallback requestDataCallback)
 {
     PdfFactoryInterface.SetRequestDataCallback(requestDataCallback);
 }
예제 #13
0
 /// <summary>
 /// Set Initialize DataStream callback
 /// </summary>
 /// <param name="initializeDataStreamCallback"></param>
 public static void SetInitializeDataStreamCallback(PdfFactoryInterface.InitializeDataStreamCallback initializeDataStreamCallback)
 {
     PdfFactoryInterface.SetInitializeDataStreamCallback(initializeDataStreamCallback);
 }