r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[PDF-Maker] discuss Gabriele's pdf-maker

Janko
11-May-2009
[587x2]
This is my sample script so far : http://www.refaktor.si/storage/try1.r
  this is the PDF it generates so far  (I need to make an invoice) 
http://www.refaktor.si/storage/test.pdf
Gabriele: I have few questions if I may :) 

- how to make certain tablecells / rows bg-colored (like light gray) 
...

- how to know what fonts are available, can I add mine (will this 
work on linux too, testing on windos now)

- I need to have non-asci characters work too (my lang has šèž) could 
this be a big problem?

Thanks a ton for making pdf maker
Janko
12-May-2009
[589]
for example I see cell-decor as a place to define bg-color but if 
I put it into cell definition next to width (or any other place) 
I get "cell-decor has no value"
Gabriele
12-May-2009
[590x5]
the keyword is just "decor".
eg. from test-pdfm.r
table test [56 86 56] [ ] [
        top padding 3 stretch 2
        bottom padding 3 stretch 2
        left padding 3
        right padding 3
        decor [
            paint edge width 0.2 255.255.0 [
                xtr - 2 ybl + 2

                bezier xtr + 1.5 ybl + 2 xtr - 2 ybl - 1.5 xtr - 2 ybl + 2
                xtr - 2 ytr - 2

                bezier xtr - 2 ytr + 1.5 xtr + 1.5 ytr - 2 xtr - 2 ytr - 2
                xbl + 2 ytr - 2

                bezier xbl - 1.5 ytr - 2 xbl + 2 ytr + 1.5 xbl + 2 ytr - 2
                xbl + 2 ybl + 2

                bezier xbl + 2 ybl - 1.5 xbl - 1.5 ybl + 2 xbl + 2 ybl + 2
                close
            ]
        ]
you'll probably just use a box so it's much simpler.
fonts: only the 14 standard pdf fonts are available.
Janko
12-May-2009
[595]
hi Gabriele .. I used decor as in your example to make table vitw 
visible grid ... but is it possible to make just specific cells with 
for example different fill color, or color ... I see it in code but 
can't use it  


upthere is my example http://www.refaktor.si/storage/test.pdfhttp://www.refaktor.si/storage/try1.r
Gabriele
12-May-2009
[596x4]
they are: Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic, 
Helvetica, Helvetica-Bold, Helvetica-Oblique, Helvetica-Oblique, 
Courier, Courier-Bold, Courier-Oblique, Courier-BoldOblique, Symbol, 
ZapfDingbats
what you see in the example above is the default decor. you can set 
a custom decor in each cell... i think at the beginning of the cell 
block, but i don't remember, i'd need to check.
(yes, beginning of cell block.)
http://www.colellachiara.com/soft/PDFM2/pdf-maker.html#section-3.3
Janko
12-May-2009
[600x2]
uh, I tried cell-decor and decor probably not on the beginning ... 
ah I only got it now cell-decor is name of word that defines 'decor 
as a rure
rule
Gabriele
12-May-2009
[602x3]
non-ascii: the only supported encoding so far is latin1 (basically... 
more precisely i think i have it set to the Windows variation, which 
iirc is windows-1252) - that is, the same that View uses on western 
Windows installations.
unfortunately the PDF format does not have direct support for encodings 
except for the default windows encoding, the default mac encoding, 
and an adobe encoding; they are all variations of latin1.
to do anything else font tricks are often being used. i wish they 
just had support for utf-8...
Janko
12-May-2009
[605x3]
yes, we just started to suspect that what you said about encoding
do you know anything about this http://www.tv.com.pl/stepbystep/pdfinclude/
 .. I am trying by manually editing the pdf file but so far no changes
( about decor I tried in table cell  decor [ set-fill 50.50.50 ] 
and there were no errors  -- but I don't see any background .. )
Gabriele
12-May-2009
[608]
if i ever get to the point of adding support for custom fonts, then 
i might be able to also give the fonts any encoding.
Janko
12-May-2009
[609]
( but encoding is 100x bigger problem for me )
Gabriele
12-May-2009
[610x2]
you need to do something like                           decor [box 
line width 0 xbl ybl xtr - xbl ytr - ybl]
but with a solid box instead
Janko
12-May-2009
[612]
aha, I will look into that then, thanks for direction
Gabriele
12-May-2009
[613]
ie. solid box 128.128.128   should give you a gray bg (you need the 
coords like in the example above)
Janko
12-May-2009
[614x2]
ok thanks!
do you think that /Encoding /Differences [
200 /Ccaron
232 /ccaron
] 

doesn't work because it's PDF-1.3  and in that example it's PDF 1.6, 
maybe this is more recent feature?
Gabriele
12-May-2009
[616x3]
yes, that's very likely.
i don't know how version support is these days, maybe it's worth 
upgrading to newer versions of the format.
you could change the header though and just try to set it to 1.6 
- though i don't know if everything else will work then. (going from 
1.3 to 1.4 didn't require any changes iirc)
Janko
12-May-2009
[619]
I tried that and nothing happened then I changed the encoding object 
headers to <<
/Type /Encoding
/BaseEncoding /WinAnsiEncoding
/Differences [
and got error while opening (18)
Gabriele
12-May-2009
[620x2]
the trailer needs to be redone
did you do the change in the pdf maker code or in the file?
Janko
12-May-2009
[622x3]
in the pdf file ... I discovered one good news now ... I need csz 
( like ch sh zh in eng) .. I saw  that zh that I thought before doesn't 
have a glyph in standard fonts didn't make it to the generated pdf 
and if I add it by hand and update length of stream Zh works ... 
so now only Ch is the problem .. (because it's not represented in 
win1252 , the character with same code 200 in 1252 is E (arrow) È
so if  that differences would work and exchange 200 with Ccaron it 
would all work
I will try more
Gabriele
12-May-2009
[625x3]
changing the pdf file directly will break it because the index at 
the end needs to point to all the objects in the file... so if objects 
move around the index needs to be redone.
it's possible to edit the pdf file by appending stuff to it, but 
you'll need to read the specs to make that work, it's not entirely 
trivial either.
the easiest way would be to change the pdf-maker code to actually 
produce what you need.
Janko
12-May-2009
[628x4]
aha, thanks
that might have caused the error before then ..
do you know are there all glyphs displayed for these standard fonts 
so I could at least know if Ch ch are in there at all ?
I found an example of PDF from Haru library which uses all ISO8859 
encoding 1 - 20 ... it is version PDF-1.3 , it does use the /Differences 
for each encoding, it also defines widths for them, I intend to look 
at it and somehow transfer it to pdf-maker .. but I am not sure how 
successfull I will be as pdf-maker seems quite complex beast
Oldes
12-May-2009
[632]
It's not possible to use utf8 encoding with pdf-maker ?
Janko
12-May-2009
[633x2]
I think not, and it's not a simple problem to solve.. PDF looks very 
horrible in this regard to me
I can't even make it support Latin2
Oldes
12-May-2009
[635]
I wish to have more time to play a little bit with the pdf-maker
Janko
12-May-2009
[636]
it's very nice, but because of 1 letter that I can't generate in 
it Ch .. you have it too probably .. I need to find another solution 
.. and I have invoice nicely made in pdf-maker already