PDFNEWJAVA-33999 - How to save pdf as postscript

Hi,
I am trying to save a pdf as a postscript file using version 17.6 for JAVA.
According to PDFNEWJAVA-33999 is should be available since version 10.8.0.
But the SaveFormat method does not specify .PS.
How is solution PDFNEWJAVA-33999 implemented ?
Not using the SaveFormat method ?

thanks in advance for your help.
regards,
Paul

@PaulKwakman

Thanks for contacting support.

In order to convert PDF to PostScript, you may use PdfViewer and call its printDocumentWithSettings method. Please check following sample code snippet to achieve the requirement.

String absoluteLicensePath = "pathToAsposeLicense";
String printerName = "PS Printer";

String srcFolder = "pathToSources";
String srcFileName = "Test_Document.pdf";
String psOutFileName = "psOut.ps";

// Set License	
License licensePdf = new License();
try {
	licensePdf.setLicense(absoluteLicensePath + "Aspose.Pdf.lic");
} catch (Exception e) {
	e.printStackTrace();
}								

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 com.aspose.pdf.printing.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);

In case if you face any issue, please share your sample document. We will test the scenario in our environment and address it accordingly.

Hi Asad,

Thanks you for your quick reply.
But in this example i need an existing printer.
On our server are no printers available, that’s why i need the output to be saved as a postscript file.
Than can i copy it to printer-shares, printservers, vm-printers.

Like the SaveFormat method in Aspose Word for JAVA.

Is it possible to add this feature in a new version ?

thanks and regards,
Paul

@PaulKwakman

Thanks for writing back and sharing more details.

I have logged a feature request as PDFJAVA-36942 in our issue tracking system for your requirement. Product team will further investigate the feasibility of the feature and share their feedback accordingly. As soon as we have some definite updates in this regard, we will let you know. Please be patient and spare us little time.

We are sorry for the inconvenience.