Hi,
Hi Eugene,
Thanks for contacting support. In order to set the Image Height and Width inside resultant PDF document, please try using FixHeight
and FixWidth
properties of Aspose.Pdf.Image
class. Now concerning to your requirement, I have tested the scenario using following code snippet and as per my observations, the BarCode image appears in dimensions specified in code (even though it looks weird because Image Height is larger than width for this landscape image). Also please note that the default unit in Aspose.Pdf is Point, where 1 inch = 72 points and 1 cm = 1/2.54 inch = 0.3937 inch = 28.3 points.
[C#]
Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
doc.Pages.Add();
Aspose.Pdf.Image img = new Aspose.Pdf.Image();
img.File = "c:/pdftest/2015-07-06_1147.png";
// 1cm = 28.3 points
// 1 mm = 0.1 cm
// Height 50.673 mm = 5.06 cm = 5.06 x 28.3 = 143.198 points
img.FixHeight = 143.198;
// Width 10.00 mm = 1.0 cm = 1.0 x 28.3 = 28.3 points
img.FixWidth = 28.3;
// in case of Images with DPI, pixels = ( points / 72 ) * DPI
doc.Pages[1].Paragraphs.Add(img);
doc.Save("c:/pdftest/Sequence_Closed_Image_in_PDF.pdf")