.BMP to Pdf Conversion

hi,

when i am trying to convert .bmp to pdf the image is not rendered properly, i used the below code, we are using a license version

After setting the license we are calling the below method

public static void ConvertBiMapImage(string inputFileName, string destination, string fileName)
{
var doc = new Document();
Page page = doc.Pages.Add();
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();

var myimage = new Bitmap(inputFileName);
page.PageInfo.Margin.Bottom = 0;
page.PageInfo.Margin.Top = 0;
page.PageInfo.Margin.Left = 0;
page.PageInfo.Margin.Right = 0;
page.CropBox = new Aspose.Pdf.Rectangle(0, 0, myimage.Width, myimage.Height);


page.Paragraphs.Add(image1);
image1.File = inputFileName;
doc.Save(destination + “\” + fileName + “.pdf”);
}

Adding the files also

Hi Srikant,


Thanks for your inquiry. We will appreciate it if you please share your sample BMP image here. We will look into it and will guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,

hi, not able to upload the .BMP file


Only files with the following extensions are allowed: zip,cab,jpg,gif,png,mpg,mpeg,avi,wmv,wma,mp3,ra,rar,rm,sql,txt,xls,doc,pdf,rdl,ppt,docx,xlsx,pptx,xlsm,tif,rtf,dot,xml,odt,odp,jrprint,ods,csv,xsn,xps,7z,XPS,OXPS. Please select a valid file.

Hi Srikant,


Thanks for your feedback. You can zip your source document and attach, it will serve the purpose.

Best Regards,

hi,

Thankx for your quick reply, please find the images

Regards

Srikant Bal

Hi Srikant,


Thanks for sharing your source document. Please use Width and Height property of PageInfo for controlling dimension of output PDF as following it will resolve the issue.

var doc = new Document();<o:p></o:p>

Aspose.Pdf.Page page = doc.Pages.Add();

Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();

var myimage = new Bitmap(myDir + "ForConversion.bmp");

page.PageInfo.Margin.Bottom = 0;

page.PageInfo.Margin.Top = 0;

page.PageInfo.Margin.Left = 0;

page.PageInfo.Margin.Right = 0;

page.PageInfo.Width = myimage.Width;

page.PageInfo.Height = myimage.Height;

page.Paragraphs.Add(image1);

image1.File = myDir + "ForConversion.bmp";

doc.Save(myDir+"AfterConversion.pdf");


Please feel free to contact us for any further assistance.

Best Regards,

How to convert BMP to PDF using Aspose Android via Java?

Thanks
bright

@brightraj

Thank you for contacting support.

Please visit Convert an Image to PDF for your kind reference and then share your kind feedback with us.