fpPDF and support of Latin2 charset

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

fpPDF and support of Latin2 charset

LacaK
Hi,

I am trying work with fpPDF. I can create PDF document, but character
out of ASCII range are displayed wrong (in PDF file they are stored as
UTF8).
Probably it is because I use standard Courier font, which is expecting
only "Latin characters" ? I use:

FontIndex := PDF.AddFont('Courier'); // --> test1.pdf

When I want to use TTF font:

FontIndex := PDF.AddFont('cour.ttf','CourierNew');  // --> test2.pdf
(nothing else this line has changed)

I get strange PDF file (I can open it but content is wrong)

What I am doing wrong? Is there way how to get correct PDF with
characters from Latin2 code page?
Is there way how to get correct PDF file WITHOUT embedding full Courier
font?

Thanks

-Laco.

Full source code is:

var
   PDF: TPDFDocument;
   FontIndex: integer;
begin
   PDF := TPDFDocument.Create(Self);
   PDF.Infos.Producer := '';
   PDF.Infos.CreationDate := Now;
   PDF.Options := [poPageOriginAtTop, {poNoEmbeddedFonts,} poSubsetFont,
poCompressFonts, poCompressImages];
   PDF.DefaultOrientation := ppoPortrait;
   PDF.DefaultPaperType := ptA4;
   PDF.DefaultUnitOfMeasure := uomMillimeters;
   PDF.FontDirectory := 'C:\WINDOWS\FONTS';
   PDF.StartDocument;
   PDF.Sections.AddSection;
   PDF.Sections[0].AddPage(PDF.Pages.AddPage);;

   //FontIndex := PDF.AddFont('Courier');
   FontIndex := PDF.AddFont('cour.ttf', 'CourierNew');
   PDF.Pages[0].SetFont(FontIndex, 10);
   PDF.Pages[0].WriteText(10,10,'AEIOU-ÁÉÍÓÚ-ČŠŇŽ');
   PDF.Pages[0].WriteText(10,15,'----------------');
   PDF.Pages[0].WriteText(10,20,'AEIOU-ÁÉÍÓÚ-ČŠŇŽ');

   PDF.SaveToFile('test.pdf');
end;


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

