Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Images conversion without borders

$
0
0
Hello, when i try to convert images (Photoshop, tiff, jpg, bmp, etc) into PDF, i obtain some black borders in pdf pages.
How can i use all pdf page to occupy entire page space for image?
(see attached image originale and pdf resulting - password for pdf is "master")

i use this code:

                        MemoryStream oMTempStream = new MemoryStream();
                        Aspose.Imaging.ImageOptions.PngOptions OptionsI = new Aspose.Imaging.ImageOptions.PngOptions();
                        ((Aspose.Imaging.Image)m_oDocument).Save(oMTempStream, OptionsI);
                                        
                        Aspose.Pdf.Generator.Pdf oPdf = new Aspose.Pdf.Generator.Pdf();
                        Aspose.Pdf.Generator.Section oSection = new Aspose.Pdf.Generator.Section();
                        oSection.PageInfo.Margin.Bottom = 0;
                        oSection.PageInfo.PageBorderMargin.Bottom = 0;
                           
                        if (((Aspose.Imaging.Image)m_oDocument).Width > ((Aspose.Imaging.Image)m_oDocument).Height)
                        {
                            oPdf.IsLandscape = true;
                            float iW =oSection.PageInfo.PageWidth;
                            float iH = oSection.PageInfo.PageHeight;
                            oSection.PageInfo.PageWidth = iH;
                            oSection.PageInfo.PageHeight = iW;
                        }

                        oPdf.Sections.Add(oSection);
                        Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(oPdf.Sections[0]);

                        image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Png;
                        oPdf.Sections[0].Paragraphs.Add(image1);
                        image1.ImageInfo.ImageStream = oMTempStream;
                        oPdf.Save(_oOutputStream);
                        oMTempStream.Dispose();


Viewing all articles
Browse latest Browse all 3131

Trending Articles