Hello Aspose,
I want to print the pdf document from my application to the printer I select from the application.
Could you please let me this can be achieved using aspose.
Thanks
Uday Baba
Hello Aspose,
I want to print the pdf document from my application to the printer I select from the application.
Could you please let me this can be achieved using aspose.
Thanks
Uday Baba
Thanks for contacting support.
You may please use following code snippet in order to print your PDF document:
var file = dataDir + "AsposeTestFile.pdf";
var document = new Document(file);
var viewer = new Facades.PdfViewer(document);
var settings = new System.Drawing.Printing.PrinterSettings();
settings.PrinterName = "PrinterName";
viewer.PrintDocumentWithSettings(settings);
In case of further assistance, please feel free to let us know.
I am using aspose PDF java, How can this be achieved in Java, please suggest also I’m seeing below exception
“class com.aspose.pdf.internal.p568.z6: Tried to access printer ‘PASTRY’ with invalid settings”
Why we get this exception and how we can resolve it in Java
Thanks for writing back.
In order to print PDF in Java Environment, please use following code snippet:
com.aspose.pdf.facades.PdfViewer viewer = new com.aspose.pdf.facades.PdfViewer();
viewer.bindPdf("c:/pdftest/TestDokument.pdf");
com.aspose.pdf.printing.PdfPrinterSettings printerSettings = new com.aspose.pdf.printing.PdfPrinterSettings();
printerSettings.setPrinterName("PrinterName");
com.aspose.pdf.printing.PrintPageSettings pageSettings = printerSettings.getDefaultPageSettings();
viewer.printDocumentWithSettings(pageSettings, printerSettings);
viewer.close();
In case you face some issue while using suggested code snippet, please share complete exception message, Stack Trace, sample PDF Document and your printer information which you are using. We will test the scenario in our environment and address it accordingly.
Would you please share complete details of your scenario? What type of simple ways you want to know about?
I am wondering if there are more simple ways to do that, because I am not the best at coding, I even have no idea about that. Maybe there are some things to do that will automatically set everything for me, I would be very glad if somebody will tell me how to figure everything out. I need smn with discord or smth else, I need to explain.
This is the simplest method to print a PDF document using Aspose.PDF. However, if you want to find a solution other than programming or Aspose API, this is not appropriate channel to look into. In case you have any inquiry about Aspose APIs, please feel free to let us know.