Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Apr 26, 2021 4:29 pm

I am using FreeSpire, but I would likely purchase the developer license if SpirePDf has ability to extract pdf documents (and possibly Word.docs, images, etc) that are embedded in a portfolio pdf document.
Does spirePDf have that capability?

kensmith38
 
Posts: 9
Joined: Sun Oct 12, 2014 6:01 pm

Tue Apr 27, 2021 1:55 am

Hello,

Thanks for your inquiry!

Our Spire.PDF can extract PDF documents, Word. Docs, images, etc in a portfolio, please refer to the following code to achieve it. I also attached my input file for your reference.
Code: Select all
//add portfolio
            string inputfile1 = @"E:\testdoc\sample2.pdf";
            string inputfile2 = @"E:\testdoc\doc2.docx";
            string inputfile3 = @"E:\testdoc\test.png";

            PdfDocument pdf = new PdfDocument();
            pdf.Collection.AddFile(inputfile1);
            pdf.Collection.AddFile(inputfile2);
            pdf.Collection.AddFile(inputfile3);

            pdf.SaveToFile("portfolio.pdf", FileFormat.PDF);
            pdf.Dispose();

//extrct portfolio
            PdfDocument newpdf = new PdfDocument();
            newpdf.LoadFromFile("portfolio.pdf");

            foreach (PdfAttachment attachment in newpdf.Attachments)
            {
                string filename = attachment.FileName;
                File.WriteAllBytes(filename,attachment.Data);
            }
            newpdf.Dispose();

portfolio.zip

If you encounter any issues during your test, please provide us with your input file for reference. Thanks in advance.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Wed Jun 16, 2021 3:04 am

Hello,

Hope you are doing well!

Has the issue been solved now? Could you please give us some feedback at your convenience?

Thanks in advance.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Wed Jun 16, 2021 3:33 pm

I would like to thank you, Annika, for all of your help; you went above and beyond the amount of assistance that I expected.
I have confirmed your latest code recommendation (look for annotation attachments). You duplicated my scenario (creating a PDF from an Outlook email which had attachments in the email) and you provided the exact code snippet to count those annotation attachments. We should consider this issue to be resolved.
Thanks for all of your help.
Sincerely,
Ken Smith

kensmith38
 
Posts: 9
Joined: Sun Oct 12, 2014 6:01 pm

Thu Jun 17, 2021 1:24 am

Hello,

You are welcome.

If you have other questions about using Spire.PDF in the future, please feel free to contact us.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.PDF