PackagePackagetypeA library you install and call yourself.See every one →What this type is →by a community orgby a community orgoriginPublished by a community organisation, so it outlives any one maintainer.See every one →

open-abap-pdf

A 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.

Builds a PDF in ABAP code with no other component: zcl_open_abap_pdf=>create( ) opens a document, add_page adds pages in A4, Letter or a custom size, text is set in Helvetica, Times-Roman or Courier, and lines, rectangles and circles are drawn in RGB colours, with each call returning the instance so they chain. render( ) returns the document as a string and render_binary( ) as an xstring. Every element is placed at coordinates the caller gives in points, with helpers that convert millimetres and inches, and the README says nothing about sending the result to a printer or a spool, which stays with the application. The README states the plan of running the same code on classic ECC, classic and embedded "Steampunk" and transpiled under open-abap, and open-abap.org lists it among its general-purpose, multi-target libraries.

Facts

Last pushLicenceMIT

Where it sits

Lives in
Provides
Document outputABAPDocument outputcapabilityProducing a document a person receives — a printed form, a generated PDF, a filled template — and getting it to a printer or a queue rather than returning it as a payload.

Who is behind it

open-abapopen-abapOrganisationMaintains this
In the atlas: maintains 9
@open-abap
maintainerLars HvamPersonContributes to this
In the atlas: maintains 13, contributes to 92, wrote 1
@larshp
1 contributor

What it declares

Every artifact

Type
Package
Origin
By a community org

As a package

Where it runs
does not say
Distributed through
does not say

Connections1

README

quoted from open-abap/open-abap-pdf under MIT, read
open-abap/open-abap-pdf/README.mdOn GitHub

open-abap-pdf

Standalone PDF generation in ABAP

Pull requests welcome

Plan is to have the same code run on:

  • Classic ECC
  • Classic Steampunk
  • Embedded Steampunk
  • open-abap/transpiled

Features

  • Create multi-page PDF documents
  • Add text with customizable fonts (Helvetica, Times-Roman, Courier)
  • Set text, draw, and fill colors (RGB)
  • Draw shapes: lines, rectangles, circles
  • Fluent API for method chaining
  • Support for A4, Letter, and custom page sizes
  • Unit conversion helpers (mm to points, inches to points)

Usage

Basic Example
DATA(lo_pdf) = zcl_open_abap_pdf=>create( ).
lo_pdf->add_page( ).
lo_pdf->set_font( iv_name = 'Helvetica' iv_size = 24 ).
lo_pdf->text( iv_x = 50 iv_y = 50 iv_text = 'Hello World!' ).
DATA(lv_pdf_string) = lo_pdf->render( ).
Fluent API
DATA(lv_pdf) = zcl_open_abap_pdf=>create(
  )->add_page(
  )->set_font( iv_name = 'Helvetica' iv_size = 16
  )->set_text_color( iv_r = 0 iv_g = 0 iv_b = 128
  )->text( iv_x = 100 iv_y = 100 iv_text = 'Blue Text'
  )->render( ).
Drawing Shapes
DATA(lo_pdf) = zcl_open_abap_pdf=>create( ).
lo_pdf->add_page( ).

" Draw a line
lo_pdf->line( iv_x1 = 50 iv_y1 = 100 iv_x2 = 200 iv_y2 = 100 ).

" Draw a rectangle (outline)
lo_pdf->rect( iv_x = 50 iv_y = 150 iv_width = 100 iv_height = 50 iv_style = 'D' ).

" Draw a filled rectangle
lo_pdf->set_fill_color( iv_r = 200 iv_g = 200 iv_b = 255 ).
lo_pdf->rect( iv_x = 50 iv_y = 220 iv_width = 100 iv_height = 50 iv_style = 'F' ).

" Draw a circle
lo_pdf->circle( iv_x = 300 iv_y = 200 iv_radius = 40 iv_style = 'DF' ).

DATA(lv_pdf) = lo_pdf->render( ).
Multiple Pages
DATA(lo_pdf) = zcl_open_abap_pdf=>create( ).

lo_pdf->add_page( ).
lo_pdf->set_font( iv_name = 'Helvetica' iv_size = 24 ).
lo_pdf->text( iv_x = 50 iv_y = 50 iv_text = 'Page 1' ).

