Never having converted an existing PDF to byte[] before I used some free source code. My problem is that "InputStream" isn't recognized. The MSDN Library seems to classify it under the import System.Web but I have already imported this (http://msdn.microsoft.com/de-de/libr...putstream.aspx)! I think there might also be a prob with "new File()". Here is my code:
Code:
public static byte[] convertDocToByteArray(String sourcePath)
{
byte[] byteArray=null;
try {
File file = new File(sourcePath);
InputStream inputStream = new FileInputStream(file);
byte[] bytes = new byte[file.length()];
inputStream.read(bytes);
} catch (FileNotFoundException e)
{
Console.Write(e);
} catch (IOException io)
{
Console.Write(io);
}
return byteArray;
}
And here are my imports:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Azubiportal.AZPService;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.xml;
using System.Net.Mail;
using System.IO;
using System.Data;
using System.ComponentModel;
using System.Collections;