mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-20 06:35:54 +02:00
fix: widgets are not embeding in pdf using API
This commit is contained in:
@@ -165,29 +165,26 @@ export default async function createDocumentwithCoordinate(request, response) {
|
||||
'Signers',
|
||||
contact?.map(x => x.contactPtr)
|
||||
);
|
||||
let updatePlaceholders = contact.map((signer, index) => {
|
||||
let updatePlaceholders = contact.map((signer) => {
|
||||
const placeHolder = [];
|
||||
|
||||
for (const widget of signer.widgets) {
|
||||
const pageNumber = widget.page;
|
||||
const page = placeHolder.find(page => page.pageNumber === pageNumber);
|
||||
|
||||
const signOpt = { name: 'signature', status: required };
|
||||
const widgetData = {
|
||||
xPosition: widget.x,
|
||||
yPosition: widget.y,
|
||||
isStamp: widget.type === 'stamp',
|
||||
key: randomId(),
|
||||
isDrag: false,
|
||||
firstXPos: widget.x,
|
||||
firstYPos: widget.y,
|
||||
yBottom: 0,
|
||||
scale: 1,
|
||||
isMobile: false,
|
||||
zIndex: 1,
|
||||
type: widget.type,
|
||||
widgetValue: '',
|
||||
options: widget.type === 'signature' ? signOpt : widget.options,
|
||||
Width: widget.w,
|
||||
Height: widget.h,
|
||||
xPosition: widget.x,
|
||||
yPosition: widget.y,
|
||||
};
|
||||
|
||||
if (page) {
|
||||
|
||||
@@ -123,7 +123,7 @@ export default async function createTemplate(request, response) {
|
||||
}
|
||||
return response.json({
|
||||
objectId: res.id,
|
||||
url: baseUrl.origin + '/load/signmicroapp/template/' + res.id,
|
||||
url: baseUrl.origin + '/template/' + res.id,
|
||||
});
|
||||
} else {
|
||||
return response.status(405).json({ error: 'Invalid API Token!' });
|
||||
|
||||
@@ -129,23 +129,20 @@ export default async function createTemplatewithCoordinate(request, response) {
|
||||
for (const widget of signer.widgets) {
|
||||
const pageNumber = widget.page;
|
||||
const page = placeHolder.find(page => page.pageNumber === pageNumber);
|
||||
|
||||
const signOpt = { name: 'signature', status: required };
|
||||
const widgetData = {
|
||||
xPosition: widget.x,
|
||||
yPosition: widget.y,
|
||||
isStamp: widget.type === 'stamp',
|
||||
key: randomId(),
|
||||
isDrag: false,
|
||||
firstXPos: widget.x,
|
||||
firstYPos: widget.y,
|
||||
yBottom: 0,
|
||||
scale: 1,
|
||||
isMobile: false,
|
||||
zIndex: 1,
|
||||
type: widget.type,
|
||||
widgetValue: '',
|
||||
options: widget.type === 'signature' ? signOpt : widget.options,
|
||||
Width: widget.w,
|
||||
Height: widget.h,
|
||||
xPosition: widget.x,
|
||||
yPosition: widget.y,
|
||||
};
|
||||
|
||||
if (page) {
|
||||
|
||||
@@ -14,6 +14,7 @@ export default async function draftDocument(request, response) {
|
||||
const SendinOrder = request.body.sendInOrder || false;
|
||||
// console.log('fileData ', fileData);
|
||||
const protocol = customAPIurl();
|
||||
const baseUrl = new URL(process.env.SERVER_URL);
|
||||
|
||||
try {
|
||||
const reqToken = request.headers['x-api-token'];
|
||||
@@ -135,7 +136,7 @@ export default async function draftDocument(request, response) {
|
||||
}
|
||||
return response.json({
|
||||
objectId: res.id,
|
||||
url: protocol + '/load/signmicroapp/placeholdersign/' + res.id,
|
||||
url: `${baseUrl.origin}/placeholdersign/${res.id}`,
|
||||
});
|
||||
} else {
|
||||
if (request.posthog) {
|
||||
|
||||
Reference in New Issue
Block a user