hi, i’m using this code to convert variuos images format into png (and then i put png in pdf file)
Aspose.Imaging.ImageOptions.PngOptions OptionsI = new Aspose.Imaging.ImageOptions.PngOptions();
OptionsI.TransparentColor = new Aspose.Imaging.TransparentColorSetting(Aspose.Imaging.Color.Transparent);
Aspose.Imaging.ResolutionSetting oResI = new Aspose.Imaging.ResolutionSetting(Convert.ToDouble(m_iResolution), Convert.ToDouble(m_iResolution));
OptionsI.ResolutionSettings = oResI;
((Aspose.Imaging.Image)m_oDocument).Save(oMTempStream, OptionsI);</i>
but i’m experiencing some errors with images with transparency in it
If i convert a png file with transparency in image (another png) it will respect transparent areas, and resultant pdf has white color as transparent, but when i try with some sample GIF or TIFF (in attachment - i don’t have a photoshop sample to proofing), transparent color - in png and pdf - is rendered as black!
With the same input images i have another strange error when createing PDF file with this code:
<i>Aspose.Pdf.Document oPdf = new Aspose.Pdf.Document();
Aspose.Pdf.Page oPage = oPdf.Pages.Add();
if (((Aspose.Imaging.Image)m_oDocument).Width > ((Aspose.Imaging.Image)m_oDocument).Height)
{
double iW = oPage.PageInfo.Width;
double iH = oPage.PageInfo.Height;
oPage.PageInfo.Width = iH;
oPage.PageInfo.Height = iW;
}
oPage.PageInfo.Margin.Bottom = 0;
oPage.PageInfo.Margin.Top = 0;
oPage.PageInfo.Margin.Left = 0;
oPage.PageInfo.Margin.Right = 0;
oPage.MediaBox = new Aspose.Pdf.Rectangle(0, 0, ((Aspose.Imaging.Image)m_oDocument).Width, ((Aspose.Imaging.Image)m_oDocument).Height);
oPage.CropBox = new Aspose.Pdf.Rectangle(0, 0, ((Aspose.Imaging.Image)m_oDocument).Width, ((Aspose.Imaging.Image)m_oDocument).Height);
Aspose.Pdf.Image oImage = new Aspose.Pdf.Image();
oPage.Paragraphs.Add(oImage);
oImage.ImageStream = oMTempStream;
oPdf.Save(_oOutputStream);
The Pdf file “stretch the images” in it’s pages… i can’t understand: for transparency and for pdf page dimensions i have no problems with others files.
What can i do to manage this?
Thank’s