Convering PDF Packages (PDF Portfolios) to XOD

88 views
Skip to first unread message

Support

unread,
Nov 23, 2012, 8:11:19 PM11/23/12
to pdfnet-w...@googlegroups.com
Q:
 
After I converted a PDF generated with Acrobat 11 the converted XOD is showing page that instructs us to 'upgrade to the latest Acrobat' or something line that.
 
It looks like the file is a PDF Package (a.k.a. PDF Portfolio). How do I convert PDF paclage to XOD?
 
----------
A:
 

We are planning to add direct support for PDF packages in ToXod conversion soon. In the meantime you could do something like the following to extract the embedded files. Each extracted file could be converted individually, or you could create a new PDF document that simply concatenates the portfolio's component documents into a single PDF and convert it.

 

                                PDFDoc doc = new PDFDoc("package.pdf");
                                doc.InitSecurityHandler();

                                pdftron.SDF.NameTree files =
NameTree.Find(doc, "EmbeddedFiles");
                                if(files.IsValid())
                                {
                                        // Traverse the list of embedded
files.
                                        NameTreeIterator i =
files.GetIterator();
                                        for (int counter = 0; i.HasNext();
i.Next(), ++counter)
                                        {
                                                string entry_name =
i.Key().GetAsPDFText();
                                                Console.WriteLine("Part:
{0}", entry_name);
                                                FileSpec file_spec = new
FileSpec(i.Value());
                                                Filter stm =
file_spec.GetFileData();
                                                if (stm!=null)
                                                {
                                                        FilterReader reader
= new FilterReader(stm);
                                                        string fname =
output_path + "extract_" + counter.ToString();
                                                        StdFile f = new
StdFile(fname, StdFile.OpenMode.e_write_mode);
                                                        FilterWriter writer
= new FilterWriter(f);

writer.WriteFilter(reader);
                                                        writer.Flush();
                                                        f.Close();

                                                }
                                        }
                                }

Reply all
Reply to author
Forward
0 new messages