Skip to content

Commit

Permalink
update img
Browse files Browse the repository at this point in the history
  • Loading branch information
marciojv committed Nov 29, 2024
2 parents 1b8ddf3 + 9ba03ec commit d3a9b51
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 18 deletions.
4 changes: 4 additions & 0 deletions frontend/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ html {
body {
padding: 0;
}

img {
max-width: 100% !important;
}
Binary file removed samples/entrega-de-trabalho.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@
import com.ambientelivre.plugin.dto.ProcessDefinitionDocumentationAuthorizationDto;
import com.ambientelivre.plugin.utils.BpmnXmlNamespaceUri;
import com.itextpdf.html2pdf.HtmlConverter;
import com.itextpdf.io.font.constants.StandardFonts;
import com.itextpdf.io.image.ImageData;
import com.itextpdf.io.image.ImageDataFactory;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.element.IBlockElement;
import com.itextpdf.layout.element.IElement;
import com.itextpdf.layout.element.Image;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.layout.properties.TextAlignment;
import com.itextpdf.layout.properties.UnitValue;

public class ProcessDefinitionDocumentationService extends AbstractCockpitPluginResource {
Expand Down Expand Up @@ -197,18 +198,11 @@ public byte[] generatePdf(ProcessDefinitionDocumentationAuthorizationDto documen
Document document = new Document(pdfDoc);

try {
document.add(new Paragraph("Portal Documentation")
.setFontSize(18)
.setBold()
.setTextAlignment(TextAlignment.CENTER));

ProcessDefinitionDocumentation process = documentation.getDefinitionDocumentation().get(0);

document.add(new Paragraph("Process: " + process.getName())
.setFontSize(14)
.setBold());
document.add(new Paragraph("Key: " + process.getKey()));
document.add(new Paragraph("Version: " + process.getVersion()));

InputStream imageByteInput = getProcessEngine()
.getRepositoryService()
Expand All @@ -224,12 +218,20 @@ public byte[] generatePdf(ProcessDefinitionDocumentationAuthorizationDto documen
document.add(image);
}

document.add(new Paragraph("Key: " + process.getKey())
.setFontSize(8)
.setMarginBottom(-2)
.setFont(PdfFontFactory.createFont(StandardFonts.HELVETICA)));
document.add(new Paragraph("Version: " + process.getVersion())
.setFontSize(8)
.setMarginBottom(-2)
.setFont(PdfFontFactory.createFont(StandardFonts.HELVETICA)));

for (ProcessDefinitionDocumentationElement element : process.getDocumentation()) {
if (element.getName() != null) {
document.add(new Paragraph(element.getName())
.setFontSize(12)
.setBold());
}
document.add(new Paragraph(
element.getName() != null ? element.getName() : element.getId())
.setFontSize(12)
.setBold());

if (element.getDocumentation() != null) {
addHtmlContentWithImages(element.getDocumentation(), pdfDoc, document);
Expand All @@ -238,20 +240,39 @@ public byte[] generatePdf(ProcessDefinitionDocumentationAuthorizationDto documen
addHtmlContentWithImages(element.getExtendedDocumentation(), pdfDoc, document);
}

document.add(new Paragraph("ID: " + element.getId()));
document.add(new Paragraph("ID: " + element.getId())
.setFontSize(8)
.setMarginBottom(-2)
.setFont(PdfFontFactory.createFont(StandardFonts.HELVETICA)));

if (element.getAssignee() != null) {
document.add(new Paragraph("Assignee: " + element.getAssignee()));
document.add(new Paragraph("Assignee: " + element.getAssignee())
.setFontSize(8)
.setMarginBottom(-2)
.setFont(PdfFontFactory
.createFont(StandardFonts.HELVETICA)));
}
if (element.getCandidateGroups() != null) {
document.add(new Paragraph(
"Candidate Groups: " + element.getCandidateGroups()));
"Candidate Groups: " + element.getCandidateGroups())
.setFontSize(8)
.setMarginBottom(-2)
.setFont(PdfFontFactory
.createFont(StandardFonts.HELVETICA)));
}
if (element.getDueDate() != null) {
document.add(new Paragraph("Due Date: " + element.getDueDate()));
document.add(new Paragraph("Due Date: " + element.getDueDate())
.setFontSize(8)
.setMarginBottom(-2)
.setFont(PdfFontFactory
.createFont(StandardFonts.HELVETICA)));
}
if (element.getOrder() != null && element.getOrder() > 0) {
document.add(new Paragraph("Order: " + element.getOrder()));
document.add(new Paragraph("Order: " + element.getOrder())
.setFontSize(8)
.setMarginBottom(-2)
.setFont(PdfFontFactory
.createFont(StandardFonts.HELVETICA)));
}

document.add(new Paragraph("\n"));
Expand Down

0 comments on commit d3a9b51

Please sign in to comment.