Add a new page dynamically
- rafaelwithoeft
- Posts: 70
- Joined: Thu Mar 05, 2015 8:26 pm
Re: Add a new page dynamically
Thank you, i will verify how that works
Re: Add a new page dynamically
Hello,
We are always glad to help you.
Let us know if you need any additional help.
Thank you.
We are always glad to help you.
Let us know if you need any additional help.
Thank you.
- rafaelwithoeft
- Posts: 70
- Joined: Thu Mar 05, 2015 8:26 pm
Re: Add a new page dynamically
Hello, i tested the code and export directly to pdf works fine, as i needed.
But i have a function to edit the report if necessary and add the back page and return it to Viewer... the viewer not render the page :/
Where is my error?
Thank you...
But i have a function to edit the report if necessary and add the back page and return it to Viewer... the viewer not render the page :/
Where is my error?
Thank you...
Code: Select all
//....another codes
/*
*add back page if necessary
*/
if (json.has(this.IDENTIFICADOR_ADICIONAR_VERSO)) {
try {
String relatorioVersoString = json.getString(this.IDENTIFICADOR_ADICIONAR_VERSO);
if (!relatorioVersoString.isEmpty()) {
report = this.getMontarVersoRelatorio(report, relatorioVersoString);
}
} catch (JSONException e) {
//TODO
} finally {
json.remove(this.IDENTIFICADOR_ADICIONAR_VERSO);
}
}
}
report.render();
/*
* function to add back page
* *** (relatorioOriginal = original report)
* *** (nomeRelatorioPersonalizado = name of custom report (back page));
*/
private StiReport getMontarVersoRelatorio(StiReport relatorioOriginal, String nomeRelatorioPersonalizado) {
StiReport outReport = StiReport.newInstance();
try {
//more code...
//Code hidden to preserve the company, but his only get the custom xml report (backpage).
//more code...
//get back page report
InputStream stream = new ByteArrayInputStream(relatorioXmlString.getBytes(StandardCharsets.UTF_8));
StiReport relatorioVerso = StiSerializeManager.deserializeReport(stream);
relatorioOriginal.render(); // render main report
relatorioVerso.render(); // render back page
outReport.setBookmark(relatorioOriginal.getBookmark());
outReport.getRenderedPages().clear();
for (StiPage page : relatorioOriginal.getRenderedPages()) {
outReport.getRenderedPages().add(page);
outReport.getRenderedPages().add((StiPage) relatorioVerso.getRenderedPages().get(0).clone());
}
//PDF WORKS FINE, that show main page + back page correctly, this code is test
StiExportManager.exportPdf(outReport, new FileOutputStream("C:\\temp\\out.pdf"));
//PDF WORKS FINE, that show main page + back page correctly, this code is test
} catch (BancoDadosException | IOException | SAXException | StiDeserializationException | NullPointerException | StiException e) {
e.printStackTrace();
return relatorioOriginal; // if catch error, return original report
}
return outReport; //otherwise, return edited report
}
Re: Add a new page dynamically
Hello.
Just add
Just add
Code: Select all
outReport.setIsRendered(true);
- rafaelwithoeft
- Posts: 70
- Joined: Thu Mar 05, 2015 8:26 pm
Re: Add a new page dynamically
don't worked..
---------------------
EDIT
---------------------
ohh, worked! Thank you...
There was a code "report.Render(false)" after edited to add back pages and it made does not work ...
Thank you again.
Best Regards
---------------------
EDIT
---------------------
ohh, worked! Thank you...
There was a code "report.Render(false)" after edited to add back pages and it made does not work ...
Thank you again.
Best Regards
Re: Add a new page dynamically
We are always glad to help you.
Re: Add a new page dynamically
Hello.
Please, set the isRendered property of the report2 to true.
Thank you.
Please, set the isRendered property of the report2 to true.
Code: Select all
report2.isRendered = true;
Re: Add a new page dynamically
Hello.
Please, send us your sample to support@stimulsoft.com.
We will analyze it and provide you a solution.
Thank you.
Please, send us your sample to support@stimulsoft.com.
We will analyze it and provide you a solution.
Thank you.
Re: Add a new page dynamically
Hello,
Thank you. We will reply by email fast as possible.
Thank you. We will reply by email fast as possible.
Re: Add a new page dynamically
Hello,
We have not yet received your request on mail. Please clarify on which email you send it.
Thank you.
We have not yet received your request on mail. Please clarify on which email you send it.
Thank you.