DocAutoBookmarks() problem

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
jk
Posts: 11
Joined: Fri Mar 23 2007

DocAutoBookmarks() problem

Post by jk »

Hi!

I'm using function DocAutoBookmarksA from the API DLL.
It has problems with some of the font sizes.
Such call will fail:

DocAutoBookmarksA(hDocument, 1, "Arial,20,400,0,0", 1);

The target file is converted from the Microsoft Word or Notepad and contains paragraphs in Arial 20 (regular) (for Notepad all entire the document is printed using this font).

If I use font Arial 18 then DocAutoBookmarksA(hDocument, 1, "Arial,18,400,0,0", 1) successfully generates bookmarks.

A little research shows that following font sizes work:
12,18,24.
The following don't work:
19,20,21,22,23
Other sizes have not been tested. :)

Input PDF converted (using Amyuni driver) from the .doc file which contains text lines in ALL font sizes. Sizes listed above were never detected (for the Arial font at least, other fonts have not been tested).

Could you, please, suggest any workaround for this problem (or provide a fix)? I cannot use only "supported" fonts in the input documents...

Thanks.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

We will check this and get back to you.

Which version of the PDF Converter are you currently using?
jk
Posts: 11
Joined: Fri Mar 23 2007

Post by jk »

I'm using version 3.0 (cdintf.dll file version 3.0.0.0).
jk
Posts: 11
Joined: Fri Mar 23 2007

Post by jk »

Hi again.

It looks like I found the problem: font size inside of the converted document is aligned to dots (pixels) count accordingly to the DPI settings.
For example, when the input .doc file uses Arial 20pt on 300dpi page it is reported as Arial 19.92 pt in the resulting PDF:
20pt/72*300 = 83.333 pixels
rounded to 83 pixels;
reported as 83/300*72 = 19.92 pt

In my examples, 12, 18 and 24 fonts sizes work correctly because of they are strictly aligned to pixels in 300dpi resolution (which I use for my tests):
12/72*300 = 50
18/72*300 = 75
24/72*300 = 100

When I use 72dpi page resolution (or a multiple of 72) all font sizes are aligned to pixels and have they real values in the output document.
Therefore DocAutoBookmarks() works correctly for all fonts sizes when page resolution is a multiple of 72.

Unfortunately, DocAutoBookmarks() does not accept float-point fonts sizes and does not work with an input like "Arial,19.92,400,0,0" so I cannot use non-integer fonts size to workaround this problem.

I think the best way is to perform fonts size comparison using rounded (not floating or truncated) fonts sizes from the document...

Best regards!
Post Reply