Пример #1
0
        internal void AddBackground(string pdfFile, ConversionProfile conversionProfile)
        {
            if (!conversionProfile.BackgroundPage.Enabled)
                return;

            var tmpFile = _pdfProcessor.MoveFileToPreProcessFile(pdfFile, "PreBackground");

            try
            {
                DoAddBackground(pdfFile, tmpFile, conversionProfile);
            }
            catch (ProcessingException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new ProcessingException(ex.GetType() + " while addding background:" + Environment.NewLine + ex.Message, ErrorCode.Background_GenericError);
            }
            finally
            {
                //delete copy of original file
                if (!string.IsNullOrEmpty(tmpFile))
                    if (File.Exists(tmpFile))
                        File.Delete(tmpFile);
            }
        }
Пример #2
0
        public void ConvertToPdfA(string pdfFile, ConversionProfile profile)
        {
            if (!RequiresPdfAConversion(profile))
            {
                return;
            }

            var tmpFile = _pdfProcessor.MoveFileToPreProcessFile(pdfFile, "PrePdfA");

            try
            {
                DoConvertToPdfA(tmpFile, pdfFile, profile);
            }
            catch (Exception ex)
            {
                throw new ProcessingException(ex.GetType() + " during PDF/A conversion:" + Environment.NewLine + ex.Message, ErrorCode.Conversion_PdfAError);
            }
            finally
            {
                //delete copy of original file
                if (!string.IsNullOrEmpty(tmpFile))
                {
                    if (File.Exists(tmpFile))
                    {
                        File.Delete(tmpFile);
                    }
                }
            }
        }