Printing using Apose

Do you have any examples of how to print a pdf document? I’ve been going through your samples for an hour and haven’t found anything. My code is below. This was working on Friday, but today I get an error:

Sys.WebForms.PageRequestManagerParserErrorException: The message received by the server could not be parsed. … (Let me know if you need the whole error).

I have a TIFF image displayed on the browser screen, and I’m clicking a button to display it as a PDF document on the screen so the user can print/copy etc.

My code:

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.80F;
}

Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = “application/pdf”;

pdf1.Save(“Document.pdf”, SaveType.OpenInAcrobat, Response);
Response.End();

Thanks!
Larry

Hi Larry,

I would like to share with you that you can use Aspose.Pdf.Kit for .NET to print a PDF file using your .NET code. Please find the details and a sample on this link.

I hope this helps. If you have any further questions, please do let us know.
Regards,