Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - PDF Font Display Issue
  FAQ FAQ  Forum Search   Register Register  Login Login

PDF Font Display Issue

 Post Reply Post Reply
Author
Message
ysr View Drop Down
Beginner
Beginner


Joined: 02 Aug 18
Location: Melbourne
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote ysr Quote  Post ReplyReply Direct Link To This Post Topic: PDF Font Display Issue
    Posted: 11 Feb 19 at 12:40AM
I have a PDF file that uses MSLineDraw (Embedded Subset) font to show lines and borders.

For this file, if I write a text using DrawText, all the borders drawing are getting messed up and after writing, it shows only the Helvetica font in the Document properties Font List.

Also I noticed this issue happens not just with DrawText and even if I use SetTextSize (without writing anything using that size), this issue happens.

I have already tried NormalizePage, TransformFile, CombineContentStreams etc without much luck.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 2923
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 11 Feb 19 at 9:29AM
Hi ysr,

few things to keep in mind...
QuickPDF works with unicode.
Fonts used before and after have to be the same to get comparable results.
If you need an external font inside the library you have to add it (AddTrueTypeFont).
Regarding lines we have DrawLine in the library:
https://www.debenu.com/docs/pdf_library_reference/DrawLine.php

HTH Ingo


Cheers,
Ingo

Back to Top
ysr View Drop Down
Beginner
Beginner


Joined: 02 Aug 18
Location: Melbourne
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote ysr Quote  Post ReplyReply Direct Link To This Post Posted: 11 Feb 19 at 10:12PM
Hi Ingo,

Thank you very much for your reply.

The existing font is MSLineDraw and the Encoding is shown as "Built In" (When I view the font details via Adobe properties screen).

I am not trying to draw any line. On this file, even if I just call SetTextSize(12) and save the file, all the previous fonts are getting removed, only Helvetica font is added and the contents get messed up.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 2923
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 12 Feb 19 at 10:39AM
Regarding the issue "fonts" you should read in the developer guide at chapter 4.15 and further.
http://www.debenu.com/docs/pdf_library_developer_guide/foxit_quick_pdf_library_15_developer_guide.pdf

The library supports only some standard fonts. In the developer guide you'll find these fonts.
If you need additionally fonts for a matching layout you have to add these fonts as font files.

If you have an external pdf file and want to know if there's a font file inside (not referenced) then you can use function "HasFontResources".

If we should check your pdf document for similar results with our routines you should upload the pdf anywhere posting the link here.

Cheers,
Ingo

Back to Top
ysr View Drop Down
Beginner
Beginner


Joined: 02 Aug 18
Location: Melbourne
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote ysr Quote  Post ReplyReply Direct Link To This Post Posted: 13 Feb 19 at 6:35AM
Hi Ingo,

The sample file is available at http://203.89.208.176/samplefile.pdf

For this, If I do a draw text the file gets messed up. I do not think it is the way I am using drawtext or adding fonts, as it works with every other file.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 2923
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 13 Feb 19 at 7:42AM
Hi,

i did the download and will check it within few days.
Perhaps another one here will do the same.
The problem will be the used font i think...

Cheers,
Ingo

Back to Top
ysr View Drop Down
Beginner
Beginner


Joined: 02 Aug 18
Location: Melbourne
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote ysr Quote  Post ReplyReply Direct Link To This Post Posted: 14 Feb 19 at 9:11AM
Thank you very much Ingo. Really appreciate the support especially on a community forum.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 2923
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 14 Feb 19 at 7:02PM
Hi Yoganathan,

what i've done so far...
I've checked your file with my PDF-Analyzer.
There is one font referenced: CourierNew.
There is one font embedded: MSLineDraw.

Then i've added a page number at the bottom, on the right side "page 1 from 1".
I didn't select a font doing this.
QuickPDF took "Times Bold" - Now i've a second font referenced in the pdf.
My rendered preview wasn't messed up - it still looks well layouted.

What you should do before drawing text into a new (for you new) pdf document:

