Set encryption password for pdf in xdocreport
Asked Answered
B

1

0

How to set encryption password while converting odt file to pdf in xdocreport?

I am referring to PDFWriter.setEncryption method in iText here.

Brote answered 19/2, 2014 at 5:30 Comment(0)
C
2

XDocReport 1.0.4 (which will soon released) provides fr.opensagres.xdocreport.itext.extension.IPdfWriterConfiguration which gives you the capability to customize the iText PDFWriter. Here a sample which set encryption :

org.odftoolkit.odfdom.converter.pdf.PdfOptions options = new PdfOptions();
options.setConfiguration( new IPdfWriterConfiguration()
{

  public void configure( PdfWriter writer )
  {
    writer.setEncryption(...);
  }
});
PdfConverter.getInstance().convert( document, out, options );

If you wish to use the converter with the report.convert method, you must do like this :

org.odftoolkit.odfdom.converter.pdf.PdfOptions pdfOptions = ...
Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.ODFDOM).subOptions(pdfOptions);

IXDocReport report = ...
report.convert(context, options, out);

You can find those info in the XDocReport wiki.

Credence answered 19/2, 2014 at 21:52 Comment(7)
Great! When are you planning to release the new version? and is this feature available in snapshot version?Brote
This feature is enable in snapshot version 1.0.4-SNAPSHOT. If you use maven, you can use it. We will try to create the 1.0.4 release next week.Credence
I don't understand: XDocReport is licensed as MIT and you're using iText? Whichever version of iText you're using, the iText license can never be compatible with your MIT license.Ricercar
The problem with using an LGPL library inside MIT software is that the LGPL has stronger copyleft than the MIT license. If you use iText as an LGPL library inside a product that is licensed under the MIT license, you create the perception that iText can be used as software licensed under the MIT license. This has to be avoided. We can't accept that, because we've had similar problems like this in the past (some of them could only be fixed with a "cease and desist letter" from our attorney). If you are "good open source citizens", you'll fix this over the weekend.Ricercar
Hi Bruno, XDocReport modules uses iText as a maven dependency. AFAIK, there is no license issue in that case. The samples (which are bundled with iText version 2.1.7) are released under LGPL license. see :code.google.com/p/xdocreport/source/browse/?repo=samplesFrey
I've answered this privately. The summary: (1) it is important to avoid confusion; end-users may not be aware that they are importing LGPL software (especially if it's done automatically through Maven). (2) iText 2.1.7 should no longer be used: itextpdf.com/salesfaq (You are responsible should any issue arise due to your use and propagation of that version.)Ricercar
More info about licensing issue with iText 2.1.7 with XDocReport available here : code.google.com/p/xdocreport/wiki/WhichLicenseAppliesFrey

© 2022 - 2024 — McMap. All rights reserved.