Click here to Skip to main content
13,091,300 members (49,678 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hello Everyone,
How can we generate a pdf file with Video and Image slider.
Posted 14-Jan-13 23:35pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Hello there, have you ever used itextsharp? Its a beautiful library, it was a java library ported to c#.[^]

The sample code i've got below is for embedding a swf file into a pdf. With this sameple you should be able to try whatever other formats you may have and see if they will work by importing them into a pdf.

Please let me know if you have any questions.


using System;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.pdf.richmedia;


static void Main(string[] args)
        public static void CreatePdfWithMedia(string file)
            string day = DateTime.Now.ToString("dd/MM/yyyy");
            Document document = new Document();
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(file, FileMode.Create));
            RichMediaAnnotation media = new RichMediaAnnotation(writer, new Rectangle(36, 400, 559, 806));
            PdfFileSpecification fs = PdfFileSpecification.FileEmbedded(writer, @"C:\temp\test.swf", "1.swf", null);
            PdfIndirectReference asset = media.AddAsset("1.swf", fs);
            RichMediaConfiguration configuration = new RichMediaConfiguration(PdfName.FLASH);
            RichMediaInstance instance = new RichMediaInstance(PdfName.FLASH);
            RichMediaParams flashVars = new RichMediaParams();
            String vars = day;
            flashVars.FlashVars = vars;
            instance.Params = flashVars;
            instance.Asset = asset;
            PdfIndirectReference configurationRef = media.AddConfiguration(configuration);
            RichMediaActivation activation = new RichMediaActivation();
            activation.Configuration = configurationRef;
            media.Activation = activation;
            PdfAnnotation richMediaAnnotation = media.CreateAnnotation();
            richMediaAnnotation.Flags = PdfAnnotation.FLAGS_PRINT;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 15 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100