Print Single Image Solution

Is there a single product for this purpose? Or I need to manually create a new document and insert an image in it? (specifying page size, margin,…)

And any support for multipage tiff file?


Thank you.

Hi,

Thanks for your interest in our products.

I am a representative from Aspose.Pdf team. This component provides the capabilities to generate PDF documents from scratch, as well as it also provides the feature to manipulate existing PDF documents. As per your requirement, I am pleased to share that Aspose.Pdf can be used to place image inside PDF document and you can use this single API to print the resultant PDF. Please visit the following links for information on


In case I have not properly understood your requirement or you have any further query, please feel free to contact.

Hi

Thank you for your interest in Aspose products. I am representative of Aspose.Words team. Using Aspose.Words you can print the images (including multipage tiff) by inserting them into an empty document and then printing this document. Here you can find a code example how you can insert images into the document:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-convert-an-image-to-pdf.html

Here you can learn more about printing documents using Aspose.Words:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.document.print_overloads.html

Also, if your purpose is simply print images, you can achieve this using .NET compatibilities only. For instance, see the following code example:

PrintDocument doc = new PrintDocument();

doc.PrinterSettings.PrinterName = @"\\192.168.0.2\hp LaserJet 1010 Series Driver";

doc.PrintPage += Doc_PrintPage;

doc.Print();

private void Doc_PrintPage(object sender, PrintPageEventArgs e)

{

e.Graphics.DrawImage(Image.FromFile(@"C:\Temp\test.jpg"), e.MarginBounds.Left, e.MarginBounds.Top);

}

This code just prints an image.

Hope this helps.

Best regards,

Thank you very much for your prompt reply.

The given code sample in following link works, but not for gif file
http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-convert-an-image-to-pdf.html

It gives "A generic error occurred in GDI+" error when hitting the function "GetFrameCount"
I create my test gif file using windows xp pro sp3 mspaint.exe program, with dimension 200x200.

Hi

Thanks for your request. Could you please attach your test image here for testing? We will check it and provide you more information.

Best regards,

Attached the gif file. Thank you.

Hi,

Thanks for contacting support.

In case you are facing an issue while converting the image file into
word format, you may try using Aspose.Pdf for .NET to convert it into
PDF format and then try printing it. In fact I just have tried converting attached image file into PDF format and then have tried printing it into .XPS format and I am unable to notice any problem. Please take a look over the attached resultant files that I have generated. We are sorry for your inconvenience.

Hi

Thank you for additional information. You can modify the code like shown below to resolve the problem:

///

/// Converts an image to PDF using Aspose.Words for .NET.

///

/// File name of input image file.

/// Output PDF file name.

public static void ConvertImageToPdf(string inputFileName, string outputFileName)

{

// Create Aspose.Words.Document and DocumentBuilder.

// The builder makes it simple to add content to the document.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

// Read the image from file, ensure it is disposed.

using (Image image = Image.FromFile(inputFileName))

{

// Get the number of frames in the image.

int framesCount = 1;

try

{

framesCount = image.GetFrameCount(FrameDimension.Page);

}

catch

{

// do nothing.

}

// Loop through all frames.

for (int frameIdx = 0; frameIdx < framesCount; frameIdx++)

{

// Insert a section break before each new page, in case of a multi-frame TIFF.

if (frameIdx != 0)

builder.InsertBreak(BreakType.SectionBreakNewPage);

// Select active frame.

image.SelectActiveFrame(FrameDimension.Page, frameIdx);

// We want the size of the page to be the same as the size of the image.

// Convert pixels to points to size the page to the actual image size.

PageSetup ps = builder.PageSetup;

ps.PageWidth = ConvertUtil.PixelToPoint(image.Width, image.HorizontalResolution);

ps.PageHeight = ConvertUtil.PixelToPoint(image.Height, image.VerticalResolution);

// Insert the image into the document and position it at the top left corner of the page.

builder.InsertImage(

image,

RelativeHorizontalPosition.Page,

0,

RelativeVerticalPosition.Page,

0,

ps.PageWidth,

ps.PageHeight,

WrapType.None);

}

}

// Save the document to PDF.

doc.Save(outputFileName);

}

Hope this helps.

Best regards,

Works painlessly. Thanks.


Next we are looking for C# support for raw image files taken from digital cameras.

Hi

Thanks for your request. In what format do you get images from your digital camera? I suppose, this must be JPEG. If so, you can use the code mentioned earlier to print them.

Best regards,

Actually we would like to support raw images from digital cameras of different brand, including nikon


The file extensions should be .nef

Hi

Thank you for additional information. Unfortunately, Aspose.Words does not support such image format. The main goal of Aspose.Words is to work with MS Word document. Since MS Word does not natively support this image format, supporting of this image format is out of scope of Aspose.Words.

Best regards,