zcl_pdf
A 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.
Generating a PDF from ABAP without Adobe Document Server (ADS) means relying on the ABAP stack's built-in, non-ADS capabilities, which the maintainer found very limited on a project. zcl_pdf is a standalone alternative for when ADS is not available: it writes text in the Helvetica, Times or Courier built-in fonts, measures text strings, fits text into a box at the largest size that still fits, draws rectangles, and returns the PDF as a raw string to store, send as an HTTP response or show in SAP GUI. It supports only the basic functionality the maintainer needed, though adding more is described as fairly simple. There is no package to install: the class is created by hand and the source pasted into it.
Facts
Where it sits
Who is behind it
In the atlas: maintains 1, contributes to 1@beraadimmaintainerAboContributes to this
In the atlas: contributes to 8@AndreaBorgia-AboLars HvamContributes to this
In the atlas: maintains 13, contributes to 92, wrote 1@larshp2 contributors
What it declares
Every artifact
- Type
- Package
- Origin
- Independently maintained
As a package
- Where it runs
- Inside its host
- Distributed through
- Copied into the project
Connections
Producing printed forms, PDFs and filled templates for people
Download
README
quoted from beraadim/zcl_pdf under MIT, readzcl_pdf
A pure stand alone ABAP class for creating PDFs in SAP on any ABAP system
I created this class on my spare time on one of my projects. We ended up using the class in the project instead of using the built in (non ADS ) capabilities in the abap stack which is very limited. IF you want more flexibility, your option is usually to go for ADS (Adobe Document Server). If ADS is not available, this class could be an alternative.
The class supports only basic functionality which I needed at the time, but it should be fairly simple to add more.
Currently, the class is capable of:
- Create text in the PDF built in fonts
- Helvetica
- Times
- Courier
- Measure text strings (for the supported fonts)
- Fit text within a defined box constrain with largest possible font size
- Draw rectangles
- Get the PDF as a raw string which can be stored as files or sent as http responses or shown directly in SAP GUI (see example).
To use:
- Create a class named ZCL_PDF
- Change to "Source Code Based" editing
- Past in the code from the file zcl_abap.abap
- Activate class
You can switch back to Form based coding if that is what you prefer.
To test: See the report ZTEST_ZCL_PDF to see an example on how create a simple pdf and display the pdf within SAP GUI.
Others providing
Compare all 8 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 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 data
- 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 PDF
- 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 PDFs
- 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 up
- 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 ABAP
- 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 PDF
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
abaplint
Flavors
“Get the PDF as a raw string which can be stored as files or sent as http responses or shown directly in SAP GUI (see example).” — beraadim/zcl_pdf — README
History in the atlas
- First seen.
For your agent
- Ref
artifact:beraadim-zcl-pdf- JSON
- /artifacts/beraadim-zcl-pdf.json
- MCP
- Connecting an agent