代码之家  ›  专栏  ›  技术社区  ›  Raul Agrait

您将如何在PDF中以编程方式嵌入SWF?

  •  6
  • Raul Agrait  · 技术社区  · 17 年前

    是否有可能从一个C语言应用程序中嵌入一个SWF中的一个PDF?

    2 回复  |  直到 15 年前
        1
  •  4
  •   dan    15 年前

    您可以使用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
  •  1
  •   AffineMesh    16 年前

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