Writing directly to pdf stream

Hi -



iText has the ability to write directly to a pdf graphics context which makes it easy to write swing components to a pdf. Does Aspose PDF have this ability?



Example from iText:



final PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(pdfFile));

final PdfContentByte pdfContentByte = writer.getDirectContent();

final PdfTemplate pdfTemplate = pdfContentByte.createTemplate(width, height);

// create graphics

g2 = pdfTemplate.createGraphics(width, height, fontMapper);

// print to graphics

print(g2, pageFormat, i);

// dispose

g2.dispose();

// add to pdf document

pdfContentByte.addTemplate(pdfTemplate, 0, 0);





Dave

Hello Dave,


Thanks for your interest in our products.

Please share that either you need to save the contents of resultant PDF file in Stream object or you need to directly save Swings object to Pdf file. Please share some details so we may answer accordingly.

PS, Please note that you may try using Pdf.Save(BasicStream) or Pdf.save(java.io.OutputStream stream) overloaded methods to save the resultant file into Stream object.

Hi -



I want to directly save Swings object to Pdf file.





Dave

Hello Dave,


Thanks for sharing the information.

I am afraid currently Aspose.Pdf for Java does not support the feature to add swing objects to PDF document. However for the sake of implementation, I have logged this requirement as PDFJAVA-33131 in our issue tracking system. We will further look into the details of this requirement and will keep you updated on the status of correction. Please be patient and spare us little. We are sorry for your inconvenience.

One more query, please share some details regarding the controls which you need to add inside the PDF document and also please share that when adding these controls, do you need them to appear as UI components (Buttons, Lables, Fields etc) or as a static image.

The issues you have found earlier (filed as PDFJAVA-33131) have been fixed in Aspose.Pdf for Java 3.2.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.