-
Notifications
You must be signed in to change notification settings - Fork 374
Open
Description
Hey there 👋, could you help me 🙏
Problem
When inserting a hyperlink into a Word template using XDocReport (Velocity) and converting it to PDF via XWPF, any & characters in the URL are automatically encoded as &, resulting in broken links in the generated PDF.
For example, a URL like:
https://www.google.com/search?q=ola&sclient=gws-wiz
The result in the PDF:
https://www.google.com/search?q=ola&sclient=gws-wiz
This causes the link to not function correctly when clicked from the PDF.
Example
InputStream input = new FileInputStream("template.docx");
IXDocReport report = XDocReportRegistry.getRegistry().loadReport(input, TemplateEngineKind.Velocity);
IContext context = report.createContext();
context.put("url", "https://www.google.com/search?q=ola&sclient=gws-wiz");
Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.XWPF);
OutputStream output = new FileOutputStream("output.pdf");
report.convert(context, options, output);The template:
Version
- xdocreport 2.1.0
- macos 15.5
Thanks for your help!
Metadata
Metadata
Assignees
Labels
No labels