test1.pdf (1K) Download Attachment
test2.pdf (24K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

Michael Van Canneyt


On Tue, 19 Mar 2019, LacaK wrote:

> Hi,
>
> I am trying work with fpPDF. I can create PDF document, but character out of
> ASCII range are displayed wrong (in PDF file they are stored as UTF8).
> Probably it is because I use standard Courier font, which is expecting only
> "Latin characters" ? I use:
>
> FontIndex := PDF.AddFont('Courier'); // --> test1.pdf
>
> When I want to use TTF font:
>
> FontIndex := PDF.AddFont('cour.ttf','CourierNew');  // --> test2.pdf
> (nothing else this line has changed)
>
> I get strange PDF file (I can open it but content is wrong)
>
> What I am doing wrong? Is there way how to get correct PDF with characters
> from Latin2 code page?
Not to my knowledge.
You must use unicode for characters outside the ASCII range.

> Is there way how to get correct PDF file WITHOUT embedding full Courier font?

You can embed only the needed characters for every font ?

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

LacaK


Hi,

I am trying work with fpPDF. I can create PDF document, but character out of ASCII range are displayed wrong (in PDF file they are stored as UTF8).
Probably it is because I use standard Courier font, which is expecting only "Latin characters" ? I use:

FontIndex := PDF.AddFont('Courier'); // --> test1.pdf

When I want to use TTF font:

FontIndex := PDF.AddFont('cour.ttf','CourierNew');  // --> test2.pdf
(nothing else this line has changed)

I get strange PDF file (I can open it but content is wrong)

What I am doing wrong? Is there way how to get correct PDF with characters from Latin2 code page?

Not to my knowledge. You must use unicode for characters outside the ASCII range.

Seems, that Adobe in https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf in Annex D2: "Latin Character Set and Encodings" specifies exactly which characters are supported (by standard 14 fonts). Characters not listed there are simply replaced by "X" in Adobe Acrobat Reader. But Foxit reader displays them correctly (so I can use full range of characters from CP1250 when I specify appropriate <</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [...] ...

Seems that in case when standard fonts are used fpPDF does not convert Utf8String on input of WriteText() function CP1252 ...?



Is there way how to get correct PDF file WITHOUT embedding full Courier font?

You can embed only the needed characters for every font ?
Probably yes, but fpPDF will not handle this automatically? AFAIK I can not control this.

But why I get unreadable characters? What I am doing wrong ?

-Laco.



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

LacaK


>>> Is there way how to get correct PDF file WITHOUT embedding full
>>> Courier font?
>>
>> You can embed only the needed characters for every font ?
> Probably yes, but fpPDF will not handle this automatically? AFAIK I
> can not control this.
>
> But why I get unreadable characters? What I am doing wrong ?
>
It seems that there is problem specific to CourierNew font (cour.ttf).
With Arial (arial.ttf) it works as expected.

Attached program which demonstrates problem.

-Laco.


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

test_fpPDF1.pas (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

LacaK

>
>
>>>> Is there way how to get correct PDF file WITHOUT embedding full
>>>> Courier font?
>>>
>>> You can embed only the needed characters for every font ?
>> Probably yes, but fpPDF will not handle this automatically? AFAIK I
>> can not control this.
>>
>> But why I get unreadable characters? What I am doing wrong ?
>>
> It seems that there is problem specific to CourierNew font (cour.ttf).
> With Arial (arial.ttf) it works as expected.
>
> Attached program which demonstrates problem.

Reported as bug https://bugs.freepascal.org/view.php?id=35251
(probably there is problem in parsing Courier New TTF font?)

-Laco.


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

Michael Van Canneyt


On Wed, 20 Mar 2019, LacaK wrote:

>
>>
>>
>>>>> Is there way how to get correct PDF file WITHOUT embedding full
>>>>> Courier font?
>>>>
>>>> You can embed only the needed characters for every font ?
>>> Probably yes, but fpPDF will not handle this automatically? AFAIK I
>>> can not control this.
>>>
>>> But why I get unreadable characters? What I am doing wrong ?
>>>
>> It seems that there is problem specific to CourierNew font (cour.ttf).
>> With Arial (arial.ttf) it works as expected.
>>
>> Attached program which demonstrates problem.
>
> Reported as bug https://bugs.freepascal.org/view.php?id=35251
> (probably there is problem in parsing Courier New TTF font?)

I am not sure this is the reason.

I suspect that the Arial font has unicode glyphs, and courier not.

Because how is the PDF generator supposed to know that it should transcode your text to latin 2 ?

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

LacaK

>>
>>>
>>>
>>>>>> Is there way how to get correct PDF file WITHOUT embedding full
>>>>>> Courier font?
>>>>>
>>>>> You can embed only the needed characters for every font ?
>>>> Probably yes, but fpPDF will not handle this automatically? AFAIK I
>>>> can not control this.
>>>>
>>>> But why I get unreadable characters? What I am doing wrong ?
>>>>
>>> It seems that there is problem specific to CourierNew font (cour.ttf).
>>> With Arial (arial.ttf) it works as expected.
>>>
>>> Attached program which demonstrates problem.
>>
>> Reported as bug https://bugs.freepascal.org/view.php?id=35251
>> (probably there is problem in parsing Courier New TTF font?)
>
> I am not sure this is the reason.
>
> I suspect that the Arial font has unicode glyphs, and courier not.
>
I do not know, but with other fonts: Arial, Verdana, Consolas it works
as expected. Do you think, that Courier New is only exception?

When I look at
https://docs.microsoft.com/en-us/typography/font-list/courier-new I do
not see there something special compared to other fonts ...

But my knowledge about font structures (and also about PDF internals) is
minimal ...


> Because how is the PDF generator supposed to know that it should
> transcode your text to latin 2 ?

I do not know if it is necesssary.

I have used FPDF port of PHP PDF library, which I have rewritten to
pascal and there I can use "Courier New" font.
(in both ways as embedded and also when not embedded)

Probably FPDF handles PDF generation bit differently, but when I write
into file any text in code page CP1250 and I embedd Courier New font
(generated in advance by using makefont.php utility) then I get correct
result.

So my raw guess was that it must be doable also using fcl-pdf somehow?

-Laco.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

Michael Van Canneyt


>>
>> I suspect that the Arial font has unicode glyphs, and courier not.
>>
> I do not know, but with other fonts: Arial, Verdana, Consolas it works
> as expected. Do you think, that Courier New is only exception?
>
> When I look at
> https://docs.microsoft.com/en-us/typography/font-list/courier-new I do
> not see there something special compared to other fonts ...
>
> But my knowledge about font structures (and also about PDF internals) is
> minimal ...

I don't know much about TTF, but PDF should simply map characters to glyphs
found in the TTF.

>> Because how is the PDF generator supposed to know that it should
>> transcode your text to latin 2 ?
>
> I do not know if it is necesssary.
>
> I have used FPDF port of PHP PDF library, which I have rewritten to
> pascal and there I can use "Courier New" font.
> (in both ways as embedded and also when not embedded)

>
> Probably FPDF handles PDF generation bit differently, but when I write
> into file any text in code page CP1250 and I embedd Courier New font
> (generated in advance by using makefont.php utility) then I get correct
> result.
>
> So my raw guess was that it must be doable also using fcl-pdf somehow?

Possibly.

Graeme Geldenhuys wrote 99% of the PDF and TTF support, I suspect he can
tell us more.

I will ask.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

José Mejuto
In reply to this post by LacaK
El 19/03/2019 a las 15:00, LacaK escribió:
>
>
> It seems that there is problem specific to CourierNew font (cour.ttf).
> With Arial (arial.ttf) it works as expected.
>
> Attached program which demonstrates problem.

Hello,

Can you send me by direct mail the pdf result for that program ? I´ll
try to spot the differences.

The name "CourierNew" while the TTF name is "Courier New" may force a
typographic fallback to a standard font. PDF font handling is a mess,
design patch over patch, several ways to render the same glyphs, ...
It's almost incredible that a program can render successfully any
document :-)


--

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

Graeme Geldenhuys-6
In reply to this post by LacaK
On 19/03/2019 08:46, LacaK wrote:
> I am trying work with fpPDF. I can create PDF document, but character
> out of ASCII range are displayed wrong (in PDF file they are stored as
> UTF8).

First things first... what version of FPC are you using? FPC 3.0.4 or
FPC 3.1.1 - just so I know what code to look at.

I had a quick look and indeed there is something strange (or different)
with the "cour.ttf" font. At closer inspection (using FontForge font
editor) the "cour.tff" as supplied by Microsoft is some hybrid
TTF+Bitmap font. The "arial.ttf" is a pure truetype font (no bitmap
glyphs embedded).

Not 100% sure yet if that is the cause or not. Maybe some special
processing is needed for hybrid fonts. I'll investigate further.


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

LacaK

>> I am trying work with fpPDF. I can create PDF document, but character
>> out of ASCII range are displayed wrong (in PDF file they are stored as
>> UTF8).
> First things first... what version of FPC are you using? FPC 3.0.4 or
> FPC 3.1.1 - just so I know what code to look at.

I tried both versions 3.0.4 and also trunk


>
> I had a quick look and indeed there is something strange (or different)
> with the "cour.ttf" font. At closer inspection (using FontForge font
> editor) the "cour.tff" as supplied by Microsoft is some hybrid
> TTF+Bitmap font. The "arial.ttf" is a pure truetype font (no bitmap
> glyphs embedded).
>
> Not 100% sure yet if that is the cause or not. Maybe some special
> processing is needed for hybrid fonts. I'll investigate further.

I think that problem is related to font parsing. As I wrote in comment
to bug report #35251 there is incorrectly extracted information about
char Widths ... look into attached generated PDF there ...

Thank you ...

-Laco.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

Graeme Geldenhuys-6
On 21/03/2019 13:20, LacaK wrote:
> I think that problem is related to font parsing. As I wrote in comment
> to bug report #35251 there is incorrectly extracted information about
> char Widths ... look into attached generated PDF there ...

Ah yes, I see what you mean. Apologies, I didn’t read the bug report,
only this thread.

I am looking at FPC Trunk and ran the ttfdump utility I wrote and it
bombs out with a “Range check error” while processing the glyph widths.
So that is mostly likely the cause of the problem. I’ll debug that now.


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

Graeme Geldenhuys-6
I attached 2 patches to the bug tracker which solves the problem for me.


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

LacaK

> I attached 2 patches to the bug tracker which solves the problem for me.
1.
I can confirm, that in my case it is fixed for NO-embedded case only.
For embedded fonts case there is still small issue (some characters are
okay, some are shifted) - see attachments

(but looking into PDF there is still in FontDescriptor wrong
MissingWidth attribute, which does not goes into play AFAICS)

2.
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."
Try:
   PDF.Sections.AddSection;
   PDF.Sections[0].Title := 'Section1';
   PDF.Sections[0].AddPage(PDF.Pages.AddPage);

   PDF.Sections.AddSection;
   PDF.Sections[1].Title := 'Section2';
   PDF.Sections[1].AddPage(PDF.Pages.AddPage);

3.
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?
(if I guess right there is no big usage of sections in user code, so
hide sections from user POV is no issue)

4.
How complicated would be add support for digital signing of PDF documents?

5.
How complicated would be (in case of embedding fonts) subset only those
characters, which are used in document, not a whole font?
(or does it works already so?)

6.
Would it be possible to use as default:
FOPtions := [poCompressFonts, poCompressImages, poPageOriginAtTop,
poSubsetFont];
(which are IMO most used options)

Thank you

-Laco.



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

test-noembed.pdf (6K) Download Attachment
test-embed.pdf (52K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

Michael Van Canneyt


On Fri, 22 Mar 2019, LacaK wrote:

>
>> I attached 2 patches to the bug tracker which solves the problem for me.
> 1.
> I can confirm, that in my case it is fixed for NO-embedded case only. For
> embedded fonts case there is still small issue (some characters are okay,
> some are shifted) - see attachments
>
> (but looking into PDF there is still in FontDescriptor wrong MissingWidth
> attribute, which does not goes into play AFAICS)
>
> 2.
> 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."
> Try:
>   PDF.Sections.AddSection;
>   PDF.Sections[0].Title := 'Section1';
>   PDF.Sections[0].AddPage(PDF.Pages.AddPage);
>
>   PDF.Sections.AddSection;
>   PDF.Sections[1].Title := 'Section2';
>   PDF.Sections[1].AddPage(PDF.Pages.AddPage);
This needs to be looked at...

>
> 3.
> 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?
> (if I guess right there is no big usage of sections in user code, so hide
> sections from user POV is no issue)

I think this is a good idea in each case.

>
> 4.
> How complicated would be add support for digital signing of PDF documents?

My guess is that this is not so easy.

>
> 5.
> How complicated would be (in case of embedding fonts) subset only those
> characters, which are used in document, not a whole font?
> (or does it works already so?)

It aleready works so if you use poSubsetFont.

>
> 6.
> Would it be possible to use as default:
> FOPtions := [poCompressFonts, poCompressImages, poPageOriginAtTop,
> poSubsetFont];
> (which are IMO most used options)

Anything is possible, but IMO it's better to encourage people to think about what they're doing.

There is a dutch saying "Laziness is the pillow of the devil."...

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

Graeme Geldenhuys-6
In reply to this post by LacaK
On 22/03/2019 07:16, LacaK wrote:
> (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? On my side it is set to 600, which
as far as I can see is correct for cour.ttf subset embedded font. 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.

I'll take another look at the spacing issue.


> 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. 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.


> 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. ;-)


> 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.

> 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.



Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

MultiSections.pdf (12K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

LacaK


>> (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.


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

Joost van der Sluis
On 3/22/19 12:22 PM, LacaK wrote:
>>> 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)

I've looked at the documentation and it is quite doable to implement
this. Could be a nice task, but it will and somewhere at the bottom of
my to-do list until I need it for my work myself.

If you or others really need this in the future, you might set a bounty
or something.

Regards,

Joost

--
http://lazarussupport.com - Your donation helps to push Free Pascal and
Lazarus forwards.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

LacaK


>>
>> (I am asking because in future probably in our company we will need
>> generate PDF invoices which should be digitaly signed)
>
> I've looked at the documentation and it is quite doable to implement
> this. Could be a nice task, but it will and somewhere at the bottom of
> my to-do list until I need it for my work myself.

Of course. I understand. If it goes into play may be I will look at
details also. As far as we are company owned by state we have relative
strong restrictive policy for what we can spend money ;-|

L.


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpPDF and support of Latin2 charset

Graeme Geldenhuys-6
On 22/03/2019 13:29, LacaK wrote:
> As far as we are company owned by state we have relative
> strong restrictive policy for what we can spend money ;-|

Tell them how much money (£2000+) they save per developer by using FPC
versus Delphi. A small money contribution to get something they need is
a small price to pay. I showed my company the price saving for a 5
person development team. They couldn’t believe the savings, and allowed
me to develop the open source fpGUI and others during company time,
because they benefited too from using those tools in their commercial
products.

It’s a win-win situation.

Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
12