Hi,
Hi Shani,
shani.klajman:1. can aspose print to a defined printer?
This features seems more related to printing driver of specific printer and I am afraid this feature is currently not supported. However I will check with development team to see if this feature can be implemented or not.shani.klajman:2. can aspose alert if the printer does not support printing pdfs?
This requirement can be accomplished by sending the print request to PostScript printer. But I am afraid this feature is currently not supported. For the sake of correction, we already have logged this requirement as PDFNEWJAVA-33999 in our issue tracking system.shani.klajman:3. does aspose supports converting pdf to postscript?
Aspose.Pdf for Java is compatible with Windows, Linux, OSX etc. Please try using our API and in case you encounter any issue, please feel free to contact.shani.klajman:4. will aspose support running on different os? (windows, linux, aix mainly).
Hi Nayyer,
Adding more to my previous comments, you can print the PDF file using default printer by following instructions specified over Print PDF file to default printer (facades) but as shared earlier, we have recently introduced the feature to print PDF over specific printer. The following code can be used but I am afraid its causing some issues and I am in coordination with development team to get these problems resolved.
[Java]
//Create PdfViewer object<o:p></o:p>
com.aspose.pdf.facades.PdfViewer viewer = new com.aspose.pdf.facades.PdfViewer();
//Open input PDF file
viewer.bindPdf("c:/pdftest/AAMINTRA_42430011_0.pdf");
//Set attributes for printing
viewer.setAutoResize(true); //Print the file with adjusted size
viewer.setAutoRotate(true); //Print the file with adjusted rotation
viewer.setPrintPageDialog(false); //Do not produce the page number dialog when printing
//gets a printjob object.
java.awt.print.PrinterJob printJob = java.awt.print.PrinterJob.getPrinterJob();
//create objects for printer and page settings and PrintDocument
com.aspose.ms.System.Drawing.Printing.PrinterSettings ps = new com.aspose.ms.System.Drawing.Printing.PrinterSettings();
com.aspose.ms.System.Drawing.Printing.PageSettings pgs = new com.aspose.ms.System.Drawing.Printing.PageSettings();
//set XPS/PDF printer name
ps.PrinterName = "Microsoft XPS Document Writer";
//gets the default page.
java.awt.print.PageFormat pf = printJob.defaultPage();
//print document using printer and page settings
viewer.PrintDocumentWithSettings(pgs, ps);
//close the Pdf file.
viewer.close();
shani.klajman:i was thinking - in case the printer does not support PDF or has some other issue with the printer, will we be able to track the print job status after using the aspose.pdf to print the document?Hi Shani,In order to accomplish above stated requirement, please try using following code lines.[Java]// Check the print status<o:p></o:p>
if (viewer.getPrintStatus() != null)
{
// No errors were found. Printing job has completed successfully
System.out.println("printing completed without any issue..");
}
else
{
System.out.println("problem occurred during printing..");
}
Hi Nayyer,
Hi Shani,
Hi,
Hi Shani,
is the feature with printing to a specified printer available now?
Hi Stanislav,
String printerName = “PS
Printer”;<o:p></o:p>
String srcFolder = "pathToSources";
String srcFileName = "Test_Document.pdf";
String psOutFileName = "psOut.ps";
Document pdf= new Document(srcFolder+srcFileName);
/* Create the printer settings */
PdfPrinterSettings printerSettings = new PdfPrinterSettings();
printerSettings.setPrinterName(printerName);
printerSettings.setPrintToFile(true);
printerSettings.setPrintFileName(srcFolder+psOutFileName);
PrintPageSettings pageSettings = new PrintPageSettings();
pageSettings = printerSettings.getDefaultPageSettings();
pageSettings.setMargins(new PrinterMargins(0, 0, 0, 0));
// Landscape setting not working
pageSettings.setLandscape(true);
pageSettings.setColor(true);
PdfViewer viewer = new PdfViewer();
viewer.bindPdf(pdf);
viewer.setAutoResize(true);
viewer.setAutoRotate(true);
viewer.setPrintPageDialog(false);
// print PDF document
viewer.printDocument();
viewer.printDocumentWithSettings(printerSettings);
viewer.printDocumentWithSettings(pageSettings, printerSettings);
The issues you have found earlier (filed as PDFNEWJAVA-33999) have been fixed in Aspose.Pdf for Java 10.8.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
(2)