【问题标题】:How would you programmatically embed a SWF in a PDF?您将如何以编程方式将 SWF 嵌入 PDF 中?
【发布时间】:2009-06-20 07:11:42
【问题描述】:

是否可以通过 C# 应用程序以编程方式将 SWF 嵌入 PDF 中?

【问题讨论】:

    标签: pdf flash pdf-generation


    【解决方案1】:

    您可以使用 iText 库的 c# 端口。它叫做 iTextSharp。

    http://itextsharp.com/

    代码的示例:

     // create an output file stream which will be used to capture the generated file 
        string outputFileName = "output.pdf"; 
        FileStream outputFile = new FileStream(outputFileName, FileMode.Create); 
    
        // open the original pdf file as a PdfReader 
        PdfReader reader = new PdfReader("inputfile.pdf"); 
    
        // open the output pdf file as a PdfStamper 
        PdfStamper stamper = new PdfStamper(reader, outputFile); 
    
        // inserts a blank page at the start of the document 
        stamper.InsertPage(1, PageSize.A4); 
    
        // add the flash file to the output document as an annotation 
        PdfFileSpecification fs = PdfFileSpecification.FileEmbedded(stamper.Writer, flashFileTextBox.Text, flashFileTextBox.Text, null); 
        PdfAnnotation flashInsert = PdfAnnotation.CreateScreen(stamper.Writer, new Rectangle(50f,791f,545f,420f),"Flash Insert",fs, "application/x-shockwave-flash", true); 
    
        stamper.AddAnnotation(flashInsert,1); 
    
        stamper.Close(); 
        reader.Close(); 
    

    【讨论】:

      【解决方案2】:

      Flash SWF 文件可以通过编程方式嵌入到 PDF 文档中。查看来自webSupergoo 的 PDF 库。该文档包括 C# 和 VB.NET 中的示例。

      【讨论】:

        猜你喜欢
        • 2011-09-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-08-24
        • 2013-02-23
        • 2012-08-03
        • 2014-08-20
        • 2011-07-07
        相关资源
        最近更新 更多