CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2010
    Posts
    8

    Save an array as pdf to disk

    Hi,

    I have a function which retruns a pdf as a byte[]
    private static CreatePDF()
    {
    byte[] pdf;
    //Do some work & create pdf
    return pdf;
    }

    If I call this function this way:
    byte[] MyPdf = CreatePDF()

    How can I save MyPdf to disk as a pdf file (c:\path\Filename.pdf) ?

    I'm using .NET 2
    Thanks

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Save an array as pdf to disk

    Look at the StreamWriter class in msdn.

    P.S. why use .Net 2.0 ?

  3. #3
    Join Date
    Jul 2015
    Posts
    12

    Re: Save an array as pdf to disk

    As far as I know there are no native .Net methods that can save to PDF. You can use PdfSharp or other PDF libraries to achieve this.

  4. #4
    Join Date
    Jul 2015
    Posts
    12

    Re: Save an array as pdf to disk

    Sorry...if you DO have a method that actually returns the PDF as an Array you can use

    File.WriteAllBytes("yourfile.ext", yourBytes) and pass your array variable.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured