If anyone could enhance it, say adding a JPEG file into a PDF... then
it will be a big help to "open source" Cobol developers. Here it is;
identification division.
program-id. TxtApdf.
environment division.
input-output section.
file-control.
select Textfle-archive assign to TextArchive-name
organization line sequential
file status fileStatTxt.
select PDFfle-archive assign to PdfArchive-name
organization line sequential
file status fileStatPdf.
Data division.
File section.
fd Textfle-archive.
01 RegTxt pic X(240).
fd PDFfle-archive.
01 RegPdf pic X(255).
working-storage section.
01 wValues.
03 B pic 9(3).
03 L pic 9(3).
03 P pic 9(3).
03 X pic 9(4).
03 Y pic 9(3).
03 PA pic zzzz.99.
03 PL pic zzzz.99.
03 Nro18 pic z(18).
03 Pagemeter pic zzzz.
03 fileStatTxt pic x(2).
03 fileStatPdf pic x(2).
03 EndSw pic x.
03 TextArchive-name pic x(50).
03 PdfArchive-name pic x(50).
03 XrefDelObj pic 9(10) occurs 2000.
03 NroObj pic 9(5).
03 NroObjPage pic 9(5) occurs 2000.
03 StreamAccum pic 9(9).
03 PageAccum pic 9(9).
03 XrefAccum pic 9(9).
03 PageSum pic 9(5).
03 LinesPerPage pic 9(5).
03 LineLength pic 9(5).
03 ObjTypeOutlines pic 9(5).
03 ObjTypeFont pic 9(5).
03 ObjTypePages pic 9(5).
03 ObjProcSet pic 9(5).
03 ObjTypeCatalog pic 9(5).
*linkage section.
01 wLink-vars.
03 PageCateg-link pic 9.
03 Inputtxt-link pic x(50).
03 PDFtxt-link pic x(50).
03 PageOrientation pic x. *>H/V Horiz/Vertical
03 LinePerPage-link pic 9(5). *>in decimal
03 PointSize-link pic 99. *>in points
03 HorizPointScale-link pic 999. *>in percent
03 SpaceEntryChar-link pic xxxx. *>space entry char
03 SpaceEntryLine-link pic 9(3). *>in points
03 LeftMargin-link pic 9(4). *>in points
03 TopMargin-link pic 9(4). *>in points
03 PageWidth-link pic 9(4)v99. *>in points
03 PageLength-link pic 9(4)v99. *>in points
03 Titleslink. *>title
05 Title-link pic x(240) occurs 5.
procedure division.
*>--------------------------------------------------------------
perform TestPage-lengthCateg
initialize wValues
move Inputtxt-link to TextArchive-name
move PDFtxt-link to PdfArchive-name
open output PDFfle-archive
perform Start-procedure
perform Go-initial-page
open input Textfle-archive
perform until fileStatTxt not = "00"
read Textfle-archive next
not at end
if LinesPerPage = LinePerPage-link
perform Go-finalize-page
perform Go-initial-page
end-if
inspect RegTxt replacing all "(" by "{"
all ")" by "}"
all "\" by " "
move RegTxt to RegPdf
perform Count-lengthAcc
move spaces to RegPdf
if LineLength > 0
string "(" RegTxt(1:LineLength) ") Tj T*"
into RegPdf
else
move "( ) Tj T*" to RegPdf
end-if
perform Count-WriteAcc
add 1 to LinesPerPage
end-read
end-perform
perform Go-finalize-page
close Textfle-archive
perform Endof-PageWrite
close PDFfle-archive
exit program.
stop run.
*>--------------------------------------------------------------
Start-procedure.
move 1 to NroObj
move "%PDF-1.4" to RegPdf
perform Count-WriteAcc
perform Start-Object
move spaces to RegPdf
move "<< /Author (Anonymous) >>" to RegPdf
perform Count-WriteAcc
perform Finalize-Object.
*>--------------------------------------------------------------
Go-initial-page.
add 1 to PageSum
move PageSum to Pagemeter
add 1 to NroObj
move NroObj to NroObjPage (PageSum)
perform Start-Object
move "<< /Length " to regPdf
compute Nro18 = NroObj + 1
perform Long-baseProc
move Nro18(B:L) to RegPdf(12:L)
move " 0 R >>" to regPdf((L + 12):7)
perform Count-WriteAcc
move "stream" to regPdf
perform Count-WriteAcc
move "BT" to regPdf
perform Count-WriteAcc
move "/F1 " to regPdf
move PointSize-link to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf(5:L)
move " Tf" to regPdf((L + 5):3)
perform Count-WriteAcc
move spaces to RegPdf
move LeftMargin-link to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf(1:L)
move L to P
compute Nro18 = PageLength-link - TopMargin-link
perform Long-baseProc
move Nro18(B:L) to RegPdf((P + 2):L)
move " Td" to regPdf(((L + P + 2)):3)
perform Count-WriteAcc
move spaces to RegPdf
move SpaceEntryLine-link to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf
move " TL" to regPdf((L + 1):3)
perform Count-WriteAcc
move spaces to RegPdf
move HorizPointScale-link to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf
move " Tz" to regPdf((L + 1):3)
perform Count-WriteAcc
move spaces to RegPdf
string SpaceEntryChar-link " Tc" into RegPdf
perform Count-WriteAcc
if PageOrientation = "h" or "H"
string "0 1 -1 0 "
TopMargin-link " "
LeftMargin-link " Tm"
into RegPdf
perform Count-WriteAcc
end-if
move 0 to LinesPerPage
perform varying y from 1 by 1 until y > 5
if Title-link (y) not = spaces
move Title-link (y) to RegPdf
perform Count-lengthAcc
move spaces to RegPdf
string "(" Title-link(y)(1:LineLength) ") Tj T*"
into RegPdf
inspect RegPdf replacing all "####" by Pagemeter
perform Count-WriteAcc
add 1 to LinesPerPage
end-if
end-perform.
*>--------------------------------------------------------------
Go-finalize-page.
move "ET" to regPdf
perform Count-WriteAcc
move PageAccum to StreamAccum
move "endstream" to regPdf
perform Count-WriteAcc
perform Finalize-Object
add 1 to NroObj
perform Start-Object
move StreamAccum to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf
perform Count-WriteAcc
perform Finalize-Object
move 0 to PageAccum.
*>--------------------------------------------------------------
Endof-PageWrite.
add 1 to NroObj
move NroObj to ObjTypeOutlines
perform Start-Object
move "<< /Type /Outlines /Count 0 >>" to RegPdf
perform Count-WriteAcc
perform Finalize-Object
add 1 to NroObj
move NroObj to ObjTypeFont
perform Start-Object
move "<< /Type /Font /Subtype /Type1 /Name /F1" to RegPdf
perform Count-WriteAcc
move "/BaseFont /Courier /Encoding /WinAnsiEncoding >>"
*>move "/BaseFont /Courier-Bold /Encoding /WinAnsiEncoding
>>"
to RegPdf
perform Count-WriteAcc
perform Finalize-Object
add 1 to NroObj
move NroObj to ObjTypePages
perform Start-Object
move "<< /Type /Pages /Kids [" to RegPdf
perform Count-WriteAcc
perform varying y from 1 by 1 until y > PageSum
compute Nro18 = NroObj + 1 + y
perform Long-baseProc
move Nro18(B:L) to RegPdf
move " 0 R" to regPdf((L + 1):4)
perform Count-WriteAcc
end-perform
move "]" to RegPdf
perform Count-WriteAcc
move "/Count " to regPdf
move PageSum to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf(8:L)
move " >>" to regPdf((L + 8):3)
perform Count-WriteAcc
perform Finalize-Object
add 1 to NroObj
move NroObj to ObjProcSet
perform Start-Object
move "<< /ProcSet [ /PDF /Text] /Font << "
to RegPdf
perform Count-WriteAcc
move "/F1 " to regPdf
move ObjTypeFont to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf(5:L)
move " 0 R >>" to regPdf((L + 5):7)
perform Count-WriteAcc
move ">>" to RegPdf
perform Count-WriteAcc
perform Finalize-Object
perform varying y from 1 by 1 until y > PageSum
add 1 to NroObj
perform Start-Object
move "<< /Type /Page" to RegPdf
perform Count-WriteAcc
move "/Parent " to regPdf
move ObjTypePages to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf(9:L)
move " 0 R" to regPdf((L + 9):4)
perform Count-WriteAcc
move PageWidth-link to PA
move PageLength-link to PL
move spaces to RegPdf
string "/MediaBox [ 0 0 " PA PL " ]"
into RegPdf
perform Count-WriteAcc
move "/Contents " to regPdf
move NroObjPage (y) to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf(11:L)
move " 0 R" to regPdf((L + 11):4)
perform Count-WriteAcc
move "/Resources " to RegPdf
move ObjProcSet to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf(12:L)
move " 0 R" to RegPdf((L + 12):4)
perform Count-WriteAcc
if PageOrientation = "h" or "H"
move "/Rotate 90" to regPdf
perform Count-WriteAcc
end-if
move " >>" to RegPdf
perform Count-WriteAcc
perform Finalize-Object
end-perform
add 1 to NroObj
move NroObj to ObjTypeCatalog
perform Start-Object
move "<< /Type /Catalog" to RegPdf
perform Count-WriteAcc
move "/Pages " to regPdf
move ObjTypePages to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf(8:L)
move " 0 R" to regPdf((L + 8):4)
perform Count-WriteAcc
move "/Outlines " to regPdf
move ObjTypeOutlines to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf(11:L)
move " 0 R" to regPdf((L + 11):4)
perform Count-WriteAcc
move " >>" to RegPdf
perform Count-WriteAcc
perform Finalize-Object
move "xref" to RegPdf
write RegPdf
add 1 to NroObj
move "0 " to regPdf
move NroObj to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf(3:L)
write RegPdf
move "0000000000 65535 f" to regPdf
write RegPdf
perform varying y from 1 by 1 until y = NroObj
move spaces to RegPdf
string XrefDelObj (y) " 00000 n" into RegPdf
write RegPdf
end-perform
move "trailer" to regPdf
write RegPdf
move "<< /Size " to regPdf
move NroObj to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf(10:L)
write RegPdf
move "/Root " to RegPdf
move ObjTypeCatalog to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf(7:L)
move " 0 R" to regPdf((L + 7):4)
write RegPdf
move "/Info 1 0 R" to RegPdf
write RegPdf
move ">>" to RegPdf
write RegPdf
move "startxref" to RegPdf
write RegPdf
move XrefAccum to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf
write RegPdf
move "%%EOF" to RegPdf
write RegPdf.
*>--------------------------------------------------------------
Start-Object.
move XrefAccum to XrefDelObj (NroObJ)
move NroObj to Nro18
perform Long-baseProc
move Nro18(B:L) to RegPdf
move " 0 obj" to regPdf((L + 1):6)
perform Count-WriteAcc.
*>--------------------------------------------------------------
Finalize-Object.
move "endobj" to regPdf
perform Count-WriteAcc.
*>--------------------------------------------------------------
Count-WriteAcc.
move "N" to EndSw
perform varying x from length of RegPdf by -1
*>perform varying x from 255 by -1
until EndSw = "S"
if RegPdf (x:1) not = space
add x to PageAccum
add x to XrefAccum
move x to LineLength
move "S" to EndSw
write RegPdf
end-if
end-perform.
*>--------------------------------------------------------------
Count-lengthAcc.
move 0 to LineLength
if RegPdf not = space
move "N" to EndSw
perform varying x from length of RegPdf by -1
*>perform varying x from 255 by -1
until EndSw = "S"
if RegPdf (x:1) not = space
move x to LineLength
move "S" to EndSw
end-if
end-perform
end-if.
*>--------------------------------------------------------------
Long-baseProc.
move "N" to EndSw
perform varying x from 1 by 1 until EndSw = "S"
if Nro18(x:1) not = space
move x to B
compute L = 19 - x
move "S" to EndSw
end-if
end-perform.
*>--------------------------------------------------------------
*> This section is only for testing
*>--------------------------------------------------------------
TestPage-lengthCateg.
initialize wLink-vars
move "CobolPDF.txt" to Inputtxt-link *>Txt archive
move "CobolPDF.pdf" to PDFtxt-link *>PDF archive
move 1 to PageCateg-link
evaluate PageCateg-link
when 1 perform 80Column-vertical
when 2 perform 130Column-vertical
when 3 perform 240Column-horizontal
end-evaluate.
perform CreateTextfile-archive.
*>--------------------------------------------------------------
80Column-vertical. *>80 vertical column
move 8 to P *>80 column
move "v" to PageOrientation
move 66 to LinePerPage-link
move 24 to TopMargin-link *>2 lines 24/72
move 12 to LeftMargin-link *> 12/72
move 12 to SpaceEntryLine-link *>6 per inch 12/72
move 10 to PointSize-link *>
move " 1" to SpaceEntryChar-link *>
move 100 to HorizPointScale-link *>percentage
move 595 to PageWidth-link *>A4
move 842 to PageLength-link *>A4
string "Testing of PDF file archive generator "
" Page No.####"
into Title-link (1)
string " col 01 col 02 col 03 col 04"
" col 05 col 06 col 07 col 08"
into Title-link (2)
string "----------------------------------------"
"----------------------------------------"
into Title-link (3).
*>--------------------------------------------------------------
130Column-vertical. *>130 vertical column
move 13 to P
move "v" to PageOrientation
move 66 to LinePerPage-link
move 24 to TopMargin-link *>2 lines 24/72
move 12 to LeftMargin-link *> 12/72
move 12 to SpaceEntryLine-link *>6 per inch 12/72
move 09 to PointSize-link *>
move "-0.9" to SpaceEntryChar-link *>
move 96 to HorizPointScale-link *>percentage
move 595 to PageWidth-link *>A4
move 842 to PageLength-link *>A4
string "Testing of PDF file archive generator "
" "
" "
" Page No.####"
into Title-link (1)
string " col 01 col 02 col 03 col 04"
" col 05 col 06 col 07 col 08"
" col 09 col 10 col 11 col 12"
" col 13"
into Title-link (2)
string "----------------------------------------"
"----------------------------------------"
"----------------------------------------"
"----------"
into Title-link (3).
*>--------------------------------------------------------------
240Column-horizontal. *>240 horiz columns
move 24 to P
move "h" to PageOrientation
move 60 to LinePerPage-link
move 24 to TopMargin-link *> 2 lines 24/72
move 5 to LeftMargin-link *> 5/72
move 09 to SpaceEntryLine-link *>8 per inch 9/72
move 08 to PointSize-link *>
move "-0.8" to SpaceEntryChar-link *>
move 85 to HorizPointScale-link *>percentage
move 595 to PageWidth-link *>A4
move 842 to PageLength-link *>A4
move "Testing of PDF archive generator " to Title-link (1)
move " Page No.####" to Title-link (1)(228:13)
string " col 01 col 02 col 03 col 04"
" col 05 col 06 col 07 col 08"
" col 09 col 10 col 11 col 12"
" col 13 col 14 col 15 col 16"
" col 17 col 18 col 19 col 20"
" col 21 col 22 col 23 col 24"
into Title-link (2)
move all "-" to Title-link (3).
*>--------------------------------------------------------------
CreateTextfile-archive.
move Inputtxt-link to TextArchive-name
open output Textfle-archive
move 0 to x
perform 9999 times
move spaces to RegTxt
add 1 to x
move 0 to y
perform P times
add 1 to y
move y to Nro18
string "L" x " C" Nro18(18:1)
into RegTxt(((y * 10) - 7):8)
end-perform
write RegTxt
end-perform.
close Textfle-archive.
*>--------------------------------------------------------------
> If anyone could enhance it, say adding a JPEG file into a PDF... then
> it will be a big help to "open source" Cobol developers. Here it is;
That is doing it the hard way. Hard graft hand coding everything by
hand and hard graft everytime something needs changing.
It is far better to do it with templating. I create postscript
templates with tgif, a graphics editor. create the merge data in the
Cobol program and then merge the data into the postscript. For a PDF
there is ps2pdf which does this nicely.
Templating keeps the presentation format outside the business logic.
It also gives flexibility, want a different laylout: edit the
template; want XML or CSV or plain text: use a different template....
Templating is not particularly hard to do, and done correctly it can
be reused for many purposes, I used the same called routines to merge
data into HTML, XML, CSV, plain text, postscript (and thus PDF).
I do not know how templating works with it, maybe your approach is
better or as Mr Klein wrote:
"Your style may not be my style" concept.
It would be better if we could lay out the codes for us to see.
I original developed my templating in the early 90s for web based
applications outputting HTML web pages, plain text or CSV. It easily
expanded to do merge data for postscript/PDF, XML, Zerba ZPL, or many
other formats.
One of the techniques used is that the template name can be passed
into the CGI and this can override the default. As the program neither
knows nor cares what the actual output is this can override the
default template and allows the user to choose.
For example: the default template may generate an HTML web page of
some data. Clickable links on that page may be: 'get a CSV copy of
this', and could be 'get a PDF of this data'. These would get the
program to generate the same data but the template name from the link
would be used. The program just generates the data and calls the
template program which just puts the data into the template where the
tags tell it to.
In the case of a Postscript template (which may create a PDF using,
say, pstopdf) I use tgif to draw the required form with whatever
graphics, fonts, as required and the fields into which the data is
merged are input with tag names in markers, eg:
For a simple field: <!%INVOICENO%>
The cobol program has a table which is passed to the template program
(along with other stuff):
01 Tag-Table:
03 Tag-Item OCCURS 200.
05 Tag-Length PIC S99.
05 Tag-Name PIC X(20).
05 Tag-Value PIC X(80).
It could do this by:
ADD 1 TO Tag-Index
MOVE 1 TO Tag-Length(Tag-Index)
MOVE "INVOICENO" TO Tag-Name(Tag-Index)
MOVE Invoice-No TO Tag-Value(Tag-Index)
or a particular program may have the table predefined with preset tag-
names and named identifiers for the values.
For fields that are longer than the tag name these can be spaced out
in width and length:
<!%DELIVERY%------------->
<!>
<!>
<!>
<!>
I have found it important to use a graphics editor that will keep
these fields as contiguous character blocks with the output
postscript. Not all do that.
The templating program reads in the template and substitutes the 'tag-
values' where it finds the 'tag-names'. Of course it is rather more
complicated than that. The template also need to indicate some things
about how the program deals with the template and the data, for
example which charaters need escaping or substituting, whether the
output is fixed position or variable, whether CRLF is needed on the
lines.
But once developed for simple requirements it can be expanded to deal
with additional requirements without rewriting the programs that use
it.
Templating should be a good example of the advantages of OO code. My
Cobol templating programs are not OO, but in other languages (Python)
they are.
With my current Cobol templating it is a dynamic called program and
thus is usable from a number of different applications. It has the
limitation that it can only deal with one templated output at a time,
though it is serially reusable.
The Python templating is OO and this allows the application to output
several types of data by having several template objects, each with a
different template file, and passing the data to each in turn. For
example I automatically process emailed attachments that are
excel .xls files containing delivery jobs. The client enters the data
into a spreadsheet and emails it to the site, the program monitors the
email address and fetches and extracts the attachment. Each row, or a
group of rows with the same code, in the sheet are output to the
transport system using one template while another template is used to
build the reply which lists the jobs processed.
Using conventional called programs this would need to be done with two
passes, or by building a table which is processed at the end. With OO
it is just another instance.
So if you do want to write templating it may be better to use OO.
Thanks Richard. What I did anyway with the 'downloaded' Cobol PDF
creator application is that I bundled it in an OOCobol code. The
following steps below is an example before invoking the OOcode to
create a PDF;
1.0 From a web-browser, the client click on "Print Preview" link
2.0 From COM/EJBs (server-side)
2.1 Create a text document file of the report (file01.TXT) with
"desired" format
2.2 INVOKE the OOcode by passing the created text document
(file01.TXT) and walla!
3.0 Going back to client browser
3.1 Display the created PDF document (file01.PDF)
So from this approach, the concept is very conventional.... simple
document printing on the client side. Nothing fancy or complicated
process, except of course just the creation of a text document report.
Little drawback;
a. the developer will need to create a text file document (or report)
first
b. the OOCobol PDF creator does not incorporate image file (JPEG/GIF/
PNG) for company logo printing
But it works, simple as it is.
It seems to be just putting a simple PDF wrapper around the text file
lines, wouldn't a <pre> ... </pre> do just about the same job of
displaying the text formatted as the program will print it ?
Just like instead of doing file01.TXT to file01.PDF, do it directly
with file01.HTML with a <pre></pre> tags? Nice idea though.
Yes, except that if it's 'within' a PDF document.... the end-user
could not alter the content prior printing a document in a browser.
Some user will cut/paste document content (especially POs) and re-
print it using a Notepad. It is then that you could add security
method to a PDF.
And you can archive every users PDF (printing) file... which of course
you could do it as well in a text file.
Do you think that one cannot copy/paste from PDFs ? Probably not with
Adobe reader, but there are several other PDF readers.
You can, but archiving a PDF copy will not compromise 'control'.
Few things which in most cases happening in a browser-based solution,
and usually we get rid of.
1. Default "File->Print" menu option of the browser. Some browsers has
default margin so you cannot impose the pre-defined format of the
report.
2. In browser-based apps, usually toolbar menus are
'disabled' (especially in IE) and so displaying a PDF file in browser.
So I opted to use PDF displayed report document because of the PDF
reader built-in 'print' button associated with it.
Nor, as you said, will archiving a text copy, or keeping the data in
the database/isam file where it will be directly accessible.
> Few things which in most cases happening in a browser-based solution,
> and usually we get rid of.
>
> 1. Default "File->Print" menu option of the browser. Some browsers has
> default margin so you cannot impose the pre-defined format of the
> report.
>
> 2. In browser-based apps, usually toolbar menus are
> 'disabled' (especially in IE) and so displaying a PDF file in browser.
>
> So I opted to use PDF displayed report document because of the PDF
> reader built-in 'print' button associated with it.
Why not only print directly to their printer and avoid interception
without having to fiddle with their browser ? It is not like you will
have random clients allowed to have POs.
(which I assume you do mean Purchase Orders).
>
> perform 9999 times
> move spaces to RegTxt
> add 1 to x
> move 0 to y
> perform P times
> add 1 to y
> move y to Nro18
> string "L" x " C" Nro18(18:1)
> into RegTxt(((y * 10) - 7):8)
> end-perform
> write RegTxt
> end-perform.
>
> close Textfle-archive.
> *>--------------------------------------------------------------
I'm trying to get this to compile & run under RMCOBOL 85 V6 on an AIX
machine. My compiler is complaining about several things, which I
think I can fix, but this one has me stumped. The compiler does NOT
like using reference modification in the receiving item of the string
statement.
Anyone have a suggestion?
TIA.
Fujitsu doesn't like it either so it is probably a non-standard (85)
extension.
String into another variable (eg 01 work-area pic x(200)) and then
move this to the reference modified receiving area - that will work.
Fujitsu also complained about complete lack of 'delimited by' in the
string statements.
3) Identifier-3 shall not be reference modified.
I have sent a note to PL22.4 suggesting that this restriction be removed, but
don't look for that soon.
P.S. The other note about using STRING to a temporary data item and then moving
that to the reference modified receiving item, is your way around the
restriction.
--
Bill Klein
wmklein <at> ix.netcom.com
"NotSure" <glennpa...@verizon.net> wrote in message
news:8orun4t92bk7hjk39...@4ax.com...
Yes, it is Purchase Orders.
Say a company that has multi-branch or franchises using a browser-
based online application. So franchise in Chicago, and somewhere in
Singapore entering their POs simultaneously using a single ASP/ASPX/
PHP/JSP page.... looking at their screen with different PO entries of
their own sites, then print the PO (their own).
Some online-applications requires ActiveX for them to print from their
printer (client-side) using the information extracted from the IE/
Mozilla browsers.... but then again, it wont be feasible for Linux
users. ActiveX client application can't be installed to a Linux OS.
So browser printing format is needed.... displaying the format in PDF
and directly print it using their "own" client-based printers.
>
> P.S. The other note about using STRING to a temporary data item and then moving
> that to the reference modified receiving item, is your way around the
> restriction.
>
> --
> Bill Klein
> wmklein <at> ix.netcom.com"NotSure" <glennpazzoNO...@verizon.net> wrote in message
>
The PDF Cobol application is compiled using Microfocus NetExpress v3.1
Mr Klein discusses the workaround for those errors in STRING
statement. I'm not sure about how you will do it (shotcuts) in Fujitsu
Cobol or RMCobol 85.
Another good example in printing from the browser;
http://infowaters.infodynamicsconsult.com/iNFOWaters.asp
The browser-based application has "Print" and "Process" buttons. Print
means printing the 'selected' content of the HTML into a local
printer... BUT this application is design for IE only, because it
deploys ActiveX print module application to client browser. It cannot
be used in a Linux-based PC.
Thus the best way is PDF for all Windows/Linux/Mac OSs.
Sorry for my bad english.
There is a second way to build PDF from Cobol if your runtime (any)
can open pipes for output
(typical of all *nix ports, RmCobol, AcuCobol, VSCobol)
Take a look at: http://hpux.connect.org.uk/hppd/hpux/Shells/ClibPDF-2.02/
Free for personal usage, non-free for commercial use.
Using lex i wrote a simple filter capable to capture text report
output from cobol
and generate pdf with
- line
- box
- cirle
- barcodes
- encapsuled JPEG (for logos)
- change color, font
- write as portrait or landscape
- scale all report to A4
- ....
By example, from cobol i put in pipe output
_gbox 1.0 1.0 4.0 8.0
as result in pdf we got one rectangle large 4 inch, height 8 inch,
position 1.0 / 1.0 (starting from left lower border)
What you have to do is
- at beginning of report, or single page, put into pipe (with WRITE
statement)
all directives for drawing your report (by example INVOICE)
- then WRITE to output all data
At beginning of input, and for any occurence of FORM-FEED, filter draw
all your graphics
Final PDF is very good and professional
You can put all directives to a txt file, put it into pipe before
your report, so there is no need to edit your old cobol apps
At end i can
- write to any inkjet/laser from cobol
- send PDF from cobol to mail
- use only white A4 paper
Library comes as sources with a full reference guide
Unlucky i know ClibPDF is not free for commercial use, and authors web
site is not more available (www.fastio.com)
So i have no idea if now this is free software or not.
I am too old for do any more job :-((
It is a great source of input, however it is in C++ and I do not know
how to recode it.
If you will open the created PDF file in Notepad, the content is just
really a simple text document with only a 'PDF' extension name. You
would see the following code;
%PDF-1.4
1 0 obj
<< /Author (Anonymous) >>
endobj
2 0 obj
<< /Length 3 0 R >>
:
:
and so on.
Any other information how could I insert a graphic (JPEG) file within
this PDF document? Been searching Adobe for months but I cant get a
clue how to pipe-in JPEGs into the created text PDF file. Such as
'_gbox 1.0 1.0 4.0 8.0' text pipe in the link that you gave.
Any documentation from Adobe from anywhere else?
Sorry, my English is very poor.
Try to explain better.
What i have done is that:
- i learned ClibPDF reference guide
- wrote a simple LEX source, embedding a litte bit of C++ calling
ClibPDF functions
- obtain one native unix executable (but under MS you can do the same)
- Cobol main program source still remain untouched
my native cobol environment is RM-Cobol85
in cobol source
ASSIGN PRINT-OUT TO "PRINTER"
in rm-cobol configuration file the name "PRINTER" is set to pipe
output to my
unix program ($HOME/bin/cobol2pdf)
Cobol program does the old dirty ascii report;
my filter (cobol2pdf) capture report thru a pipe
as final result we obtain a pdf file, named by default report.pdf,
and send it
by default to mail box of logged user
Now: for graphics, fonts, colors and so on
i wrote my cobol2pdf program using lex, so i can put in input some
formatted
directives
directives are words at begin of line, followed by optional
parameters
_gbox draw a box
_font change font (take note: this can be a barcode font)
_jpeg embed a jpeg image into pdf
parameters for _jpeg directive are
jpeg file name (must be in working folder or in specific folder for
pictures)
X.Y coordinates
scale factor (from 100 to 10)
My final usage of cobol2pdf is as follow
- i write a simple text file containing all directives to build my
reports
graphics
by default for me all pages of report are same as firts page
this text file could be 300 / 400 lines for a standard INVOICE
model
here i put all directives for drawing all boxes, including logos,
and text
(text directive can put text in landscape orientation, while the
report is in portrait)
- Now from cobol you can
- copy this text file to report output, BEFORE all your data
- leave cobol unchanged but open for print ouput a pipe, calling
one simple SH script
this script should read file where directives are stored, put it
in standard input of
cobol2pdf and copy all data coming in input from cobol to input
of cobol2pdf
I am working in this second way, so from unix shell i can send
obtained report.pdf both
to printer spooler and user's mailbox
Hope my english is not too bad and you can understand
Was a hard job, final result is very fine.
As i wrote, i'm too old to do any more job, so this project was
closed in 2004
Regards,
Alain