Ejemplo n.º 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);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// This will shutdown generator
 /// </summary>
 public static void ShutdownGenerator()
 {
     try
     {
         PdfFactoryInterface.ShutdownGenerator();
     }
     catch (Exception ex)
     {
         throw new PdfFactoryEngineException(Strings.FailedGeneratorShutdown, ex);
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Set Initialize DataStream callback
 /// </summary>
 /// <param name="initializeDataStreamCallback"></param>
 public static void SetInitializeDataStreamCallback(PdfFactoryInterface.InitializeDataStreamCallback initializeDataStreamCallback)
 {
     PdfFactoryInterface.SetInitializeDataStreamCallback(initializeDataStreamCallback);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Set readDataCallback
 /// </summary>
 /// <param name="readDataCallback"></param>
 public static void SetReadDataCallback(PdfFactoryInterface.ReadDataCallback readDataCallback)
 {
     PdfFactoryInterface.SetReadDataCallback(readDataCallback);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Sets reset data callback
 /// </summary>
 /// <param name="resetDataStreamCallback"></param>
 public static void SetResetDataStreamCallback(PdfFactoryInterface.ResetDataStreamCallback resetDataStreamCallback)
 {
     PdfFactoryInterface.SetResetDataStreamCallback(resetDataStreamCallback);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Sets reset data callback
 /// </summary>
 /// <param name="resetDataStreamCallback"></param>
 public static void SetResetDataStreamCallback(PdfFactoryInterface.ResetDataStreamCallback resetDataStreamCallback)
 {
     PdfFactoryInterface.SetResetDataStreamCallback(resetDataStreamCallback);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Set request data callback
 /// </summary>
 /// <param name="requestDataCallback"></param>
 public static void SetRequestDataCallback(PdfFactoryInterface.RequestDataCallback requestDataCallback)
 {
     PdfFactoryInterface.SetRequestDataCallback(requestDataCallback);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Set Initialize DataStream callback
 /// </summary>
 /// <param name="initializeDataStreamCallback"></param>
 public static void SetInitializeDataStreamCallback(PdfFactoryInterface.InitializeDataStreamCallback initializeDataStreamCallback)
 {
     PdfFactoryInterface.SetInitializeDataStreamCallback(initializeDataStreamCallback);
 }