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

convert Tif to PDF drops pages

$
0
0
Hi,

I am converting TIF to PDFs in some cases we do not get all the output pages in PDF. These pages show up a little corrupted in the Wang viewer but the content can be seen.

       public void ConvertImage(string sFileIn, string sFileOut)
        {            
            Aspose.Pdf.Document doc = new Aspose.Pdf.Document();

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

            // Set margins so image will fit, etc.
            page.PageInfo.Margin.Bottom = 0;
            page.PageInfo.Margin.Top = 0;
            page.PageInfo.Margin.Left = 0;
            page.PageInfo.Margin.Right = 0;

            page.PageInfo.Height = Aspose.Pdf.PageSize.PageLetter.Height;
            page.PageInfo.Width = Aspose.Pdf.PageSize.PageLetter.Width;

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


            System.Drawing.Bitmap bmImage = new System.Drawing.Bitmap(sFileIn);

            if ( (float)CalculatePageWidth(bmImage.Width, bmImage.HorizontalResolution) > (float)(CalculatePageWidth((float)page.PageInfo.Width, 72.0f) + 0.02f) )
                page.PageInfo.IsLandscape = true;
            else
                page.PageInfo.IsLandscape = false;

            //Add the image into paragraphs collection of the section
            page.Paragraphs.Add(image1);
            image1.File = sFileIn;

            doc.Save(sFileOut);
        }


Viewing all articles
Browse latest Browse all 3131

Trending Articles