1

I'm trying to export a pdf/dox document. I have the byte[] array and I tried these 2 variations that i found on the internet:

        var generalPath = "generalPath";
        // returns the pdf byte array
        var pdfData = invoiceProcessor.PreviewPdfInvoice(invoice.Id, company.Id, CrossCuttingConcerns.Enums.LanguageEnum.EN);

        System.IO.File.WriteAllBytes(generalPath + "\\wabPDF.pdf", pdfData.PdfContent);

        using (Stream file2 = System.IO.File.OpenWrite(generalPath + "\\wPDF.pdf"))
        {
            file2.Write(pdfData.PdfContent, 0, pdfData.PdfContent.Length);
        }

Neither of these work, and both of them are creating a corrupted PDF.

Sami
  • 141
  • 2
  • 10
  • Could you please tell me the wabPDF.pdf file is well or not? If this file is not show well that means there is something wrong with your `invoiceProcessor.PreviewPdfInvoice` method. – Brando Zhang Feb 12 '21 at 03:03

0 Answers0