private string SaveSwfFile(string pdfFileName)
        {
            var uploadDateTime = DateTime.Now;

            string webPath = String.Format("~/upload/Swf/{0:yyyyMMdd}", uploadDateTime);
            string path    = Server.MapPath(webPath);

            if (!System.IO.Directory.Exists(path))
            {
                // 目录不存在,则创建.
                System.IO.Directory.CreateDirectory(path);
            }

            string swfFileName = String.Format("{0:yyyyMMdd}/{0:yyyyMMddHHmmss}.swf", uploadDateTime);


            string pdfFilePhysicalPath = Server.MapPath("~/Upload/Pdf/" + pdfFileName);
            string swfFilePhysicalPath = Server.MapPath("~/Upload/Swf/" + swfFileName);


            // Pdf2Swf
            Pdf2SwfConverter converter = new Pdf2SwfConverter();

            bool result = converter.Pdf2Swf(pdfFilePhysicalPath, swfFilePhysicalPath);


            return(swfFileName);
        }
        static void Main(string[] args)
        {
            Pdf2SwfConverter converter = new Pdf2SwfConverter();

            bool result = converter.Pdf2Swf("Pdf/django10-cheat-sheet.pdf", "Swf/django10-cheat-sheet.swf");


            Console.WriteLine("Finish! " + result);


            Console.ReadLine();
        }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PdfModel"/> class.
 /// </summary>
 /// <param name="converter">
 /// The converter.
 /// </param>
 /// <param name="settings">
 /// The settings.
 /// </param>
 public PdfModel(Pdf2SwfConverter converter, ApplicationSettingsProvider settings)
 {
     PdfReader.unethicalreading = true;
     this.converter             = converter;
     this.settings = settings;
 }