lo_pdf->add_page( ).
lo_pdf->text( iv_x = 50 iv_y = 50 iv_text = 'Page 2' ).

DATA(lv_pdf) = lo_pdf->render( ).
Custom Page Size
" Letter size
lo_pdf->add_page(
  iv_width  = zcl_open_abap_pdf=>c_letter_width
  iv_height = zcl_open_abap_pdf=>c_letter_height ).

" Custom size in mm (converted to points)
lo_pdf->add_page(
  iv_width  = zcl_open_abap_pdf=>mm_to_pt( 100 )
  iv_height = zcl_open_abap_pdf=>mm_to_pt( 150 ) ).

API Reference

Class Methods
MethodDescription
create( )Creates a new PDF document instance
mm_to_pt( iv_mm )Converts millimeters to points
inch_to_pt( iv_inch )Converts inches to points
Instance Methods
MethodDescription
add_page( iv_width, iv_height )Adds a new page (default A4)
set_font( iv_name, iv_size )Sets the current font
set_text_color( iv_r, iv_g, iv_b )Sets text color (RGB 0-255)
set_draw_color( iv_r, iv_g, iv_b )Sets line/stroke color
set_fill_color( iv_r, iv_g, iv_b )Sets fill color
set_line_width( iv_width )Sets line width
text( iv_x, iv_y, iv_text )Draws text at position
line( iv_x1, iv_y1, iv_x2, iv_y2 )Draws a line
rect( iv_x, iv_y, iv_width, iv_height, iv_style )Draws a rectangle
circle( iv_x, iv_y, iv_radius, iv_style )Draws a circle
render( )Returns PDF as string
render_binary( )Returns PDF as xstring
get_page_count( )Returns number of pages
get_page_width( )Returns current page width
get_page_height( )Returns current page height
Constants
ConstantValueDescription
c_pt_per_mm2.83465Points per millimeter
c_a4_width595.28A4 width in points
c_a4_height841.89A4 height in points
c_letter_width612Letter width in points
c_letter_height792Letter height in points
Shape Styles
StyleDescription
DDraw outline only (default)
FFill only
DF or FDDraw outline and fill

Supported Fonts

  • Helvetica (default)
  • Times-Roman
  • Courier
MIT, read
Document output
  1. abap2xlsxLibrary that reads and generates Excel spreadsheets from ABAPfrom ABAP
  2. zcl_docxABAP class filling a tagged Word .docx template with datafrom ABAP
  3. zcl_pdfStandalone ABAP class drawing PDFs without Adobe Document Serverfrom ABAP
  4. XTTABAP template engine for Excel, Word, HTML and PDFfrom ABAP
  5. SAP Forms Service by AdobeAdobe Document Services on BTP for print and interactive PDFsfrom BTP/BAIP
  6. SAP Print servicePrint queues between cloud applications and local printersfrom BTP/BAIP
  7. @cap-js/printPrints documents held in CAP entities through SAP Print servicefrom CAP
  8. HandlebarsABAPSingle-file Handlebars templating for ABAP 7.40 SP02 and upfrom ABAP
  9. @salvatorela/cap-plugin-adobe-formsCAP plugin wrapping the SAP Forms service by Adobe on BTPfrom CAP
  10. SAP Spool PDFSubmits an ABAP report to the spool and converts the output to PDFfrom ABAP

Details

Sources3
Added by handdiscovered herechecked
github.com/open-abap/open-abap-pdftree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

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
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainabap, integration-and-messaging
abaplint
issues under its own abaplint configuration0
lines910
statements648
objects3
files5
analysed, main
abaplint version2.120.84
Flavors2
Standard ABAP
“Multi-target ABAP libraries. Run on ECC + Steampunk + Node.js” — open-abap.orgchecked
ABAP Cloud
“Multi-target ABAP libraries. Run on ECC + Steampunk + Node.js” — open-abap.orgchecked
Contributors1

From the repository’s contributor list, .

History in the atlas1
  1. First seen.
For your agent
Ref
artifact:open-abap-open-abap-pdf
JSON
/artifacts/open-abap-open-abap-pdf.json
MCP
Connecting an agent