Tiff file to pdf is showing half of the image

Hi Team,

Here i am trying to convert a tiff image to PDF.
But the pdf image after conversion is showing only half.
Can you please help me?

Here i am attaching the original tiff file and converted pdf file.

please see the below code.

 //Instantiate a Pdf object by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
//Create a section in the Pdf object
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
//Create an image object in the section
Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);
//Add image object into the Paragraphs collection of the section
sec1.Paragraphs.Add(image1);
//Set the path of image file
image1.ImageInfo.File = FullInputFileName;
//Set the type of image using ImageFileType enumeration
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Tiff;
pdf1.Save(Path.Combine(Path.GetDirectoryName(FullInputFileName), Path.GetFileNameWithoutExtension(FullInputFileName) + “.pdf”));


Regards
Anish

Hi team,

For converting multi page tiff image to single page tiff , first i am converting it to PDF and then convert back to single page tiff pages.

But the pdf image after conversion is showing only half.
Can you please help me?

Here i am attaching the original tiff file and converted pdf file.

please see the below code.

 //Instantiate a Pdf object by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
//Create a section in the Pdf object
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
//Create an image object in the section
Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);
//Add image object into the Paragraphs collection of the section
sec1.Paragraphs.Add(image1);
//Set the path of image file
image1.ImageInfo.File = FullInputFileName;
//Set the type of image using ImageFileType enumeration
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Tiff;
pdf1.Save(Path.Combine(Path.GetDirectoryName(FullInputFileName), Path.GetFileNameWithoutExtension(FullInputFileName) + “.pdf”));


Regards
Anish

Hi Anish,
Thanks for your inquiry. Please use following code snippet to scale image or scale page size according to your requirements. Hopefully it will serve the purpose.

//scale image according to page width/height
//image1.ImageInfo.FixWidth = sec1.PageInfo.PageWidth;
//image1.ImageInfo.FixHeight= sec1.PageInfo.PageHeight;
Bitmap myimage = new Bitmap(FullInputFileName);
// scale page according to Image width and height
sec1.PageInfo.PageWidth=myimage.Width;
sec1.PageInfo.PageHeight=myimage.Height;

Please feel free to contact us for any further assistance.
Best Regards,

Hi ,

Thanks for your help. I can able to convert the tiff properly.
But using the same code when i tried to convert the attached tif image again i am getting the same problem.

Can you please check.
Regards
Anish

Hi Anish,


Thanks for your feedback. I’m afraid I’m unable to reproduce the reported issue, while testing the scenario with Aspose.Pdf for .NET 8.0. Please download and try latest API of Aspose.Pdf, hopefully your issue will be resolved.

Best Regards,

Hi ,
I am having one more problem. After converting the tiff image to pdf the image is shrinking also.
Is this problem also will solve by using the latest version of Aspose.pdf.dll?

Regards
Anish

Hi Tilal,
Please see the code which i am using

                //Instantiate a Pdf object by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
//Create a section in the Pdf object
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
//Create an image object in the section
Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);
//Add image object into the Paragraphs collection of the section
sec1.Paragraphs.Add(image1);
//Set the path of image file
image1.ImageInfo.File = FullInputFileName;
//Set the type of image using ImageFileType enumeration
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Tiff;
            <span style="color:green;">//scale image according to page width/height</span>
            image1.ImageInfo.FixWidth = sec1.PageInfo.PageWidth;
            image1.ImageInfo.FixHeight = sec1.PageInfo.PageHeight;

            <span style="color:#2b91af;">Bitmap</span> myimage = <span style="color:blue;">new</span> <span style="color:#2b91af;">Bitmap</span>(FullInputFileName);
            <span style="color:green;">// scale page according to  Image width and height</span>
            sec1.PageInfo.PageWidth = myimage.Width;
            sec1.PageInfo.PageHeight = myimage.Height;

            pdf1.Save(<span style="color:#2b91af;">Path</span>.Combine(<span style="color:#2b91af;">Path</span>.GetDirectoryName(FullInputFileName), <span style="color:#2b91af;">Path</span>.GetFileNameWithoutExtension(FullInputFileName) + <span style="color:#a31515;">".pdf"</span>));<br><br>The converted pdf is showing in single page itself with shrieked .<br>I am using Aspose pdf v7.9<br><br>Please see the attachments. Which is having tiff file and converted pdf file.<br><br>Can you please help me.<br><br>Regards<br>Anish<br></pre><br>

Hi Tilal,

But when i use the flowing code , The first page is showing its actual size.
But the second page is shrinking.

image1.ImageInfo.FixWidth = sec1.PageInfo.PageWidth - sec1.PageInfo.Margin.Left - sec1.PageInfo.Margin.Right;
// specify the image Height information equal to page Height
                image1.ImageInfo.FixHeight = sec1.PageInfo.PageHeight - sec1.PageInfo.Margin.Top - sec1.PageInfo.Margin.Bottom;</pre><br>Is there any way to achieve this in both the image.<br><br>Regards<br>Anish<br>

Hi Anish,


Thanks for sharing additional information. While testing with Aspose.Pdf for .NET 8.0, I’ve managed to reproduce the reported issue of second page shrinking as PDFNEWNET-35333 in our issue tracking system for further investigation and resolution. We will notify as soon as it is resolved.

Sorry for the inconvenience faced.

Best Regards,

Hi Team,

Is there any update on this issue without upgrading the dll?

Regards
Anish

Hi Anish,


Thanks for your inquiry. I’m afraid we’ve recently notice the issue and moreover, the issue is pending for analysis in the queue at the moment. Once analysis phase is completed then we will be in good position to share our findings/ETA. Please be patient and spare us some time.

Thanks for your patience and cooperation.

Best Regards,

Hi Anish,


Thanks for your patience.

I am pleased to share that the issue reported earlier has been resolved and its hotfix will be included in upcoming release of Aspose.Pdf for .NET 8.1.0. I would recommend you to please try using the following code snippet to convert TIFF image to PDF format.

[C#]

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

Page page = doc.Pages.Add();

//Create an image object in the section

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

//Add image object into the Paragraphs collection of the section

page.Paragraphs.Add(image1);

//Set the path of image file

image1.File = "c:/pdftest/TIFAE0FB31C.TIF";

image1.FixWidth = page.PageInfo.Width - page.PageInfo.Margin.Left - page.PageInfo.Margin.Right;

// specify the image Height information equal to page Height

image1.FixHeight = page.PageInfo.Height - page.PageInfo.Margin.Top - page.PageInfo.Margin.Bottom;

doc.Save(“c:/pdftest/TIFAE0FB31C.pdf”);

The issues you have found earlier (filed as PDFNEWNET-35333) have been fixed in Aspose.Pdf for .NET 8.1.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.