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 Jul 18, 2016 2:20 pm

Hi,

As told in an other post about the saving of word documents with data-bindings, I'm creating a tool which can have as input a folder which contains different kinds of files and converts all those files into one pdf file.

I'm trying to use spire in c# for this but at the moment I'm having an issue with pdf files who contain input field.

When I try to convert a pdf which contains input fields the system throws a nullpointer exception.

This is my code:

Code: Select all
class SpirePdfMerger
    {
        private List<Stream> pdfStreams;

        public SpirePdfMerger(List<Stream> pdfStreams)
        {
            this.pdfStreams = pdfStreams;
        }

        public void MergePdfStreamsAndSave(string savePath)
        {
            PdfDocument mergedPdf = MergePdfStreams();
            SaveMergedPdf(mergedPdf, savePath);
        }

        public PdfDocument MergePdfStreams()
        {
            PdfDocument mergedPdf = new PdfDocument();

            foreach(Stream pdfStream in pdfStreams)
            {
                PdfDocument pdfToMerge = new PdfDocument(pdfStream);
                mergedPdf.AppendPage(pdfToMerge);
                pdfStream.Close();
            }

            return mergedPdf;
        }

        public void SaveMergedPdf(PdfDocument mergedPdf, string savePath)
        {
            mergedPdf.SaveToFile(savePath);
            mergedPdf.Close();
        }
    }


In attachement you can find a sample of a pdf file with input I'd like to convert.

bsnetit
 
Posts: 5
Joined: Mon Jul 11, 2016 2:30 pm

Tue Jul 19, 2016 3:47 am

Dear bsnetit,

Thanks for your detailed information.
I have noticed your issue and posted it to our Dev team. Once there is any progress, we will let you know.
Sorry for inconvenience caused.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Fri Aug 12, 2016 6:05 am

Dear bsnetit,

Thanks for waiting.
Now we release Spire.PDF Pack(Hot Fix) Version:3.7.198 which resolves the issue you mentioned, welcome to test it.
If there is any question, please let me know.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Return to Spire.PDF