Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
4967e47e
Commit
4967e47e
authored
Sep 25, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Graphic drawing functions added
parent
344e91a7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
132 additions
and
8 deletions
+132
-8
src/exe/co_convert/src/cnv_topdf.cpp
src/exe/co_convert/src/cnv_topdf.cpp
+119
-6
src/exe/co_convert/src/cnv_topdf.h
src/exe/co_convert/src/cnv_topdf.h
+13
-2
No files found.
src/exe/co_convert/src/cnv_topdf.cpp
View file @
4967e47e
/*
* Proview $Id: cnv_topdf.cpp,v 1.
4 2007-01-11 11:40:30
claes Exp $
* Proview $Id: cnv_topdf.cpp,v 1.
5 2007-09-25 13:07:33
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -24,6 +24,7 @@
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
...
...
@@ -62,8 +63,13 @@ void CnvPdfObj::print_begin()
number
<<
" 0 obj"
<<
endl
<<
" << /Type /Catalog"
<<
endl
<<
" /Outlines 2 0 R"
<<
endl
<<
" /Pages "
<<
number
+
topdf
->
v_outline
.
size
()
<<
" 0 R"
<<
endl
<<
" /PageMode /UseOutlines"
<<
endl
<<
" /Pages "
<<
number
+
topdf
->
v_outline
.
size
()
<<
" 0 R"
<<
endl
;
if
(
topdf
->
use_outlines
)
topdf
->
fp
[
topdf
->
cf
]
<<
" /PageMode /UseOutlines"
<<
endl
;
topdf
->
fp
[
topdf
->
cf
]
<<
" >>"
<<
endl
<<
"endobj"
<<
endl
<<
endl
;
break
;
...
...
@@ -441,6 +447,108 @@ void CnvToPdf::print_text( char *text, CnvStyle& style, int mode)
y
-=
style
.
bottom_offset
;
}
void
CnvToPdf
::
draw_rect
(
double
lw
,
double
x
,
double
y
,
double
w
,
double
h
)
{
fp
[
cf
]
<<
" "
<<
lw
<<
" w"
<<
endl
<<
" "
<<
x
<<
" "
<<
y
<<
" "
<<
w
<<
" "
<<
h
<<
" re S"
<<
endl
;
}
void
CnvToPdf
::
draw_arc
(
double
lw
,
double
x
,
double
y
,
double
w
,
double
h
,
int
angel1
,
int
angel2
)
{
fp
[
cf
]
<<
" "
<<
lw
<<
" w"
<<
endl
;
if
(
(
angel1
==
0
&&
angel2
>=
90
)
||
(
angel1
==
90
&&
angel2
>=
360
)
||
(
angel1
==
180
&&
angel2
>=
270
)
||
(
angel1
==
270
&&
angel2
>=
180
))
fp
[
cf
]
<<
" "
<<
x
+
w
<<
" "
<<
y
+
h
/
2
<<
" m"
<<
" "
<<
x
+
w
<<
" "
<<
y
+
h
<<
" "
<<
x
+
w
<<
" "
<<
y
+
h
<<
" "
<<
x
+
w
/
2
<<
" "
<<
y
+
h
<<
" "
<<
" c"
<<
endl
;
if
(
(
angel1
==
0
&&
angel2
>=
180
)
||
(
angel1
==
90
&&
angel2
>=
90
)
||
(
angel1
==
180
&&
angel2
>=
360
)
||
(
angel1
==
270
&&
angel2
>=
270
))
fp
[
cf
]
<<
" "
<<
x
+
w
/
2
<<
" "
<<
y
+
h
<<
" m"
<<
" "
<<
x
<<
" "
<<
y
+
h
<<
" "
<<
x
<<
" "
<<
y
+
h
<<
" "
<<
x
<<
" "
<<
y
+
h
/
2
<<
" "
<<
" c"
<<
endl
;
if
(
(
angel1
==
0
&&
angel2
>=
270
)
||
(
angel1
==
90
&&
angel2
>=
180
)
||
(
angel1
==
180
&&
angel2
>=
90
)
||
(
angel1
==
270
&&
angel2
>=
360
))
fp
[
cf
]
<<
" "
<<
x
<<
" "
<<
y
+
h
/
2
<<
" m"
<<
" "
<<
x
<<
" "
<<
y
<<
" "
<<
x
<<
" "
<<
y
<<
" "
<<
x
+
w
/
2
<<
" "
<<
y
<<
" "
<<
" c"
<<
endl
;
if
(
(
angel1
==
0
&&
angel2
>=
360
)
||
(
angel1
==
90
&&
angel2
>=
270
)
||
(
angel1
==
180
&&
angel2
>=
180
)
||
(
angel1
==
270
&&
angel2
>=
90
))
fp
[
cf
]
<<
" "
<<
x
+
w
/
2
<<
" "
<<
y
<<
" m"
<<
" "
<<
x
+
w
<<
" "
<<
y
<<
" "
<<
x
+
w
<<
" "
<<
y
<<
" "
<<
x
+
w
<<
" "
<<
y
+
h
/
2
<<
" "
<<
" c"
<<
endl
;
fp
[
cf
]
<<
" S"
<<
endl
;
}
void
CnvToPdf
::
draw_line
(
double
lw
,
double
x1
,
double
y1
,
double
x2
,
double
y2
,
int
dashed
,
int
gray
)
{
fp
[
cf
]
<<
" "
<<
lw
<<
" w"
<<
endl
;
if
(
dashed
)
fp
[
cf
]
<<
" [2 3] 1 d"
<<
endl
;
if
(
gray
)
fp
[
cf
]
<<
" 0.7 G"
<<
endl
;
fp
[
cf
]
<<
" "
<<
x1
<<
" "
<<
y1
<<
" m"
<<
endl
<<
" "
<<
x2
<<
" "
<<
y2
<<
" l S"
<<
endl
;
if
(
dashed
)
fp
[
cf
]
<<
" [] 0 d"
<<
endl
;
if
(
gray
)
fp
[
cf
]
<<
" 0 G"
<<
endl
;
}
void
CnvToPdf
::
draw_arrow
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
double
x3
,
double
y3
,
int
gray
)
{
if
(
gray
)
fp
[
cf
]
<<
" 0.7 G"
<<
endl
<<
" 0.7 g"
<<
endl
;
fp
[
cf
]
<<
" "
<<
x1
<<
" "
<<
y1
<<
" m"
<<
endl
<<
" "
<<
x2
<<
" "
<<
y2
<<
" l"
<<
endl
<<
" "
<<
x3
<<
" "
<<
y3
<<
" l"
<<
endl
<<
" "
<<
x1
<<
" "
<<
y1
<<
" l"
<<
endl
<<
" B"
<<
endl
;
if
(
gray
)
fp
[
cf
]
<<
" 0 G"
<<
endl
<<
" 0 g"
<<
endl
;
}
void
CnvToPdf
::
draw_text
(
double
x
,
double
y
,
char
*
text
,
int
bold
,
double
size
)
{
char
fontname
[
20
];
if
(
bold
)
strcpy
(
fontname
,
"/F2"
);
else
strcpy
(
fontname
,
"/F1"
);
fp
[
cf
]
<<
" BT"
<<
endl
<<
" "
<<
fontname
<<
" "
<<
size
<<
" Tf"
<<
endl
<<
" "
<<
x
<<
" "
<<
y
<<
" Td"
<<
endl
<<
" ("
<<
text
<<
") Tj"
<<
endl
<<
" ET"
<<
endl
;
}
void
CnvToPdf
::
print_pagebreak
(
int
last
)
{
if
(
page_number
[
cf
]
==
0
)
...
...
@@ -470,7 +578,7 @@ void CnvToPdf::print_pagebreak( int last)
" ET"
<<
endl
;
}
if
(
page_number
[
cf
]
>
1
)
if
(
page_number
[
cf
]
>
1
&&
v_content
.
size
()
>
0
)
v_content
[
page_number
[
cf
]
-
2
].
print_end
();
}
...
...
@@ -485,6 +593,7 @@ void CnvToPdf::print_pagebreak( int last)
v_content
.
push_back
(
o2
);
}
if
(
(
int
)
v_content
.
size
()
>
page_number
[
cf
]
-
1
)
v_content
[
page_number
[
cf
]
-
1
].
print_begin
();
page_number
[
cf
]
++
;
...
...
@@ -502,6 +611,9 @@ void CnvToPdf::print_content()
int
parent
[
4
]
=
{
0
,
0
,
0
,
0
};
int
offset
=
current
;
if
(
!
current
)
return
;
v_outline
[
root
].
first
=
current
;
v_outline
[
root
].
last
=
current
+
size
-
1
;
v_outline
[
root
].
count
=
size
;
...
...
@@ -926,6 +1038,7 @@ void CnvToPdf::open()
if
(
conf_pass
)
{
fp
[
pdf_eFile_Body
].
open
(
filename
[
pdf_eFile_Body
]);
fp
[
pdf_eFile_Body
]
<<
setiosflags
(
ios
::
fixed
)
<<
setprecision
(
6
);
start_offset
=
fp
[
pdf_eFile_Body
].
tellp
();
}
else
{
...
...
@@ -979,7 +1092,7 @@ void CnvToPdf::open()
v_font
.
push_back
(
o8
);
CnvPdfObj
o9
=
CnvPdfObj
(
this
,
pdf_eObjType_Font
,
v_font
.
size
()
+
1
);
strcpy
(
o9
.
fontname
,
"TimesNewRoman
-
Bold"
);
strcpy
(
o9
.
fontname
,
"TimesNewRoman
,
Bold"
);
v_font
.
push_back
(
o9
);
CnvPdfObj
o10
=
CnvPdfObj
(
this
,
pdf_eObjType_Font
,
v_font
.
size
()
+
1
);
...
...
src/exe/co_convert/src/cnv_topdf.h
View file @
4967e47e
/*
* Proview $Id: cnv_topdf.h,v 1.
3 2005-12-21 08:30:25
claes Exp $
* Proview $Id: cnv_topdf.h,v 1.
4 2007-09-25 13:07:33
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -119,7 +119,8 @@ class CnvPdfObj {
class
CnvToPdf
{
public:
CnvToPdf
()
:
cf
(
0
),
ci
(
0
),
prev_ci
(
0
),
conf_pass
(
false
),
xref_offset
(
0
),
im_cnt
(
0
)
cf
(
0
),
ci
(
0
),
prev_ci
(
0
),
conf_pass
(
false
),
xref_offset
(
0
),
im_cnt
(
0
),
use_outlines
(
1
)
{
for
(
int
i
=
0
;
i
<
pdf_cMaxLevel
;
i
++
)
header_number
[
i
]
=
0
;
...
...
@@ -173,6 +174,14 @@ class CnvToPdf {
void
close
();
void
print_text
(
char
*
text
,
CnvStyle
&
style
,
int
mode
=
pdf_mPrintMode_Pos
);
void
draw_rect
(
double
lw
,
double
x
,
double
y
,
double
w
,
double
h
);
void
draw_arc
(
double
lw
,
double
x
,
double
y
,
double
w
,
double
h
,
int
angel1
,
int
angel2
);
void
draw_line
(
double
lw
,
double
x1
,
double
y1
,
double
x2
,
double
y2
,
int
dashed
,
int
gray
);
void
draw_text
(
double
x
,
double
y
,
char
*
text
,
int
bold
,
double
size
);
void
draw_arrow
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
double
x3
,
double
y3
,
int
gray
);
void
print_pagebreak
(
int
print_num
);
void
print_content
();
void
print_h1
(
char
*
text
,
int
hlevel
,
char
*
subject
);
...
...
@@ -204,6 +213,7 @@ class CnvToPdf {
void
decr_headerlevel
();
void
reset_headernumbers
(
int
level
);
void
set_pageheader
(
char
*
text
);
void
set_useoutlines
(
int
u
)
{
use_outlines
=
u
;}
char
*
fontname
(
CnvStyle
&
style
);
vector
<
CnvPdfObj
>
v_pages
;
...
...
@@ -229,6 +239,7 @@ class CnvToPdf {
int
start_offset
;
int
xref_offset
;
int
im_cnt
;
int
use_outlines
;
};
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment