Hi
I am trying to convert a jpeg file to PDF using code I copied from your web site (http://www.aspose.com/documentation/.net-components/aspose.pdf-for-.net/how-to-convert-an-image-to-pdf.html). There is one difference: I did not manage to find Aspose.Pdf.Generator.Pdf, so I used Aspose.Pdf.Pdf, which has the same methods.
When I call Save on the Pdf object, I get an exception from the System.IO.BinaryReader constructor, saying that parameter "input" is null.
What can I do about this?
I include the exception and my code.
Regards
Klaus Kristiansen
Hi
It is now more than a week since I asked this question. Does nu one have an answer?
Regards
Klaus Kristiansen
Hi Klaus,
Thanks for using our products and sorry for replying you late.
Aspose.Pdf.Generator name space is available Aspose.Pdf for .NET versions starting with number 6.0.0. In fact its a new MergedAPI which contains the combined features of Aspose.Pdf for .NET (pre-6.x) and Aspose.Pdf.Kit for .NET. So now you can use the single component to create as well as manipulate existing PDF documents. Now concerning to your query, I am not entirely certain about the reasons why this issue is occurring. Can you please share the source image file so that we can test the scenario at our end. We apologize for your inconvenience.
You may consider visiting the following links for information on
Hi
This is the JPEG in question
Regards
Klaus Kristiansen
Hi Klaus,
Thanks for sharing the resource file. I have tested the scenario while using Aspose.Pdf for .NET 6.3.0 and the code snippet shared below and I am unable to notice any problem. The image is properly being converted into PDF format. Please take a look over the resultant PDF that I have generated. In case you still face any problem, can you please share some details regarding your working environment i.e. OS version, VisualStudio version, Aspose.Pdf for .NET version etc.
[C#]
// load source image fileFileStream fs =
new FileStream(“d:/pdftest/Klaus+Ole+Kristiansen.jpg”, FileMode.Open);
//Instantiate a Pdf object by calling its empty constructorAspose.Pdf.Generator.Pdf pdf1 =
new Aspose.Pdf.Generator.Pdf();
//Create a section in the Pdf objectAspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
//Create an image object in the sectionAspose.Pdf.Generator.Image image1 =
new Aspose.Pdf.Generator.Image(sec1);
//Add image object into the Paragraphs collection of the sectionsec1.Paragraphs.Add(image1);
// Set the path of image file// image1.ImageInfo.File = “d:/pdftest/Klaus+Ole+Kristiansen.jpg”;image1.ImageInfo.ImageStream = fs;
//Set the type of image using ImageFileType enumerationimage1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg;
//Save the Pdfpdf1.Save(“d:\pdftest\ImagetoPDF-Exception.pdf”);
Hi
How do I discover what version of Aspose we have?
Hi Klaus,
Please visit the following link for information on Getting Product and Build Information
In case you need any further information, please feel free to contact.