Good morning,
first of all, thanks for your quickly reply.
Attached is one of the multipage TIFF that is causing the problem. Hope it helps
regards,
Guillermo
Good morning,
first of all, thanks for your quickly reply.
Attached is one of the multipage TIFF that is causing the problem. Hope it helps
regards,
Guillermo
Hello Guillermo,
Thanks for sharing the resource image file.
I have tested the scenario using Aspose.Pdf for .NET 4.7.0 (which can be downloaded from here) over Windows7 Enterprise 64Bit and as per my observations, all the frames of TIFF image are properly being converted into PDF format. Please take a look over the attached PDF document that I have generated using following code snippet.
[C#]
//Instantiate a Pdf object by calling its empty constructor
Pdf pdf1 = new Pdf();
//Create a section in the Pdf object
Aspose.Pdf.Section sec1 = pdf1.Sections.Add();
//Create an image object in the section
Aspose.Pdf.Image image1 = new Aspose.Pdf.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 = "d:/pdftest/test2.tif";
//Set the type of image using ImageFileType enumeration
image1.ImageInfo.ImageFileType = ImageFileType.Tiff;
//Set image title
image1.ImageInfo.Title = "TIFF image";
// Set the value to -1 so that all the frames of TIFF image are included in PDF document
image1.ImageInfo.TiffFrame = -1;
//Save the Pdf
pdf1.Save("d:\\pdftest\\TIFFtoPDFConversion_test.pdf");
In case it does not resoled your problem or you have any further query, please feel free to contact. We apologize for your inconvenience.
Hi codewarrior,
The problem becomes when we load the image from a memory stream as you can see in the code attached in previous posts.
I reattach you the code we're using:
FileStream fs = new FileStream(@"C:\BizTalk\SCO.Sistemas.BizTalk\SCO.Sistemas.BizTalk.IndexadorGD\Port\Multi TIF.TIF", FileMode.Open);
fs.Read(tmpBytes, 0, Convert.ToInt32(fs.Length));
StreamReader mystream = new StreamReader(fs);
Aspose.Pdf.Section sec1 = pdf1.Sections.Add();
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image(sec1);
image1.ImageInfo.ImageFileType = Aspose.Pdf.ImageFileType.Tiff;
image1.ImageInfo.TiffFrame = -1;
sec1.Paragraphs.Add(image1);
image1.ImageInfo.ImageStream = mystream.BaseStream;
thanks,
Guillermo
Hello Guillermo,
Thanks for the information.
I have tested the scenario and I am able to reproduce the same problem. For the sake of correction, I have logged it in our issue tracking system as PDFNET-20854. We will investigate this issue in details and will keep you updated on the status of a correction.
We apologize for your inconveniencwe.
Has there been any resolution to this issue? I am having the same problem.
Hello Micheal,
Thanks for using our products.
We have made some progress towards the resolution of this problem. However, in order to cater the particular issue that you are facing, we would be requiring the source TIFF file so that we can test the scenario at our end. We apologize of your inconvenience.
I’m sorry but I can’t provide you with the source tiff as it contains sensitive information. If you would like I can provide you with my code. I may can see if it is possible to send it to you redacted but I am guessing I still want be able to do this.
Hello Micheal,
Until or unless we have tested the scenario, we might not be able to figure out the actual reasons for this problem. The source file that will share will only be used for testing purpose and will be removed after the resolution of this problem. More along, you may also send the source file directly to us without uploading it over this forum thread. Please follow the steps specified over following link to share the source file. How to send a license?
In case I can be of any further assistance, please let me know. We apologize for your inconvenience.
I have the same problem…
I have added IsAllFramesInNewPage = True,
Hi,
Thanks for using our products.
I have tested the scenario using Aspose.Pdf for .NET 4.7.0 and as per my observations, the PDF document is properly being generated. I have used the following code snippet to test the scenario. The resultant PDF that I have generated is in attachment. Please take a look.
[C#]
// Instantiate an object PDF class
Pdf pdf = new Pdf();
// add the section to PDF document sections collection
Aspose.Pdf.Section section = pdf.Sections.Add();
// create an image object
Aspose.Pdf.Image image = new Aspose.Pdf.Image(section);
// provide the path for TIFF image file\
image.ImageInfo.File = @"c:/pdftest/Постановление+Правительства+РФ+N583(4467070_7904-Вх_16_11_2010).tif"; // (multipage tiff - included)
// specify the input image file type
image.ImageInfo.ImageFileType = ImageFileType.Tiff;
// add image to paragraphs collection of section
section.Paragraphs.Add(image);
// specify the value to include all the frames of image file into resultant PDF
image.ImageInfo.TiffFrame = -1;
//Save the pdf document
pdf.Save(@"C:\pdftest\Tiff_Conversion_Issue.pdf");
Hi Nayyer,
Hi,
Thanks for sharing the information.
I have tested the scenario while using Stream object and I am able to notice the problem. However, I have also tested it with the upcoming release version of Aspose.Pdf for .NET 4.8.0 and as per my observations, the PDF document is properly being generated (all the frames of TIFF image are present over the PDF document). Please be patient and wait for the new release version. As soon as it becomes available, we will let you know.
We apologize for your inconvenience.
PS, I have used FileStream object to test the scenario
Hi Nayyer,
Hi,
Thanks for your patience.
I am pleased to inform you that Aspose.Pdf for .NET 4.8.0 is released. Please download the version from this link and in case you encounter any problem, please feel free to contact.
Thank you very much. Works fine.
The problem is that from the second page, the images are very small, do not retain the original size of the tiff.
This is the code of our method and attached is the resulting pdf
Hi,
I have tested the scenario using following code snippet and I am unable to notice the problem. The resultant PDF that I have generated is in attachment. Please take a look.
[C#]
//Instantiate a Pdf object by calling its empty constructor
Pdf pdf1 = new Pdf();
//Create a section in the Pdf object
pdf1.PageSetup.Margin.Left = 0;
pdf1.PageSetup.Margin.Right = 0;
pdf1.PageSetup.Margin.Top = 0;
pdf1.PageSetup.Margin.Bottom = 0;
Aspose.Pdf.Section sec1 = pdf1.Sections.Add();
// Create a FileStream object to read the imag file
FileStream fs = File.OpenRead(@"c:\pdftest\Постановление+Правительства+РФ+N583(4467070_7904-Вх_16_11_2010).tif");
// Read the image into Byte array
byte[] data = new byte[fs.Length];
fs.Read(data, 0, data.Length);
// Create a MemoryStream object from image Byte array
MemoryStream ms = new MemoryStream(data);
//Create an image object in the section
Aspose.Pdf.Image imageht = new Aspose.Pdf.Image(sec1);
//Set the type of image using ImageFileType enumeration
imageht.ImageInfo.ImageFileType = ImageFileType.Tiff;
// Specify the image source as MemoryStream
imageht.ImageInfo.ImageStream = ms;
//Add image object into the Paragraphs collection of the section
sec1.Paragraphs.Add(imageht);
imageht.ImageInfo.TiffFrame = -1;
imageht.ImageInfo.IsAllFramesInNewPage = true;
//Save the Pdf
pdf1.Save("c:\\pdftest\\TIFFtoPDFConversion_test.pdf");
// Close the MemoryStream Object
ms.Close();
In case you face any problem or you have any further query, please feel free to contact. We apologize for your inconvenience.
Hi codewarior,
We have followed your code and that worked!
Thank you so much!
The issues you have found earlier (filed as 20854) have been fixed in this update.