controladdin "PDFV2 PDF Viewer"
{
Scripts = 'https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js', 'https://unpkg.com/pdfobject@2.2.8/pdfobject.min.js', 'PDFViewer/script.js';
StartupScript = 'PDFViewer/Startup.js';
StyleSheets = 'PDFViewer/stylesheet.css';
MinimumHeight = 400;
MinimumWidth = 100;
MaximumHeight = 2000;
MaximumWidth = 4000;
HorizontalStretch = true;
VerticalStretch = true;
VerticalShrink = true;
HorizontalShrink = true;
event ControlAddinReady();
procedure LoadPDF(PDFDocument: Text; IsFactbox: Boolean)
procedure SetVisible(IsVisible: Boolean)
}
function InitializeControl(controlId) {
var controlAddIn = document.getElementById(controlId);
controlAddIn.innerHTML ='<div id="my-pdf"></div>';
}
function LoadPDF(PDFDocument,IsFactbox){
var iframe = window.frameElement;
requestAnimationFrame(() => {
PDFObject.embed(PDFDocument, "#my-pdf");
iframe.style.maxHeight = 1100 + 'px';
iframe.style.height = 1100 + 'px';
});
}
.pdfobject-container {
max-width: 100%;
max-height: 100%;
height: 100%;
border: 5px solid rgba(0,0,0,.2);
margin: 0;
}
page 81751 "PDFV2 PDF Viewer"
{
Caption = 'PDF Viewer';
PageType = Card;
UsageCategory = None;
layout
{
area(content)
{
group(General)
{
ShowCaption = false;
usercontrol(PDFViewer; "PDFV2 PDF Viewer")
{
ApplicationArea = All;
trigger ControlAddinReady()
begin
CurrPage.PDFViewer.LoadPDF(PDFAsTxt, false);
end;
}
}
}
}
procedure SetPDFDocument(PDFInStream: InStream)
var
Base64Convert: Codeunit "Base64 Convert";
begin
PDFAsTxt := PDFAliasLbl + Base64Convert.ToBase64(PDFInStream);
end;
var
PDFAsTxt: Text;
PDFAliasLbl: Label 'data:application/pdf;base64,', Locked = true;
}