6
是否有可能以編程方式將C#應用程序中的SWF嵌入到PDF中?您將如何以編程方式將PDF嵌入到SWF中?
是否有可能以編程方式將C#應用程序中的SWF嵌入到PDF中?您將如何以編程方式將PDF嵌入到SWF中?
您可以使用iText庫的c#端口。它被稱爲iTextSharp。
什麼樣的代碼可能看起來像一個例子:
// 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();
Flash SWF文件可以以編程方式嵌入到PDF文檔中。查看webSupergoo的PDF庫。該文檔包含C#和VB.NET中的示例。