I am trying to print a PDF file with the following code:
PdfViewer viewer = new PdfViewer();
viewer.OpenPdfFile(@"C:\Test\GenericCoverSheet.pdf");
viewer.PrintDocument();
viewer.ClosePdfFile();
It gives me the exception : The file is corrupt or too many pages.
I am able to open the file, it looks fine too.
Attaching the PDF that gives problem.
Another query.
Is there a way to print a Word Document directly in a simple way, as is being done by PDF Viewer?
I saw the class : AsposeWordsPrintDocument.
I tried the sample given.
It fails to print and when clicked OK on preview dialog, it gave an error:
Invalid HRESUT 0.
I dont want to preview the document. Just print the document.
Thanks.
I got the issue fixed with PDF printing.
I usually copy the Dlls to a common “bin” directory and use it from there.
I forgot to copy the PDF.Kit.res file.
Please let me know about printing from Word only.
Thanks.!
sudheer_cv:
Another query.
Is there a way to print a Word Document directly in a simple way, as is being done by PDF Viewer?
I saw the class : AsposeWordsPrintDocument.
I tried the sample given.
It fails to print and when clicked OK on preview dialog, it gave an error:
Invalid HRESUT 0.
I dont want to preview the document. Just print the document.
Hi Sudheer,
Thank you very much for considering Aspose.
Your above question is related to Aspose.Words, so I’m moving this thread to the concerned forum.
Regards,
Hi
Thanks for your inquiry. You can print Word documents using Document.Print method. Please see the following link to learn more:
https://docs.aspose.com/words/net/print-a-document-programmatically-or-using-dialogs/
Best regards.
Cool.!
That worked.
Thanks