Free Support Forum - aspose.com

Printing a PDF document from an image

Yesterday you answered my question about how to print using Aspose. Your answer was excellent, although if you noticed in my original code I had to convert a TIFF to a PDF doc first. I was able to accomplish this using some of my original code, a memory stream, and your code - see code below. However, when I use the PrintDocumentWithSetup method, the print screen is hidden and doesn't appear on my tab strip at the bottom. To the common user, it looks like the program just hangs. Is there a way to move this dialog box to the top, or better yet, show the normal printer dialog box?

Here's my full code. As you see, I have multiple TIFF images that I'm using to create the PDF pages.

Thanks!

Aspose.Pdf.Kit.PdfViewer viewer = new Aspose.Pdf.Kit.PdfViewer();
Pdf pdf1 = new Pdf();

for (int page = 0; page < IVSO.ImageViewerDocumentObject.PAGE_COUNT; page++)
{
//Create a section in the Pdf object ..a page
Section SectionTemp = pdf1.Sections.Add();
//Create an image object in the section
Aspose.Pdf.Image Tempimage = new Aspose.Pdf.Image(SectionTemp);
//Add image object into the Paragraphs collection of the section
SectionTemp.FirstLineIndent = 0;
SectionTemp.Paragraphs.Add(Tempimage);
//Set the path of image file
Tempimage.ImageInfo.File = IVSO.ImageViewerDocumentObject.FullImagePath;
Tempimage.ImageInfo.TiffFrame = page;
//Set the type of image using ImageFileType enumeration
Tempimage.ImageInfo.ImageFileType = ImageFileType.Tiff;
//Set image title
Tempimage.ImageInfo.Title = "Document image";
Tempimage.Margin.Left = 0;
Tempimage.ImageScale = 0.60F;
}

MemoryStream msPDF = new MemoryStream();
pdf1.Save(msPDF);

//Open a Pdf file
viewer.OpenPdfFile(msPDF);
viewer.PrintDocumentWithSetup();

//Close the current Pdf file
viewer.ClosePdfFile();


This message was posted using Page2Forum from PdfViewer - Aspose.Pdf.Kit for .NET

Hi Larry,

I would like to share with you that PrintDocumentWithSetup actually shows the printer dialog to the user; however, I have noticed that you want to do this in a web application and I’m afraid, it is not possible to show a printer dialog from a remotely hosted web application; you can do this in a desktop application or from the localhost. Nevertheless, a related issue is already logged as PDFKITNET-7522 in our issue tracking system. Our team is looking into this issue and you’ll be updated via this forum thread once it is resolved.

We’re sorry for the inconvenience. If you have any further questions, please do let us know.
Regards,