[fpc-pascal] fpPDF and support of Latin2 charset

LacaK lacak at zoznam.sk
Fri Mar 22 12:22:13 CET 2019



>> (but looking into PDF there is still in FontDescriptor wrong
>> MissingWidth attribute, which does not goes into play AFAICS)
> What do you think is wrong with it?
Look into test-noembed.pdf which I have attached to prior email. There is:
10 0 obj
<<
/Type /FontDescriptor
/FontName /Courier#20New
/FontFamily /Courier#20New
/Flags 32
/Ascent 1255
/Descent -386
/CapHeight 1170
/FontBBox [-122 -680 623 1021]
/ItalicAngle 0
/StemV 70
/MissingWidth 61453   <-- HERE
 >>

endobj


>   On my side it is set to 600, which
> as far as I can see is correct for cour.ttf subset embedded font.

Yes that is correct and I have 600 in:

8 0 obj
<<
/Type /Font
/Subtype /CIDFontType2
/BaseFont /Courier#20New
/CIDSystemInfo 9 0 R
/FontDescriptor 10 0 R
/W [ 16 [600] 36 [600] 40 [600] 44 [600] 50 [600] 56 [600] 200 [600] 101 
[600] 203 [600] 207 [600] 210 [600] 253 [600] 277 [600] 226 [600] 228 [600]]
 >>
endobj


>   That
> value is only used by PDF viewers when they need to display a glyph, but
> the glyph is not defined in the selected font.

Yes may be that wrong value will never be used so it will have no 
negative impact, but it is potential source of problem ...


>
> I'll take another look at the spacing issue.

Thank you ... In case no font is embedded all is okay, but in case font 
is embedded something wrong is still there ...


>
>
>> Can I ask what is purpose of Sections in PDF structure?
>> Because when I want use more than 1 Section I get exception "Dictionary
>> element "Count" not found."
> It allows you to be infinitely flexible with the layout of a document.
> eg: If a report had several sections with different margins, headers,
> footers, orientation etc. You would use sections to set those. Attached
> is a very simple PDF showing sections. Note: some had different page
> layout, page numbering etc.
>
> If you have a decent PDF (reporting) viewer that support sections, you
> can jump between sections like you jump between pages.
I ma trying look at PDF document using Adobe Acrobat Reader and Foxit 
Reader, but I can not see sections (nor any support for jumping between 
them) ...

So in PDF document sections correspond to /Kids [5 0 R 14 0 R 21 0 R] ...


>   fpGUI's "report
> preview" supports that.
>
> I'll take a look at the sections issue you raised. Would you be so kind
> as to create a Mantis report for that specific bug.

https://bugs.freepascal.org/view.php?id=35258


>
>
>> Would it be possible to add "shortcut" AddPage directly to TPDFDocument,
>> which will add Page to last Section or create new section if none exists?
> Obviously it could be added, but do we? It's comes down to different
> users with different needs. Plus what Michael said about the Dutch
> saying. ;-)

Of course, but why not make life easier if we can. I think, that 99% of 
users will use only 1 section and also section concept is not intuitive 
without explanation (or if is not documented)

Same holds for default Options. If now is preset in constructor:

FOptions := [poCompressFonts, poCompressImages];

how many users will benefit from?:

FOptions := [poCompressFonts, poCompressImages, poPageOriginAtTop, 
poSubsetFont];

I think that it is useful. (why repeat something which can be preset and 
gives reasonable default settings)
It has also educational effect, which teach users what is optimal. In 
case of poSubsetFont why someone should not use always poSubsetFont? IMO 
it is always good choice have smaller sized file than bigger, does not?


>
>
>> How complicated would be add support for digital signing of PDF documents?
> I briefly looked at that when I implemented fpPDF, and that is quite
> tricky.  Plus I don't fully understand all the requirements yet.
:-( ok thank you

(I am asking because in future probably in our company we will need 
generate PDF invoices which should be digitaly signed)


>> How complicated would be (in case of embedding fonts) subset only those
>> characters, which are used in document, not a whole font?
> That is exactly how [poSubsetFont] works. Simple to test. Embed a large
> font like "DejaVu Sans". With poSubSetFont disabled, a one page PDF with
> the only text "Hello World" will be a couple of MBs in size. Then enable
> poSubsetFont and see the massive size reduction.

Yes

-Laco.





More information about the fpc-pascal mailing list