‎2006 Oct 02 10:39 PM
I am converting the report documentation into PDF. It all works fine but the print format from PDF is very very small. I am not using SMARTFORMS but rather calling FM to get the report documentation and then converting into PDF. I am attaching the code below, please run the code and you will understand what i mean when you try to print from the converted PDF file. Please give me some suggestion, solution, or sample code. It will be appreciated.
Thanks
Nahman
*Start of code
ATA: header LIKE thead,
options LIKE itcpo.
DATA: lines LIKE tline OCCURS 0 WITH HEADER LINE,
otfdata LIKE itcoo OCCURS 0 WITH HEADER LINE,
pdflines LIKE tline OCCURS 0 WITH HEADER LINE,
doc_itab LIKE docs OCCURS 0 WITH HEADER LINE,
binfilesize TYPE i,
filenm TYPE string.
PARAMETERS: program LIKE trdir-name OBLIGATORY,
filenam LIKE rlgrap-filename DEFAULT 'c:\temp\pdftest.pdf'.
START-OF-SELECTION.
CALL FUNCTION 'DOC_OBJECT_GET'
EXPORTING
class = 'RE'
name = program
language = sy-langu
IMPORTING
header = header
TABLES
itf_lines = lines
EXCEPTIONS
object_not_found = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
options-tdgetotf = 'X'.
options-tdprogram = 'SAPLSHL2'.
options-tddest = 'LP01'.
CALL FUNCTION 'PRINT_TEXT'
EXPORTING
application = 'TD'
device = 'PRINTER'
dialog = ' '
header = header
OPTIONS = options
TABLES
lines = lines
otfdata = otfdata
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
REFRESH lines.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = binfilesize
TABLES
otf = otfdata
lines = pdflines
.
IF sy-subrc <> 0.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = binfilesize
filename = filenm
filetype = 'BIN'
TABLES
data_tab = pdflines[]
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
‎2006 Oct 02 10:42 PM
‎2006 Oct 02 11:01 PM
That's because, PRINT_TEXT fm not inserting any page breaks, and PDF converter is not separating the spool in to different pages. Work around is, in the adobe reader print window, select None in Page scalling field.
Regards
Sridhar