Hello,
Just downloaded the program to test it out. Looks very thorough and powerful. Looking forwward to playing with it.
Im trying to solve a specific problem. I am writing a console app (not web) in C# that takes in a byte array and I need to create a pdf from that. I thought I read that dynamicpdf can do this, but I havent seen anything exactly through my searches. Is this possible?
Thanks
Creating from Byte Array
Re: Creating from Byte Array
Support · Oct 21, 2010Hello,
You can use the PdfDocument Class
to read the byte array and create a PDF. If you look at the class constructor
you will see that one of them takes a byte array as a parameter.
Thanks,
ceTe Software Support Team.
Re: Creating from Byte Array
Forum member · Oct 21, 2010Thanks for the reply. I did discover the pdfdocument class through my searches here, but didnt see that it was in the merge namespace. good to know. im really close but getting an error that i see has been discussed before, but no solid resolution has been discussed.
Invalid PDF File. Cross-reference table not found.
snipets of my code:
string path = @"c:\temp\MyTest.pdf";
PdfDocument doc = new PdfDocument(docData); <-- crashes here
MergeDocument merge = new MergeDocument(doc);
merge.Draw(path);
im using ceTe.DynamicPDF.35 reference and my docdata array does have values in it.
Re: Creating from Byte Array
Support · Oct 22, 2010Hello,
In order to merge the PDF document which is in the form of byte array you will have to use the PdfDocument class constructor which takes the PDF byte data as argument. You can also use the physical file path of the PDF document. Further you will have to use this PdfDocument object to build the MergeDocument object for merging. Below is the code for it.
Byte[] bytedata = File.ReadAllBytes(@"Path for the PDF document");
PdfDocument pdfdoc = new PdfDocument(bytedata);
MergeDocument document = new MergeDocument(pdfdoc);
document.Draw(@"Path to save the PDF document");
If you continue getting the error then kindly send over the input PDF document with which you are having trouble in merging to our support team at: [^a|mailto:support@cete.com|opennewiwndow|Support Team^] so that they can look into it further.
Thanks,
ceTe Software Support Team
Re: Creating from Byte Array
Forum member · Oct 22, 2010it was bad data, everything is working fine now thanks!
Re: Creating from Byte Array
Forum member · Jan 19, 2015
byte[] filedata;
documnetPathWithFilename="c:\test.pdf";
using (FileStream fs = new FileStream(documnetPathWithFilename, FileMode.Create))
{
fs.Write(filedata, 0, filedata.Length);
}