@cap-js/print
A CDS plugin that prints a document held in a CAP entity, through SAP Print serviceSAP Print servicePrint queues between cloud applications and a customer's local printers: an application queries queues and creates print queue items through public APIs, and the queues are managed in the service.sap official, btp and a @PDF.Printable annotation.
A CAP service that holds a document as a LargeBinary has no way of getting it onto one of the customer's local printers. Annotating an entity @PDF.Printable adds a print action taking a queue name and a number of copies, generates the handler behind it, and adds PrintServiceQueues and PrintServiceFiles entities so the queue and the file appear as value helps in the UI. The attribute to be printed must already carry @Core.ContentDisposition; producing the document is no part of this. The queues and the link to the printers are SAP Print serviceSAP Print servicePrint queues between cloud applications and a customer's local printers: an application queries queues and creates print queue items through public APIs, and the queues are managed in the service.sap official, btp's, and using the plugin requires a subscription to it. Run locally without one and the service is mocked, with the job written to the console. For files generated at runtime, or a file type other than PDF, cds.connect.to("PrintService") invokes the same print action without the annotation.
Facts
Where it sits
Who is behind it
In the atlas: maintains 34@cap-jsmaintainerChristian GeorgiContributes to this
In the atlas: maintains 1, contributes to 53@chgeoGuilherme DellagustinContributes to this
In the atlas: contributes to 27@dellagustin-sapBenny MeiContributes to this
In the atlas: contributes to 1@laniakea2006Lisa Julia NebelContributes to this
In the atlas: contributes to 15@lisajuliaMarten SchiwekContributes to this
In the atlas: contributes to 16@schiwekMSimon EngelContributes to this
In the atlas: contributes to 14, wrote 4@SirSimon046 contributors
Before choosing this
Conditions
LicenceSAP Developer License Agreement 3.2 CAP§ 1, 2, 3A cds-plugin is used with SAP CAP materials, or an artifact is explicitly identified as a CAP plugin or application.
- § 1 License. Productive customer applications are limited to SAP BTP or another SAP-licensed platform, and mass extraction to a non-SAP product is restricted except where solely required for SAP interoperability.
- § 2 Intellectual Property. The agreement retains SAP's rights in the covered materials and limits making APIs, tools or software available to third parties, while preserving ownership of customer applications subject to SAP's underlying rights.
- § 3 Artificial Intelligence Training. The agreement prohibits use of the covered materials and customer applications for training artificial-intelligence models or systems.
What it declares
Every artifact
- Type
- CDS plugin
- Origin
- By SAP
- Runtime
- Node.js
As a CDS plugin
- Declared for
- >= 9
- Multitenancy
- safe
- Distributed through
- does not say
Connections
Producing printed forms, PDFs and filled templates for people
Print queues between cloud applications and local printers
Print queues between cloud applications and local printers
Download
Install
npm add @cap-js/printDerived from the package name. No recipe recorded; the README has the configuration.
Where it sits in your app
Download
README
quoted from cap-js/print under Apache-2.0, readWelcome to @cap-js/print
About this project
The @cap-js/print package is a CDS plugin that provides print service features through integration with the SAP Print Service.
Table of Contents
Requirements and Setup
Using this plugin requires a valid subscription of the SAP Print Service.
Usage
To use this plugin to print documents, there are two main steps:
- Ensure your model meets the requirements
- Annotate your CDS model with
@PDF.Printable
Model Requirements
- The attribute(s) you want to print are of type
LargeBinary - Those attributes have the annotation
@Core.ContentDisposition: fileName, wherefileNameis the attribute that specifies the file name or a hardcoded string with the file name
Annotations in CDS model
To use the print plugin, annotate your entity with @PDF.Printable:
@PDF.Printable
entity Books as projection on my.Books;
This annotation does the following things in the background:
- Adds an action
printto the annotated entity with the following parameters:Queue: Name of the print queue to use.Copies: Number of copies to print.File: Only added if the entity has multipleLargeBinaryattributes. Allows selecting which file should be printed. Ensure that theLargeBinaryproperties are annotated with@Common.Label.
- This action is added to the UI and a handler is generated to process the print request.
- An entity
PrintServiceQueuesis added to the service to provide available print queues in a value help. - An entity
PrintServiceFilesis added to the service to provide available files in a value help (only if multipleLargeBinaryattributes exist).
Manual Usage
You can also use the print service to print documents manually, i.e., without the @PDF.Printable annotations and generated actions and handlers.
Use cases for a manual approach could be:
- You want to print documents that are not part of your CDS model, i.e., files generated at runtime.
- Your model does not meet the requirements for the automatic approach.
- You want to print a file type other than PDF.
For this, you can use the cds.connect.to API of CAP to connect to the print service and invoke the print action manually.
const printService = cds.connect.to("PrintService");
await printService.send("print", {
qname: "Printer_Queue_Name",
numberOfCopies: 1,
docsToPrint: [
{
fileName: "file_name.pdf",
content: "<base64-encoded-pdf-content>",
isMainDocument: true,
},
],
});
const queues = await printService.get("/Queues");
It is possible that for LargeBinaries retrieved from the database, the content is provided as a stream. In this case, the stream needs to be converted to base64 before passing it to the print service. For example, see the sample application in test/bookshop/
Local Development
When running the application locally, the print service is mocked. This mock implementation prints the print job details to the console instead of sending them to the actual print service. It also provides a number of sample print queues for selection.
Hybrid Testing
You can also run the application locally with a binding to the cloud print service with CAP profiles. For more information, see Hybrid Testing. You need an instance of the SAP Print Service.
Local
As the hybrid profile of the plugin uses SAP HANA Cloud to execute integration tests in CI, a profile local is added that can be used to execute the application locally with a binding to the cloud print service.
# Once as setup
cd test/bookshop
cds bind -2 <print-service-instance-name> -4 local
# Run the application (from the root)
npm run watch-sample:local
CI
For CI, the hybrid integration tests are automatically run against a SAP Print Service instance and a SAP HANA Cloud instance created for testing purposes.
Support, Feedback, Contributing
This project is open to feature requests/suggestions, bug reports, etc. via GitHub issues. Contributions and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines.
Security / Disclosure
If you find a bug that may be a security problem, please follow the instructions in our security policy on how to report it. Please do not create GitHub issues for security-related doubts or problems.
Code of Conduct
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its Code of Conduct at all times.
Licensing
Copyright 2025 SAP SE or an SAP affiliate company and print contributors. Please see our LICENSE for copyright and license information. Detailed information, including third-party components and their licensing/copyright information, is available via the REUSE tool.
History
Features 1
Notes
Added
- Translations for UI labels and messages
Features 2, Fixes 3
Notes
Added
- Multitenancy support
- Support for
@Core.ContentDisposition.Filenameto specify filename
Fixed
- Draft enabled entities can be print enabled
- Entities with composite keys can be print enabled
- File upload during printing is now formatted correctly
Features 1
Notes
Added
- Initial release that provides out-of-the-box integration with the SAP Print Service.
Others providing
Compare all 11 on the Document output page →- abap2xlsxabap2xlsxA library that reads and generates .xlsx Excel workbooks directly from ABAP data, without exporting through a list viewer, installed through abapGit and tested from SAP_ABA 731.independent, abapLibrary that reads and generates Excel spreadsheets from ABAPfrom ABAP
- zcl_docxzcl_docxAn ABAP class that fills a Word .docx template tagged with content controls, with a report, ZDOCX_GET_TYPES, that generates the ABAP types the template needs; the document opens in Word or returns as an xstring.independent, abapABAP class filling a tagged Word .docx template with datafrom ABAP
- zcl_pdfzcl_pdfA standalone ABAP class that draws simple PDFs without Adobe Document Server: text in built-in fonts, text fitted into a box and rectangles, returned as a raw string to store, send or display.independent, abapStandalone ABAP class drawing PDFs without Adobe Document Serverfrom ABAP
- XTTXTTAn ABAP template engine that merges data, including nested structures, tables and trees, into Excel, Word, HTML and PDF templates prepared in ordinary editors with markers in curly brackets.independent, abapABAP template engine for Excel, Word, HTML and PDFfrom ABAP
- SAP Forms Service by AdobeSAP Forms Service by AdobeAdobe Document Services on BTP: renders print and interactive PDF forms from stored templates, called over a REST API from a cloud application or connected to an ABAP system.sap official, btpAdobe Document Services on BTP for print and interactive PDFsfrom BTP/BAIP
- SAP Print serviceSAP Print servicePrint queues between cloud applications and a customer's local printers: an application queries queues and creates print queue items through public APIs, and the queues are managed in the service.sap official, btpPrint queues between cloud applications and local printersfrom BTP/BAIP
- HandlebarsABAPHandlebarsABAPA single-file Handlebars templating implementation for ABAP 7.40 SP02 and up that fills a template from an ABAP structure or table, with block helpers, partials and custom helpers.independent, abapSingle-file Handlebars templating for ABAP 7.40 SP02 and upfrom ABAP
- open-abap-pdfopen-abap-pdfA standalone PDF generator written in ABAP that builds a multi-page document from text, lines, rectangles and circles placed at given coordinates and returns it as a string or an xstring.community org, abapStandalone PDF generator written in ABAPfrom ABAP
- @salvatorela/cap-plugin-adobe-forms@salvatorela/cap-plugin-adobe-formsA CAP plugin that wraps the SAP Forms service by Adobe on BTP as a CAP service, rendering a PDF from a form template with credentials from a destination or direct configuration.independent, capCAP plugin wrapping the SAP Forms service by Adobe on BTPfrom CAP
- SAP Spool PDFSAP Spool PDFAn ABAP class that submits a report to the spool, typically in the background, and converts the resulting spool request into a PDF it can return as an xstring, save, show or email.independent, abapSubmits an ABAP report to the spool and converts the output to PDFfrom ABAP
Details
Sources
Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.
Compatibility and provenance
History in the atlas
- A CDS plugin that prints a document held in a CAP entity, through [SAP Print service](artifact:btp-print) and a `@PDF.Printable` annotation.
- A CAP service that holds a document as a `LargeBinary` has no way of getting it onto one of the customer's local printers.
- The README states the subscription requirement plainly and package.json binds a vcap service labelled print, but neither edge existed, so the service the plugin cannot print without was invisible from its page. SAP Print service entered the graph on 2026-09-15, after this entry was written.
- runtimes: node, cds_range: >= 9, multitenancy: safe
- capability:document-output, with what_it_does and sources
- 0.2.0, 0.2.1
- First seen.
For your agent
- Ref
artifact:cap-js-print- JSON
- /artifacts/cap-js-print.json
- MCP
- Connecting an agent