Hi,
var input = new FileStream(“c:/pdftest/Sampleimages.pdf”, FileMode.Open); // Made it
FileStream, instead of MemoryStream<o:p></o:p>
Stream doc = new MemoryStream(); // TODO-A: avoid using memory stream;
Aspose.Pdf.Facades.PdfConverter pdfConverter = new Aspose.Pdf.Facades.PdfConverter();
pdfConverter.BindPdf(input);
pdfConverter.DoConvert();
int counter=1;
while (pdfConverter.HasNextImage())
{
pdfConverter.GetNextImage("c:/pdftest/Sampleimages_" +counter+ ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
counter += 1;
}
pdfConverter.SaveAsTIFF(“c:/pdftest/Sampleimages.tiff”);
Hey Nayyer,
and moreover the sample you attached .tiff image is of size 2.4 MB
hey Team,
Hi,
//open
document<o:p></o:p>
Document pdfDocument = new Document("c:/pdftest/Sampleimages.pdf");
//create Resolution object
Resolution resolution = new Resolution(300);
//create TiffSettings object
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.Compression = CompressionType.CCITT4;
tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Default;
tiffSettings.SkipBlankPages = false;
//create TIFF device
TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
//convert a particular page and save the image to stream
tiffDevice.Process(pdfDocument, "c:/pdftest/Sampleimages_output.tif");
MemoryStream Stream = new MemoryStream();
// save output in stream object
tiffDevice.Process(pdfDocument, Stream);
hey Nayyer,
Moreover the 722KB you are mentioning is for just on pdf Page but not for the complete PDF document i shared.The document which i shared has 5 pages.Does that mean for the complete PDF document will it take 3.6 MB of .tiff image file ??
Hi,munnismiles:We tried using the compression type .In the compression type we are seeing the document as attached which was not similar to the oiginal file w.r.t Color
Hi,munnismiles:Moreover the 722KB you are mentioning is for just on pdf Page but not for the complete PDF document i shared.The document which i shared has 5 pages.Does that mean for the complete PDF document will it take 3.6 MB of .tiff image file ??
munnismiles:Even after adding the stream of .tiff image of size 720KB to RTF/.DOC using aspose, we are still getting the OUT OF Memoery exceptionSecond thing,If we use the latest version of PDF is there any possibility to get rid of this out of memory exceptionHi,PDF to TIFF is properly being generated. However from above problem description, it appears to be an issue with Aspose.Words where exception is being added when trying to add TIFF image to DOC/DOCX file. I have intimated my fellow worker from Aspose.Words team to further look into this matter. We apologize for this inconvenience.
Hi,
You can use the code from Convert Image to PDF example to convert your TIFF to DOC/RTF. Just change the output file name to DOC/RTF in this example.
If you want to insert TIFF image at a specified location in the document, you can use DocumentBuilder.InsertImage method for this purpose. Please share your complete code to insert TIFF in the document and a sample TIFF if you still see out of memory exception.
Best Regards,
any update??
Hi,
Sorry, I was unable to reproduce this issue at my end. Your PDF was converted to TIFF and TIFF was added to RTF without any issue. I was not able to use doc variable and TempFileStream method as these were not declared anywhere in your code. Remaining code was working fine.
Can you please share a runnable application with all required methods and variables to reproduce the issue?
Best Regards,