1. Using CombineContentStreams:
https://www.debenu.com/docs/pdf_library_reference/CombineContentStreams.php
2. Using NormalizePage:
https://www.debenu.com/docs/pdf_library_reference/NormalizePage.php

Then you shouldn't have problems like described here.

Cheers,
Ingo

Back to Top
ysr View Drop Down
Beginner
Beginner


Joined: 02 Aug 18
Location: Melbourne
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote ysr Quote  Post ReplyReply Direct Link To This Post Posted: 14 Feb 19 at 7:34PM
Hi Ingo,

Thank you very much for that. I did use both of those functions and also tried various others such as BalanceContentSTreams etc without much luck. I assume I may not be using them in the right order or with right parameters.

Would it be possible to share the sample code that worked for you?
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 2923
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 14 Feb 19 at 8:06PM
Hi,


mmmmh... here it is but i fear this won't help you much.

// . . .
   QP  := TDebenuPDFLibrary1611.Create;
   try
      Save_Cursor   := Screen.Cursor;
      Screen.Cursor := crHourglass;    // Show hourglass cursor

      QP.LoadFromFile(Edit1.text, '');
      QP.SetTempPath(tpath);

      If QP.EncryptionStatus > 0 Then
         QP.Decrypt;

//-- if rb5 checked = true ... new page numbering at the bottom

      if rb5.Checked = True Then
         begin
            QP.SetOrigin(1);
            QP.SetMeasurementUnits(0);
// . . .
            sfont := QP.AddStandardFont(10);
// . . .
            QP.SelectFont(sfont);
// . . .
            If ( Trim(combocolor.Text) = 'red' ) or ( Trim(combocolor.Text) = 'rot' ) Then
               QP.SetTextColor(1,0,0);
// . . .
            for i := 1 to QP.PageCount do
                begin
// . . .
                   QP.SelectPage(i);
// . . .
                   QP.SetTextSize(StrToInt(snrufg.Text));
// . . .
                   QP.DrawText(StrToInt(snrpos.Text), QP.PageHeight - ( 3 + StrToInt(snrufg.Text) ), gtxt);
                end;
            QP.SetMeasurementUnits(0);
         end;
//-------------------------------------------
   finally
// . . .


Cheers,
Ingo

Back to Top
ysr View Drop Down
Beginner
Beginner


Joined: 02 Aug 18
Location: Melbourne
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote ysr Quote  Post ReplyReply Direct Link To This Post Posted: 14 Feb 19 at 8:44PM
Thanks Ingo

 A couple of questions though

1) On this code you are not using NormalizePage or CombineContent streams. Did it work without those?
2) How do you save the file at the end? I use SaveToFile to overwrite the same file.


Edited by ysr - 14 Feb 19 at 8:45PM
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 2923
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 14 Feb 19 at 9:21PM
Normalize and combine are at another place more at the top ...
I'm using the normal Save from QuickPDF.

Yes. It CAN work without Normalize and Combine... but not for all files.
If there's a file with rotate nnn included then it won't work proper without Normalize...




Edited by Ingo - 14 Feb 19 at 9:23PM
Cheers,
Ingo

Back to Top
ysr View Drop Down
Beginner
Beginner


Joined: 02 Aug 18
Location: Melbourne
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote ysr Quote  Post ReplyReply Direct Link To This Post Posted: 14 Feb 19 at 9:28PM
Shouldn't the CombineContentstreams need to be done after loading the file and NormalizePage for each file rather than at the top?
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 2923
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 14 Feb 19 at 10:18PM
I MEAN AFTER LOAD!
With "at the top" i mean not in the code range i've copied but before.
Please read the online reference, the online samples, the developer guide, ...


Cheers,
Ingo

Back to Top
ysr View Drop Down
Beginner
Beginner


Joined: 02 Aug 18
Location: Melbourne
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote ysr Quote  Post ReplyReply Direct Link To This Post Posted: 08 Mar 19 at 2:14AM
Just for the benefit of others who may have similar issue, with the help of Debenu (Foxit) support team we found:

1) The file had the page media box and page resources defined outside of page object
2) By calling BalancePageTree(0) once the file is loaded, we managed to fix the issue.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store