
npm install -g yo
npm install -g generator-saphanaacademy-mta
const {ADSRenderRequestApi} = require('./external/CF_ADSRestAPI/CF_ADSRestAPI/ads-render-request-api')
const { StoreFormsApi } =require('./external/CF_ADSRestAPI/CF_ADSRestAPI/store-forms-api')
app.get('/srv/ads/adsforms', function (req, res) {
if (req.authInfo.checkScope('$XSAPPNAME.User')) {
// res.setHeader()
StoreFormsApi.formGet('labelprint').execute({ destinationName:'ads-rest-api' }).then(data=>{res.status(200).json(data)}).catch(err=>{res.status(200).json(err)});
} else {
res.status(403).send('Forbidden');
}
});
app.get('/srv/ads/render',function(req,res){
if (req.authInfo.checkScope('$XSAPPNAME.User')){
const data = "<form1><LabelForm><DeliveryId>8000311</DeliveryId> <Position>0010</Position> <MaterialNo>M100001</MaterialNo><Quantity>123456.321</Quantity> <Package>P111111</Package><QRCode>01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789</QRCode></LabelForm></form1>"
const bodyE = new Buffer(data).toString('base64')
renderinput = {
"embedFont": 0,
"formLocale": "en_US",
"formType": "print",
"taggedPdf": 1,
"xdpTemplate": "labelprint/PrintLabel",
"xmlData": bodyE
}
const queryP = { templateSource: 'storageName', TraceLevel: 1 }
ADSRenderRequestApi.renderingPdfPost(renderinput,queryP).execute({destinationName:'ads-rest-api' }).then(pdf=>{res.status(200).json(pdf.fileContent)}).catch(err=>{res.status(500).send(err)})
}else{
res.status(403).send('Forbidden');
}
})
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
18 | |
14 | |
11 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 |