use of io.lumeer.core.task.executor.operation.data.FileAttachmentData in project engine by Lumeer.
the class LumeerBridge method writePdf.
@SuppressWarnings("unused")
public void writePdf(final LinkBridge l, final String attrId, final String fileName, final boolean overwrite, final String html) throws IOException {
try {
if (html.length() > 5L * 1024 * 1024) {
throw new IllegalArgumentException("Input HTML too large.");
}
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfCreator.createPdf(new ByteArrayInputStream(html.getBytes(StandardCharsets.UTF_8)), baos);
var relatedOperation = setLinkAttribute(l, attrId, Value.asValue(getUpdateFileAttachmentsList(l, attrId, fileName, overwrite)));
operations.add(new AddLinkFileAttachmentOperation(l.getLink(), attrId, new FileAttachmentData(baos.toByteArray(), fileName, overwrite), relatedOperation));
} catch (Exception e) {
cause = e;
throw e;
}
}
use of io.lumeer.core.task.executor.operation.data.FileAttachmentData in project engine by Lumeer.
the class LumeerBridge method writePdf.
@SuppressWarnings("unused")
public void writePdf(final DocumentBridge d, final String attrId, final String fileName, final boolean overwrite, final String html) throws IOException {
try {
if (html.length() > 5L * 1024 * 1024) {
throw new IllegalArgumentException("Input HTML too large.");
}
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfCreator.createPdf(new ByteArrayInputStream(html.getBytes(StandardCharsets.UTF_8)), baos);
var relatedOperation = setDocumentAttribute(d, attrId, Value.asValue(getUpdateFileAttachmentsList(d, attrId, fileName, overwrite)));
operations.add(new AddDocumentFileAttachmentOperation(d.getDocument(), attrId, new FileAttachmentData(baos.toByteArray(), fileName, overwrite), relatedOperation));
} catch (Exception e) {
cause = e;
throw e;
}
}
Aggregations