Printing PDFs

Hi,


my goal is using the Aspose pdf solution to print pdf files.
i have a couple of questions/concerns regarding that:
1. can aspose print to a defined printer?
2. can aspose alert if the printer does not support printing pdfs?
3. does aspose supports converting pdf to postscript?
4. will aspose support running on different os? (windows, linux, aix mainly).

thanks,
shani

Hi Shani,


Thanks for your query. We are looking into your query and will get back to you soon.

Best Regards,
shani.klajman:
1. can aspose print to a defined printer?
Hi Shani,

Thanks for contacting support.

We recently have supported the feature to specify printer name for printing the files. We will be sharing the code snippet shortly.

shani.klajman:
2. can aspose alert if the printer does not support printing pdfs?
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:
3. does aspose supports converting pdf to postscript?
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:
4. will aspose support running on different os? (windows, linux, aix mainly).
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.

Hi Nayyer,


thanks for the response. it looks like most of our needs will be filled.
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?

also, when do you suppose we will be able to see that code snippet for using printer name?

regards,
shani klajman

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,


i downloaded the trial for Aspose.Pdf - i can’t see the com.aspose.ms.System.Drawing.Printing.PrinterSettings package
is this part of Aspost.Pdf? how can i test this code…

we want to test this on a couple of environments we are running.

Hi Shani,


Sorry for the inconvenience. As Nayyer described above that the feature is malfunctioning, so we had not included it in latest release. That is why you are unable to find the classes in updated JAR. Our development team is investigating the issue and as soon as it is fixed, we will include it in upcoming release.

Again, we are truly sorry for the inconvenience caused.

Best Regards,

Hi,


any idea when the next release is schedule? or when will this feature be available?

we are just trying to figure out if to include this ability in our next release…

thanks,
shani.

Hi Shani,


Thanks for your patience.

We plan to get the new version published within current month but I am afraid currently I am not certain about the exact timelines when it will be published. As soon as it becomes available, we will update you within this forum thread.

is the feature with printing to a specified printer available now?

Hi Stanislav,


Thanks for your inquiry. Yes you can send print to specific printer. Please check following code snippet you may change as per your requirement. Hopefully it will help you to accomplish the task.

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);


Please feel free to contact us for any further assistance.

Best Regards,

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)