PDF created using itext # opens in Foxit but not Acrobat

My application creates PDF documents using itext #. Files open normally and display correctly in Foxit Reader, but in Adobe Acrobat this happens with an error:

There was an error processing page. There was a problem reading this document (109).

Why will the file be opened in one and not the other?

+3
source share
2 answers

This was my code:

        var document = new Document(_pageSize, PageMargin, PageMargin, PageMargin, PageMargin);
        var writer = PdfWriter.GetInstance(document, output);
        writer.CloseStream = false;
        writer.PageEvent = new Footer(HeaderFont, _defaultFont.BaseFont, report.Name);
        document.Open();

        if (report.Results.Any())
            document.Add(CreateTable(report.Results, report.Types, report.RootType));
        else
            document.Add(new Paragraph("No results", _defaultFont));

        writer.Close();

After adding a line document.Close();before the line, writer.Close();it is now displayed in both Foxit and Acrobat.

, itext # , . , , , .NET .

+6

PDF , . Foxit, , pdf, . , . PDF , , , - .

+2

Source: https://habr.com/ru/post/1773989/


All Articles