Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
stefan_schnell
Active Contributor
0 Kudos
I presented here a wrapper class for the Quick PDF Library Lite from Debenu. You can download here a wrapper class for the actual Quick PDF Library with wrapper methods for all functionalities of the library. You can download an evaluation version of the library here - it is without any restrictions, but for 30 days. So it is absolut easy to create any kind of PDF document.

Here an example:
"-Begin-----------------------------------------------------------------
Program zTest.

"-Variables---------------------------------------------------------
Data PDF Type Ref To zDebenuPDFLibraryAX1115.
Data LibraryVersion Type String.
Data LicenseInfo Type String.
Data OutText Type String.
Data rc Type Integer.

"-Main--------------------------------------------------------------
OutText = 'Hello World from ABAP'.
OutText = OutText && cl_abap_char_utilities=>cr_lf.
OutText = OutText && 'Hello World from ABAP again'.

Create Object PDF.
If PDF->LoadLib( ) = 1.

PDF->LibraryVersionEx( Importing Result = LibraryVersion ).
Write: / `Library version: `, LibraryVersion.

PDF->LicenseInfo( Importing Result = LicenseInfo ).
Write: / `Valid license key: `, LicenseInfo.

PDF->SetMeasurementUnits(
Exporting MeasurementUnits = 1 ). "Millimetres
PDF->SetPageSize( Exporting PaperName = 'A4' ).
PDF->SetOrigin( Exporting Origin = 1 ). "Top Left

PDF->AddStandardFont( Exporting StandardFontID = 0 ). "Courier
PDF->SetTextSize( Exporting TextSize = 15 ).
PDF->SetTextColor( Exporting Red = '0.9' Green = '0.2' Blue = '0.5' ).

PDF->DrawTextBox(
Exporting Left = 50 Top = 50 Width = 100 Height = 25
Text = OutText Options = 1 ). "Vertical alignment top

PDF->SetInformation( Exporting Key = 1 "Set author
NewValue = 'Stefan Schnell' ).
PDF->SetInformation( Exporting Key = 2 "Set title
NewValue = 'ABAP Test' ).

PDF->SaveToFile(
Exporting FileName = 'C:\Dummy\Test.pdf'
Importing Result = rc ).
If rc = 0.
Message 'The PDF file could not be created' Type 'I'.
EndIf.

PDF->FreeLib( ).
EndIf.

"-End-------------------------------------------------------------------


Hint:
The example is the same as for PDF Quick Library Lite, with a few additions. The reason is that PDF Quick Library Lite is a subset of PDF Quick Library, with the exception that you must specify a license key.
1 Comment